joel.goldstick at gmail.com
Mon Feb 25 00:05:25 CET 2013
On Sun, Feb 24, 2013 at 5:43 PM, <piterrr.dolinski at gmail.com> wrote:
> Not thank you for your malicious post.
> I think you are missing the point here.
> My source code was just a dummy to offer context for the question I wanted
> to ask. Further down the line, if I ever feel I don't need to
> pseudo-declare variables I will stop doing it. But for the moment I am
> trying to imitate familiar ground.
> My code as written has no syntax errors, so what's the problem? It is
> highly unlikely you will ever read any of my Python code - no need to get
> excited over a few of my lines.
> And you don't need to answer questions which were not posed, thank you.
> I wanted Python to register what type of variable I'm after. So I init my
> vars accordingly, int might be 0, float 0.0 and string with null, err...
In a language that defines Names that are bound to objects, there can't be
a 'type' inferred. In C or similar, when you delcair the variable you are
setting aside the memory to hold something of that type. This is compile
time typing. That isn't how python works, so naming something an int will
never make it an int. intMe = 'Joel' is totally valid in python.
Sticking to ideas like this will hinder understanding of how python works.
I suggest taking two hours to study the python documentation at python.org.
I don't speak Chinese, but I know that I can't just use a dictionary of
English to Chinese and use the same syntax. It won't be Chinese.
Get over your prejudice and learn the new language.... or don't, but trying
to shoe horn python into the concepts of another language won't help you
understand python, it will produce ugly, messy, unsupportable code.
> In practice, I wouldn't define an intX_asString var, I would do "str
> (num)" every time a string representation is needed, provided it isn't a
> loop, as in that context the expression would probably negatively impact
> performance in an interpreted language.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list