One thing nice about Python is that it is actually pretty tricky to make unreadable. You'd have to put effort into it, because readability constraints are part of the syntax (eg. the spacing for control flow).
well, because its object oriented, most often times you can write code like this
method1(**args).method2( **args ).somethingelse( **args)
still, it depends on programmer. If he chooses to write something like this
f=lambda x="8<:477\02092020162\020\037",y="01001000110100101":reduce(lambda
x,y:x+y,map(lambda y,x:chr(ord(y)*2+x),x,map(int,y)));print f();
or this
print ''.join('%(pre)s%(num)s %(bot)s on the wall, %(nul)s %(bot)s,\n%(tak)s\n' % (lambda c,b:
{'pre':['','%s %s on the wall.\n\n' % (c,b)][abs(cmp(c,'Ninety-nine'))],
'num':c, 'nul':c.lower(), 'bot':b,
'tak':['Go to the store and buy some more... Ninety-nine %s.' % b,'Take one down, pass it around,'][abs(cmp(x,0))]
})((lambda x,o: [(['Twenty','Thirty','Forty','Fifty',
'Sixty','Seventy','Eighty','Ninety'][x/10-2]+'-'+o.lower()).replace('-no more',''), o][int(x<20)])(x, ['No more','One','Two',
'Three','Four','Five','Six','Seven','Eight',
'Nine','Ten','Eleven','Twelve','Thirteen','Fourteen',
'Fifteen','Sixteen','Seventeen','Eighteen','Nineteen'][[x,x%10][int(x>=20)]]),'bottle%s of beer' % ['','s'][abs(cmp(x,1))])
for x in xrange(99,-1,-1))
some of the things that can lead to unread Python code
- nested lambdas
- redefine functions by assignment
- make an single instance of the % operator used for both modulus and string formatting
- same with +, * for addition, string concatenation, etc.
- evade indentation enforcement by writing things in recursive pseudo-functional ways
- do something like foo(bar(), baz()) where bar() redefines foo() and baz()
- litter the code with numeric and string literals that look like they're doing something (but don't)
- cause exceptions solely for the purpose of later extracting obscure data from them
Copied from
here Python code, can be made unreadable! Its all about the programmer! No one can deny that, not even Quantos.
and not to mention, because languages that doesn't have static typing often make it not easy to understand what variables stand for, unless we have good naming convention. eg myvar_int , myvar_str
On the other hand, one weird thing is that the self reference has to be specified explicitly (I guess since the methods don't have modifiers, it's the only way to differentiate a class method from an instance method), and "special" methods like __getitem__ have those funky underscores to flag them as a special function, but because those are usually accessed using something else they don't typically appear except at declaration. (And they have to be tagged somehow).
all language have their quirks. What matters is, use their syntax correctly and make it do the job. That's more important than ranting.
Title: About Python
Reply #1: Python.
Reply #2: Python.
Reply #3: Python.
Reply #4: Python.
Reply #5: Perl.
Thread subjects are not a game of Duck, Duck, Goose.
wrong. #2 is game. I didn't post any Perl code , or Java code, or Ruby code, or PHP code. Please, if you want to start this, I am game. The thread just merely says "Python in one easy lesson". Thread author didn't say anything else with regards to discusson on other languages. Why are all these assumptions made that only Python can be discussed. This is a fact. Don't deny it. If you people don't like my comments, then debate it and refute my points like a knowledgable adult, don't keep giving the excuse that "this thread is only for Python" and only Python can be discussed. FYI, this thread is in a Computer programming forum. Its not in a purely Python forum. And this is also a fact.
What is so hard to understsand that I merely posted a factual comment, that most languages with good RS232 libraries can also do the job ? So difficult to understand that its a general observable, factual comment and you people have to make it sound like a language war.