Thinking in Java & Writing in Python

Why thinking in Java?

Java means a lot for computer science.

And it gives a best practice in project.

Thinking in Java can make you coding with better understanding the program.

More stability, less error.

Thinking in Java, is not the famous book, instead, is a thinking of programming.

Why not writing in Java?

Verbose.

Java is a static type programming language.

You have to consider many types, this is acceptable, but you have to write many type codes, which makes coding takes more and more time.

At this point, efficiency is more valuable for a tester.

I always need to realize more function in less time.

So I choose to writing in Python.

I like python, this is not the first time I said.

What I like most is simple and freedom.

Great truths are always simple.

The funny thing is, by import this, you can read the ‘The Zen of Python‘:

>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren‘t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you‘re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it‘s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let‘s do more of those!

The third row said, Simple is better than complex.

Use python, you can coding in any way you like.

Python affords many magic.

And also, freedom is one of these magic.

Nobody do not like freedom.

But, if you want to write high quality program.

You have to thinking in Java.

Thinking in Java, Writing in Python.

版权申明:本文为博主原创文章,转载请保留原文链接及作者。

原文地址:https://www.cnblogs.com/df888/p/12636245.html

时间: 2024-11-01 01:29:02

Thinking in Java & Writing in Python的相关文章

在java中调用python方法

1.http://sourceforge.net/projects/jython/下载jython包,把其中的jython.jar添加到工程目录 示例: 1.摘自:http://blog.csdn.net/anbo724/article/details/6608632 1.在java类中直接执行python语句 import javax.script.*; import org.python.util.PythonInterpreter; import java.io.*; import sta

为什么用 Java:一个 Python 程序员告诉你

这篇文章专门给程序员写的,普通读者慎入.原作者:Kevin Sookocheff 译者:Celia Zhen,原文点击文末链接. 每当我告诉别人我一直在用Java工作时,大家的反应都是: “纳尼!Java?为啥是Java?” 说实话,本人刚开始的时候也是同样的反应.但是由于Java的类型安全,执行性能和坚如磐石的工具,我渐渐地开始欣赏Java.同时我注意到,现在的Java已今非昔比——它在过去的10年间稳健地改善着. 缘何是Java? 假 设每天都用Java的想法还没有让君恶心到食不下咽,我在此

翻译《Writing Idiomatic Python》(五):类、上下文管理器、生成器

原书参考:http://www.jeffknupp.com/blog/2012/10/04/writing-idiomatic-python/ 上一篇:翻译<Writing Idiomatic Python>(四):字典.集合.元组 下一篇:TO BE UPDATED.. 2.7 类 2.7.1 用isinstance函数检查一个对象的类型 许多新手在接触Python之后会产生一种“Python中没有类型”的错觉.当然Python的对象是有类型的,并且还会发生类型错误.比如,对一个int型对象

如何在Java中调用Python代码

有时候,我们会碰到这样的问题:与A同学合作写代码,A同学只会写Python,而不会Java, 而你只会写Java并不擅长Python,并且发现难以用Java来重写对方的代码,这时,就不得不想方设法“调用对方的代码”. 下面我将举一些简单的小例子,借此说明:如何在Java中调用Python代码. 看懂这篇文章只需要具备: 熟悉Java的基本语法 懂一点点Python 主要内容如下: 什么是Jython? 一个HelloPython程序 在Jvm中执行Python脚本 仅在Java中调用Python

翻译《Writing Idiomatic Python》(三):变量、字符串、列表

原书参考:http://www.jeffknupp.com/blog/2012/10/04/writing-idiomatic-python/ 上一篇:翻译<Writing Idiomatic Python>(二):函数.异常 下一篇:TO BE UPDATED.. 2.1 变量 2.1.1 对多个变量要赋同一个值时,使用链式赋值让语句变得简明 Python支持链式赋值使多个变量可以在一次链式赋值中被设置为同一个值,这使得语句更加简明. 不良风格: 1 x = 'foo' 2 y = 'foo

Atitit.异步编程 java .net php python js 的比较

Atitit.异步编程 java .net php python js 的比较 1. 1.异步任务,异步模式,  APM模式,,  EAP模式, TAP 1 1.1.       APM模式: BeginXXX/EndXXX, IAsyncResult 2 1.2.       EAP模式(基于事件的异步模式) 2 1.3.      TAP(基于任务的异步模式) 2 2. 异步的实现机制::主要是通过线程and线程池实现的... 2 3. 异步编程的开发::当前都是通过api的,将来应该可以使

2017年12月14日 一个Java开发的Python之路----------------(二)

说一个收获最大的,就是这个关闭流对象 之前写java读取文件的时候,最后往往要关闭流对象,以前我一直不明白,为什么,我不使用.close()方法,文件也可以读取成功,总感觉没有什么意义 原来是因为,这个.close()方法,不是给java文件,或者python文件执行的,因为关于文件对象的操作,都是由操作系统去完成的 这个打开,read,和close都是告诉操作系统要执行,至于这个close()是告诉操作系统,说我的文件执行完了,可以回收资源了. 当然你不写关闭,对读写都没有什么影响,但是,可能

java如何实现python的urllib.quote(str,safe=&#39;/&#39;)

最近需要将一些python代码转成java,遇到url编码 urllib.quote(str,safe='/') 但java中URLEncoder.encode(arg, Constant.UTF_8)会将'/'转成%2F 网上查了一下 java没见到类似的safe方式,只好自己实现一个类 package com.ppc.spider.fc.util; import java.io.ByteArrayOutputStream; import java.io.BufferedWriter; imp

001 发大招了 神器的效率工具--Java代码转python代码

今天发现一个好玩的工具:可以直接将java转成python? 1. 安装工具(windows 环境下面)? 先下载antlr:? 下载链接如下: http://www.antlr3.org/download/antlr-3.1.3.tar.gz? 或者到百度云下载: 百度云链接:http://pan.baidu.com/s/1gdgXUM3 密码:2qrx? ? ? 下载成功并解压后,进入\antlr-3.1.3\runtime目录,输入CMD,在CMD中输入如下指令: python setup