Re: Python scope

From: Tony Arkles <tony_at_no.spam.please>
Date: Fri Jul 20 2007 - 07:38:08 CST

On 19-Jul-07, at 7:10 PM, Steven Kurylo wrote:

>> You've also accidentally done something else that scares the crap out
>> of me about python. You've gone ahead and redefined the builtin type
>> "list" to be something else :)
>
> Its just an illustration :-) I figured that issue out pretty quick...
>
> Thats another thing which really annoys me. My first python program I
> called ldap.py, because I was going to do ldap work. Guess what
> happened when I imported the ldap module?
>
> I couldn't figure for ten minutes why the tutorial code worked in the
> interpreter, but then I pasted it into a file and it stopped working.
> Then I tried the interpreter again and it stopped working too!
>
> That just shouldn't be.

Hahahaha, that sounds really familiar.

Another stupid mistake I made when I was first learning (and took
forever to debug), was something like:

x = [ 1,2,3,4,5,6,7,8 ]
sum = sum(x)

lots of stuff

sum = sum(y)
^^^ Exception happens here, because sum isn't a function anymore
Received on Fri Jul 20 07:41:28 2007

This archive was generated by hypermail 2.1.8 : Fri Jul 20 2007 - 07:41:32 CST