>> Ok, I get it. I was locally importing a pointer to an integer
>
> Really? What language were you using? Python doesn't have pointers.
What term do you prefer? Reference? Object id holder?
--
Posted via a free Usenet account from http://www.teranews.com
--
http://mail.python.org/mailma
On Wed, 16 Jan 2008 15:31:54 -0800, Tobiah wrote:
>> Again, those aren't copies. There is only one instance of each value,
>> referenced by multiple names.
>
>
> Ok, I get it. I was locally importing a pointer to an integer
Really? What language were you using? Python doesn't have pointers.
> Again, those aren't copies. There is only one instance of each value,
> referenced by multiple names.
Ok, I get it. I was locally importing a pointer to an integer which is really
the same object as the module name points to, but the assignment changes that.
The confusion for me centered aro
Tobiah <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > Tobiah <[EMAIL PROTECTED]> writes:
> >
> >> This is a little surprising. So "from mod import *" really copies
> >> all of the scalars into new variables in the local namespace.
> >
> > No. Nothing is copied. All the objects (remembering th
Ben Finney wrote:
> Tobiah <[EMAIL PROTECTED]> writes:
>
>> This is a little surprising. So "from mod import *" really copies
>> all of the scalars into new variables in the local namespace.
>
> No. Nothing is copied. All the objects (remembering that in Python,
> *everything* is an object) creat
"Ben Finney" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Tobiah <[EMAIL PROTECTED]> writes:
|
| > This is a little surprising. So "from mod import *" really copies
| > all of the scalars into new variables in the local namespace.
'Scalar' is not a Python term. Neither is 'obje
Tobiah <[EMAIL PROTECTED]> writes:
> This is a little surprising. So "from mod import *" really copies
> all of the scalars into new variables in the local namespace.
No. Nothing is copied. All the objects (remembering that in Python,
*everything* is an object) created by the code in module 'mod'
Duncan Booth wrote:
> iu2 <[EMAIL PROTECTED]> wrote:
>
>> file a3.py:
>>
>> from a1 import the_number
>> import a2
>>
> ...
>> Why doesn't it work in the first version of a3.py?
>>
> Think of 'import a2' as being the same as:
>
> a2 = __import__('a2')
>
> and 'from a1 import the_number'
iu2 <[EMAIL PROTECTED]> wrote:
> file a3.py:
>
> from a1 import the_number
> import a2
>
...
>
> Why doesn't it work in the first version of a3.py?
>
Think of 'import a2' as being the same as:
a2 = __import__('a2')
and 'from a1 import the_number' as roughly the same as:
the_number =
On Jan 14, 4:22 pm, iu2 <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I've got three files:
>
> file a1.py:
>
> the_number = None
>
> file a2.py:
>
> import a1
>
> def init():
> a1.the_number = 100
>
> file a3.py:
>
> from a1 import the_number
> import a2
>
> a2.init()
> pr
Hi all
I've got three files:
file a1.py:
the_number = None
file a2.py:
import a1
def init():
a1.the_number = 100
file a3.py:
from a1 import the_number
import a2
a2.init()
print the_number, type(the_number)
Runninr a3.py I get:
None
Changing a3.py to:
import a
11 matches
Mail list logo