Python Newbie

Joel Goldstick joel.goldstick at gmail.com
Sun Feb 24 18:05:25 EST 2013


On Sun, Feb 24, 2013 at 5:43 PM, <piterrr.dolinski at gmail.com> wrote:

> Josh,
>
> 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...
> None.
>

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.
>
> Peter
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130224/99028f90/attachment.html>


More information about the Python-list mailing list