My take on 'Python Productivity tip for Java Programmer'. Could you give me more feedback?

Anthony Kong anthony.hw.kong at gmail.com
Mon Jul 11 12:42:56 EDT 2011


Thomas,

Thanks for the excellent suggestions.

Generator is certainly an interesting subject.

>From what i understand, the advantage of generator is mainly about saving
memory, right? (i.e. no need to create a list in memory before iterate thru
it)

Duck typing... Although it can be easily demonstrated, I find it hard to
explain its advantages to Java developers who are so used to Interfaces. (Is
it about the certainty of type info... I am not sure about their concern
actually)

Jython is not a possibility, but I will show them an example anyway. We can
use it to write some support script, I suppose.

(Off topic) Monkey patching - It is a term used by Ruby developer a lot. If
it means to change a function's implementation in run-time, i think python
can achieve the same, right? Is it equivalent to Mixin?

Cheers



On Tue, Jul 12, 2011 at 2:00 AM, Thomas Jollans <t at jollybox.de> wrote:

> On 07/11/2011 05:07 PM, Anthony Kong wrote:
> > Hi, all,
> >
> > Lately I am giving some presentations to my colleagues about the python
> > language. A new internal project is coming up which will require the use
> > of python.
> >
> > One of the goals of the presentations, as told by the 'sponsor' of the
> > presentation, is to help the existing Java/Excel VBA programming team to
> > become productive in python asap.
> >
> > I have a feeling that they are asking it based on their Java/Eclipse
> > experience. By productive they are actually looking for some GUI tools
> > that are as helpful as Eclipse.
> >
> > Having done Java programming before, I am thinking of answering the
> > question this way:
> >
> > 1) For many of us, vi/emacs are sufficient for python development. (I
> > used vim + ctags as my primary IDE for a very long time)
> >
> > 2) For a feature-rich GUI environment, we can consider pyCharm. (I was
> > totally 'wowed' by it, and has convinced my last employer to purchased a
> > few enterprise licenses)
> >
> > 3) The Python language itself is actually small and concise. The need
> > for a full-blown IDE is less. The language itself could be counted as a
> > part of the productive tool.
>
> If your colleagues are used to Eclipse, it's almost certainly best to
> continue using Eclipse, with PyDev. Don't make a big deal of the tools,
> just say that many Pythonista don't use a heavy IDE, mention PyDev, and,
> if you want to, recommend pyCharm.
>
> > 4) The functional aspect of the language (e.g. map, reduce, partial)
> > helps to make program shorter and easier to understand
>
> Don't overemphasize this. Those functions can be very useful, and using
> them can lead to very concise and simple code, but (big BUT) more often
> than not, they're overly cryptic when compared to list comprehension and
> generator expressions.
>
> Do make a huge case for generator expressions/list comprehension, and
> generators.
>
> > 5) The 'battery included' standard library helps to avoid the need of
> > complicated build tool.
> >
> > 6) The interactive shell helps to test out solutions in smaller units.
>
> Speaking of testing: introduce them to the doctest module.
>
> > It is probably not the team is expecting. Do you have more to add? What
> > do you think about this 'answer'?
>
> If using Jython is an option, present it! Jython will allow Java
> programmers to use their existing knowledge of the Java standard library.
>
> Explain, and make the case for, duck typing.
>
> While actual functional programming is, as I said, a bit "out there"
> from a Java/VBA standpoint, do show off function objects.
>
> If you know what they're going to do with Python, you should point them
> to relevant libraries/modules.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 

Tony Kong
*blog:* www.ahwkong.com

Don’t EVER make the mistake that you can design something better than what
> you get from ruthless massively parallel trial-and-error with a feedback
> cycle. That’s giving your intelligence *much* too much credit.


- Linus Torvalds
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110712/c4065356/attachment-0001.html>


More information about the Python-list mailing list