Possible Duplicate:
Common Pitfalls in Python
I'm learning Python and I come from a diverse background of programming languages. In the last five years, I've written quite a bit of Java, C++, VB.Net, and PHP. As many of you might agree, once you learn one programming language, learning another is just a mater of learning the differences in syntax and best practices.
Coming down from PHP, I've become very accustomed to a lot of script-style language features. For instance, stuff like this tickles me insides:
# Retrieve the value from the cache; otherwise redownload.
if(!($value = $cache->get($key)))
# Redownload the value and store in the cache.
$cache->set($key, $value = redownload($key));
Python, though, doesn't consider assignment to be an expression. OTOH, it does support nice things like the in
construct, which I find to be one of the greatest inventions of all time. x in y
is so much nicer than !empty($y[$x])
.
What other nuances, "missing" features, and performance bottlenecks should I watch out for? I'm hoping to make as seamless a transition into Python development as possible, and hope to learn some of the secrets that will help to smooth out development time and eliminate trial and error. Your insight is appreciated!