Python Newbie

Joshua Landau joshua.landau.ws at gmail.com
Sun Feb 24 18:13:43 EST 2013


On 24 February 2013 22:43, <piterrr.dolinski at gmail.com> wrote:

> Josh,
>
> Not thank you for your malicious post.
>

Be careful, us programmers do *eventually* catch on to who is a troll, and
if you say things like that we may eventually mark you off as just to
hostile.
I *honestly* meant no malice or insult. If you can't take my word, you can
point out what I said that was otherwise.

(Then again, you'll have about a week before we really start to notice :P)


> 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.
>

You said "Any comments on this before I quit my job?".

I commented on how I think you should approach Python in order to
appreciate its virtues rather than get stuck in its differences. Again, I
am no good programmer, but I think these methods will help you.


> And you don't need to answer questions which were not posed, thank you.
>

Nor do I need to answer questions which were posed.


> 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.
>

You seem to think that a "null" version of a type is the falsy version.
Then:
int -> 0
float -> 0.
tuple -> ()
list -> []

And then (*dun dun duuun!*):

str -> "" (NOT None, which is a different type)

Other people have commented on whether this is a good idea (it's not), so
I'll suggest you read those, too.

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.


PS: Guess what str(None) is.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130224/6296a829/attachment.html>


More information about the Python-list mailing list