On 25May2021 06:08, hw <h...@adminart.net> wrote: >On 5/25/21 12:37 AM, Greg Ewing wrote: >>If you rebind a name, and it held the last reference to an >>object, there is no way to get that object back. > >Are all names references?
Yes. >When I pass a name as a parameter to a function, does the object the >name is referring to, when altered by the function, still appear >altered after the function has returned? I wouldn't expect that ... Yes. Please ready the language specification. This is basic to Python's function. >>On the other hand, if you shadow a name, the original name >>still exists, and there is usually some way to get at it, >>e.g. >> >> >>> int = 42 >> >>> int >>42 >> >>> __builtins__.int >><class 'int'> >> >>> >> > >You mean built-in objects never go away, even when they are no longer >referenced? Well, the builtins module itself has a reference. But what greg's showing you above it the "int" class/type. You've got an in in play in the code above - the class will of course exist. But the builtin classes (and other names) always exist because they're built in. Cheers, Cameron Simpson <c...@cskk.id.au> -- https://mail.python.org/mailman/listinfo/python-list