What were you planning to do with this object exactly that didn't involve
binding it to any other names during its lifetime?
Nothing so silly as that.
The idea is not to prevent other references from binding to the object,
but to allow the object to ensure that a certain symbol always points
Michael Tobis wrote:
I got in some trouble in these parts a few months back for advocating
some sort of immutable reference, like
fred - C(fred)
where any reassignment of the refernce during the lifetime of the
referent would raise an exception. This seems to be seen as wrongheaded
by
Fredrik Lundh wrote:
objects don't have names in Python, and the source is not part of
the running program.
have you read this ?
http://effbot.org/zone/python-objects.htm
I have now. Thank you very much.
objects don't have names in Python: It appears from the code that
Michael
Don Taylor wrote:
Fredrik Lundh wrote:
objects don't have names in Python, and the source is not part of
the running program.
have you read this ?
http://effbot.org/zone/python-objects.htm
I have now. Thank you very much.
objects don't have names in Python: It appears from
Don Taylor wrote:
Fredrik Lundh wrote:
objects don't have names in Python, and the source is not part of
the running program.
have you read this ?
http://effbot.org/zone/python-objects.htm
I have now. Thank you very much.
objects don't have names in Python: It appears from the
Fredrik Lundh wrote:
Q. How can my code discover the name of an object?
A. The same way as you get the name of that cat you found on your
porch: the cat itself cannot tell you its name, and it doesn't really
care -- so the only way to find out what it's called is to ask all
Don Taylor a écrit :
(snip)
My overall intent is to try to build something that can record
interactions against an object so that they can be replayed later for
testing and debugging. I had in mind to generate the recording as a
sequence of Python statements.
You may want to have a look
This behavior seems to be commonly wanted by people discovering Python,
and it is the rare case of something one can imagine that is really a
stretch to achieve in Python. Because more or less than one name may
refer to an object, in general an object can't know its name.
You can get part of the
Is there a way to discover the original string form of the instance that
is represented by self in a method?
For example, if I have:
fred = C()
fred.meth(27)
then I would like meth to be able to print something like:
about to call meth(fred, 27) or
about to
Don Taylor wrote:
Is there a way to discover the original string form of the instance that
is represented by self in a method?
For example, if I have:
fred = C()
fred.meth(27)
then I would like meth to be able to print something like:
about to call meth(fred, 27)
Michael Spencer wrote:
In general, this requires exhaustive search of name bindings e.g.,:
def get_names_of(obj, ns):
... return [name for name, value in ns.iteritems() if value is obj]
...
class A(object):
... def global_names_bound_to_me(self):
... return
Don Taylor [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Is there a way to discover the original string form of the instance that
is represented by self in a method?
For example, if I have:
fred = C()
fred.meth(27)
then I would like meth to be able to print something like:
Don Taylor wrote:
Is there a way to discover the original string form of the instance that
is represented by self in a method?
For example, if I have:
fred = C()
fred.meth(27)
then I would like meth to be able to print something like:
about to call meth(fred, 27) or
Don Taylor wrote:
And if I call my method: A().qualify global_names_bound_to_me() then I
get an empty list back.
Is what I want to do not possible without referring back to the source?
objects don't have names in Python, and the source is not part of
the running program.
have you read this
14 matches
Mail list logo