As in any language - write your code clearly and use the correct data
structures. Then profile - amazed how many people overlook this step and just
start guessing where the bottleneck is... From the profile data you optimize
the hottest code paths and in Python it's fairly straightforward to move bits
and pieces into C if they're cpu-bound -- if you're I/O bound, libraries like
gevent can help you exploit I/O parallelism.
On Mon, Jan 07, 2013 at 11:48:05AM -0500, Simeon Franklin wrote:
> Hi all -
> I'm wondering if there are any language specific anti-patterns in
> Python I should be aware of. I'm not thinking things like choosing the
> right algorithm or general observations (don't use an ORM) but
> wondering if there are any language level features that may not
> perform well.
> I can think of legacy issues that are mostly fixed: string
> concatenation is now optimized in CPython AFAIK (although I still tend
> to join arrays of strings) and there is no need for DSU when
> sorting... But for current versions of Python the only things that
> jump to mind are observations that hold true for most dynamic
> languages: minimize dot lookups, don't overuse objects, etc. Are there
> any typical Python gotcha's that I'm missing?
> Your feedback is appreciated!
> Simeon Franklin
> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
> This message was sent by Simeon Franklin ([address removed]) from San Francisco Python Meetup Group.
> To learn more about Simeon Franklin, visit his/her member profile: http://www.meetup...
> Set my mailing list to email me
> As they are sent
> In one daily email
> Don't send me mailing list messages
> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]