creating class objects inside methods

Carl Banks pavlovevidence at gmail.com
Sun Oct 4 02:09:34 EDT 2009


On Oct 3, 10:34 pm, horos11 <horo... at gmail.com> wrote:
> Anyways, I see what's going on here:
>
> With the line,
>
> for state in curstate.next_states():
>     if not state.to_string() in seen_states:
>         dq.append(state)
>
> Inadvertently using the name of a module as a variable seems to be
> causing this.

Nope, unless by "module" you meant "class".


> In any case, this shouldn't cause issues with constructors, so I'd
> call this a bug..

It's not a bug.  In Python classes and global variables share the same
namespace.

Don't you think you should learn a bit more about how Python manages
objects and namespaces before going around calling things bugs?


Carl Banks



More information about the Python-list mailing list