New submission from Ram Rachum <cool...@cool-rr.com>:

Let's say you have this structure:

a\
  __init__.py
  b\
    __init__.py

In `b.__init__` a function called `my_function` is defined.

And assume that `a` and `b` are both on `sys.path`. Then this situation happens:

    >>> import a.b
    >>> import b
    >>> a.b.my_function is b.my_function
    False
    >>> a.b.my_function
    <function my_function at 0x00BC70C0>
    >>> b.my_function
    <function my_function at 0x00BC7108>
    >>> a.b.my_function.__module__
    'a.b'
    >>> b.my_function.__module__
    'b'

It seems that `a.b.my_function` and `b.my_function` are different objects.

----------
messages: 116536
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `a.b.my_function is not b.my_function` when `a` and `b` are both on 
`sys.path`
type: behavior
versions: Python 2.6, Python 3.1, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9872>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to