![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jun 2005
Posts: 12
Rep Power: 0
![]() |
references passed through parameters, do they copy the object or reference the orig?
i was wondering, if i have a constructor for an object such as
def __init__(self, ObjectB) when i pass ObjectB to the new object instance, is it copied or referenced. because what i want is for this new object to have direct access to ObjectB. am i accomplishing this? cuz it seems not. its sort of wierd. thanks. |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
It depends what type ObjectB is. Is it a string, integer, floating point number, or boolean? If so, it will get copied, and not referenced. Else it should be referenced.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|