Browsing All Posts published on »May, 2011«

Iterators, Generators and yield

May 10, 2011

0

Python is really a great programming language as not only does it provide simple access to text and data but also does it facilitate simple method to boost batch processing. In python programmers can easily use for ... in ... to iterate over a collection. Moreover, they can simply make their objects iterable by generators […]

Long string in source code

May 9, 2011

0

It is annoying to have a long string in source code, but sometimes it is hard to get rid of it from your source code. But for python it is suggested that to have 79 chars per line in source code. Here comes a trick from [1]. OR Do REMEMBER that commas are not allowed […]

Magic Asterisk

May 9, 2011

0

In python, programmers can use *-operator to unpack a list or tuple as a set of parameters to a function. It is quite tricky to pass multiple arguments to a function with this operator. For keyword arguments, programmers can use **-operator.