Python Newbie

Piterrr piotrekd at optonline.net
Tue Feb 26 14:42:18 EST 2013


"Jean-Michel Pichavant" <jeanmichel at sequans.com> wrote in message 
news:mailman.2567.1361905815.2939.python-list at python.org...
>
> ----- Original Message -----
>> Hi guys,
>>
>> Question. Have this code
>>
>> intX = 32                          # decl + init int var
>> intX_asString = None               # decl + init with NULL string var
>>
>> intX_asString = intX.__str__ ()    # convert int to string
>>
>> What are these ugly underscores for?
>> _________________str___________________
>>
>> Peter
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
> I can't wait for the
>
> intX_asString_asBool = intX_asString.__bool__()
>
> if (intX_asString_asBool == True):
>  # do something
>
> ;-)
>
> JM

As serious a character as I am, I had good laughs at this. Don't you all 
like my questions for all the exitainment they offer?

The "__str__" issue was a genuine question. I'm glad to find there is also a 
__bool_ () method, shall I need it. :-) Please note, this is not how I write 
my code. I'm not that bad a programmer, it's just Python which is so 
different that I am doing what I need to help clarify things and help me 
out.

I don't find this post offensive, even though JM is deliberately making fun 
of me. But to his credit, it is funny indeed. Let's laugh 2gether!

This reminds me, when I first started working with databases and saw an 
error msg which said that my query had "ambiguous columns" I laughed for 1/2 
hr. I found it incredibly exitaining that a 100% deterministic piece of 
hardware could have the word "ambiguous" in its internal dictionary.

:-))

Peter 




More information about the Python-list mailing list