寻找资源,使从Java到Python的跳转更容易,更高效 [英] Looking for resources for making the jump from Java to Python easier and more productive

查看:62
本文介绍了寻找资源,使从Java到Python的跳转更容易,更高效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用python,经历了很长的历史与

Java。我想知道是否有任何人的资源或提示在Python-land中可以帮助我成功转换为

成功?也许你自己完成了转型

或者只是对那些已经过渡的人有经验。


我正在寻找常见的类型表示Java / C#或

甚至C ++开发人员可能会犯的错误。更多的例子,比如这里突出显示的那些 rel =nofollowhref =http://dirtsimple.org/2004/12/python-is-not-java.html\"target =_ blank > http://dirtsimple.org/2004/12/python-is-not-java.html

特别有用。我已经制作了静态类

方法的错误,并被包裹和

进口/ froms彻底搞糊涂了,并且试图打电话给超级极其沮丧

构造函数等。我正忙着传递函数

(ala命令模式),自定义运算符并扩展

内置类。我之前做过的所有这些概念都是这样的。

没有什么比用另一种

语言更好的了。 python的一些非常强大的想法(例如建议链接中的
)关于创建一个包含模板函数的函数

可以满足所有可能的实现听起来很酷并且

同时对我不感兴趣。这就是我对b $ b感兴趣的东西。


此时我会说我的python代码更多在
python中编写Java而不是以pythonic方式编写Java。也许有一些好的/很好的b / b
我可以看一下Python脚本或项目的例子来启发或学习pythonic实现的想法?我只是不知道

任何。是否有常见模式的python特定等价物,

反模式和重构书如此流行如何用b ++和Java推荐阅读?如果是这样的话?


鉴于Python现在越来越受欢迎,那么你们中的一些人已经过了很多人的转型成功并有一些珍贵的珍珠分享你希望你早些时候知道的




谢谢

Todd

I''m just starting out with python, after having a long history with
Java. I was wondering if there were any resources or tips from anyone
out there in Python-land that can help me make the transition as
successfully as possible? Perhaps you''ve made the transition yourself
or just have experience with folks who have made the transition.

I''m looking for the common types of mistakes that say a Java/C# or
even C++ developer may commonly make. More examples like those
highlighted here http://dirtsimple.org/2004/12/python-is-not-java.html
would be particularly useful. I''ve already made the static class
method mistake, and been thoroughly confused by packages and
imports/froms and extremely frustrated with attempting to call super
constructors etc. I''m getting the hang of passing around functions
(ala the command pattern), customising the operators and extending
inbuilt classes. All of these concepts I''ve done before so there
nothing really great and wonderful about using them in another
language. Some of the really powerful ideas of python (eg as suggested
in the link) about creating one function containing a template function
that can cater to all possible implementations sounds really cool and
alien to me at the same time. That''s the sort of stuff I''m
interested in.

At this point in time I''d say my python code is more coding Java in
python than doing it in a pythonic way. Perhaps there some good/great
examples of Python scripts or projects that I could look at to get
inspired or learn pythonic implementation ideas? I just don''t know of
any. Are there python specific equivalents to the common Patterns,
Anti-Patterns and Refactoring books that are so prevalent as
reccomended reading in C++ and Java? If so what?

Given the rising popularity of Python these days there has got to be a
few of you out there who''ve made the transition successfully and have
some pearls-of-wisdom to share that you''d wished you''d known about
earlier.

Thanks
Todd

推荐答案

文章< 11 ******* ***************@u72g2000cwu.googlegroups .com> ;,

" ToddLMorgan" <为了********* @ gmail.com>写道:
In article <11**********************@u72g2000cwu.googlegroups .com>,
"ToddLMorgan" <To*********@gmail.com> wrote:
我正在寻找普通类型的错误,这些错误说的是Java / C#或者甚至是C ++开发人员通常会犯的错误。
I''m looking for the common types of mistakes that say a Java/C# or
even C++ developer may commonly make.



当你不必使用子类时。例如,您可能有一个

Java方法,该方法将java.io.OutputStream类型的参数转换为它写入的
。你可以把它翻译成一个Python方法,你要小心只传递文件对象子类的实例。

但事实上没有必要这样做:你可以自由传递任何具有适当成员的

对象。


我想这是更一般规则的一个实例:当使用OO时,使用OO />
你不需要。



Using subclassing when you don''t have to. For instance, you might have a
Java method which takes an argument of type java.io.OutputStream to
which it writes. You might translate this to a Python method to which
you are careful to only pass instances of subclasses of file objects.
But in fact there is no necessity for this: you are free to pass any
object which has appropriate members.

I suppose this is an instance of the more general rule: "using OO when
you don''t have to".


在文章< 11 *************** *******@u72g2000cwu.googlegroups .com> ;,

" ToddLMorgan" <为了********* @ gmail.com>写道:
In article <11**********************@u72g2000cwu.googlegroups .com>,
"ToddLMorgan" <To*********@gmail.com> wrote:
是否有常见模式的python特定等价物,
反模式和重构书如此普遍,如何推荐用C ++和Java阅读?
Are there python specific equivalents to the common Patterns,
Anti-Patterns and Refactoring books that are so prevalent as
reccomended reading in C++ and Java?




我认为它们不存在。这样的书籍更倾向于在企业环境中进行开发,每个提案都必须通过多层管理来实现
,而且什么都没有做到

个人独自工作,总是由团队工作在单独的部分工作

的项目。而且最终用户并没有真正得到更多的说法。

如何应该工作。它只是在如此高昂的开销,自上而下,覆盖你的屁股环境中,这些书被视为

完全有用。可能是因为没有人会被解雇

购买它们。


我会说像Python和Perl这样的语言是
这种发展文化。



I don''t think they exist. Such books are targeted more towards
development in a corporate environment, where every proposal has to go
through multiple layers of management, and nothing is ever done by
individuals working alone, always by "teams" working on separate parts
of the project. And also where the end-users don''t really get much say
in how things are supposed to work. It''s only in such a high-overhead,
top-down, cover-your-ass environment that such books are looked on as
being at all useful. Possibly on the grounds that nobody ever got fired
for buying them.

I''d say languages like Python and Perl are the absolute antithesis of
this sort of development culture.


ToddLMorgan写道:
ToddLMorgan wrote:
我刚刚开始python,经过与Java的悠久历史。我想知道是否有来自Python-land的任何人的资源或技巧可以帮助我尽可能成功地进行过渡?也许你自己已经完成了转型
或者只是对那些已经过渡的人有经验。
I''m just starting out with python, after having a long history with
Java. I was wondering if there were any resources or tips from anyone
out there in Python-land that can help me make the transition as
successfully as possible? Perhaps you''ve made the transition yourself
or just have experience with folks who have made the transition.




前段时间我不得不学习一点Java是为了能够编写一些签名的jython浏览器小程序,我可以在

高度限制的公共图书馆计算机上工作时使用它。所以我想我来自

相反的方向:-)无论如何我想知道为什么(以及如何!)非常小

jython脚本可以取代大块的java代码。


也许从jython的角度来看它会对你来说很有教育意义。我认为通过jython遍历

其类系统来实现自动生成或填充多少java代码将会很有趣。 br />

我也希望它能为高级java创造一个机会,让你能够在jython中编写一些很酷的签名java applet。 >
用于python的idle.py的外观和感觉但是这将从

webbrowser运行。


我知道它可以完成,因为我确实写了一些实验但仍然很好的功能,比如一个jython控制台webbrowser小程序,

a websucker.py在浏览器中运行,我攻击了其他一些

jython编辑器 - 控制台(eclipse很适合这类事情)添加一些

功能并自己做签名和库选择。


但是,不要问我的代码,它已经远远不够了。无论如何,

从那时起我找到了一份工作,让我可以获得更少锁定的电脑,这也很有趣。


安东



Some time ago I had to learn a bit of Java in order to be able to write
some signed jython browser applets that I could use while working at a
highly restricted public library computer. So I guess I was coming from
the opposite direction :-) Anyway I wondered why (and how!) very small
jython scripts could replace large blocks of java code.

Maybe looking at it from a jython perspective will be educational for
you. I think it would be a lot of fun realizing how much java code can
actually be ''automatically'' generated or filled in by jython traversing
its class system.

Also I''m hoping it would produce an opportunity for an advanced java
coder to write some cool signed java applet in jython that would have
the look and feel of idle.py for python but that would run from a
webbrowser.

I know it can be done because I did write some experimental but still
already very functional things like a jython console webbrowser applet,
a websucker.py running from within a browser, and I hacked some other
jython editor-console (eclipse is good for such things) to add some
functionality and do my own signing and library selection.

Don''t ask for my code yet though, it''s nowhere near presentable. Anyway,
since then I found a job that gives me access to less locked down
computers which is also fun.

Anton


这篇关于寻找资源,使从Java到Python的跳转更容易,更高效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆