How clean/elegant is Python's syntax?
Ma Xiaojun
damage3025 at gmail.com
Wed May 29 21:14:06 EDT 2013
On Thu, May 30, 2013 at 8:24 AM, Dan Stromberg <drsalists at gmail.com> wrote:
> I'm finding it kind of hard to imagine not finding Python's syntax and
> semantics pretty graceful.
>
> About the only thing I don't like is:
>
> var = 1,
>
> That binds var to a tuple (singleton) value, instead of 1.
>
> Oh, and method decorators seem much more complex than they should've been.
Yes, you touched something. IMHO, Python has far more built-in
features so it looks at least complicated from time to time.
For example, some people use "generating 9x9 multiplication table" as
an programming exercise.
What interest me is a one liner:
print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in
range(1,10)]) for j in range(1,10)])
I don't like code like this. But Python at least allow such practise.
> But on the whole, python is a pretty beautiful language. It's not just
> another rehash of Pascal though; if that's what you want you might be better
> off looking elsewhere.
That's a fair point.
More information about the Python-list
mailing list