the lvalue curse? let's play with this crazy idea ;)

XLiIV Tymoteusz.Jankowski at gmail.com
Fri May 9 05:13:34 EDT 2008


I started playing with Python and love it since the very beginning,
programming using Python is so ...human-like? but one thing returns to
me almost everytime when I see/write the code


Let's take a look at two ways of thinking...
the standard one which is well-known and loved by almost everyone :)
and that crazy concept below which suprised evan me :wacko:

<code>
import time

ftime = time.time()
localtime = time.localtime(ftime)
localtime = list(localtime[:3])
localtime = [str(i) for i in localtime]
print '-'.join(localtime)
</code>

It's harder to read than the below concept, isn't?
Maybe I didn't used to this way of thinking yet. I hope it'll change
soon or i'll quit ;)


<almost code>
time.time() -> ftime -> time.localtime() -> p -> p[:3] -> g -> list(g)
-> '-'.join()
</almost code>

My example conclusion and not-ansewered-yet question...
-it's nice to read and choosing the good names to variables aren't so
important
-what is the purpose of the variables here? :)

I realize that there is no chance to implement it, but I really want
to share it :]

Peace,
T.

PS
forgive my my english
[shall I set it as a signature? ;) ]



More information about the Python-list mailing list