[BangPypers] from __past__ import PyHistory
Senthil Kumaran
orsenthil at gmail.com
Wed Jan 14 12:04:09 CET 2009
> "Beautiful is better than Ugly"
>
ZEN: Special cases aren't special enough to break the rules.
1) Character being a string datatype of length 1 illustrates that.
There is no character datatype.
This is opposite way of thinking that string is an array of
characters, making character as the special case of string. I think
this is influenced from a VHLL perspective that strings will be more
often used.
>>> name = "String"
>>> type(name)
<type 'str'>
>>> type(name[0])
<type 'str'>
>>>
In C,
you explicitly define an array of characters for a string and deal
with them as a array.
2) Iteration through string like lists illustrates this point again.
for char in "String":
print char
I dont know any other VHLL, so some one can provide an example.
And just while writing this, I think comparing C and Python is wrong.
They are from different generations. Python should be compared with
any other dynamic programming language.
--
Senthil
More information about the BangPypers
mailing list