Hello I'm looking for a Larry Bates that was in the Navy. Could this be
you?? In CT in 1965??? In your 60's??
Please let me know I have been searching for over 10 yrs thanks
--
http://mail.python.org/mailman/listinfo/python-list
Shane Hathaway wrote:
> The bug is that the expression "dir(someclass)", where the class is a
> user-defined class of either new or old style, never reveals to the user
> that the class object has a __name__ attribute.
I guess maybe it is a bug. This seems to be the relevant code to prove it:
John Salerno wrote:
> Shane Hathaway wrote:
>
>> Don't forget to file a bug.
>
> I'm reluctant to call it a bug just yet. Here's more stuff below.
> There's obviously a difference between old- and new-style classes. It
> seems that as far as new-style is concerned, __name__ is an attribute of
Kirk Strauser wrote:
> Larry Bates wrote:
>
>> print print b.__class__.__name__ gives what you want
>
> That doesn't seem to do it, though. Here's the result of importing a module
> from my company's internally-developed library:
>
from Daycos.TableCopier.copyfro import StateProcessor
>>>
Larry Bates wrote:
> Kirk Strauser wrote:
>> Given a class:
>>
> class foo(object):
> pass
>> how can I find its name, such as:
>>
> b = foo
> print something(b)
>> 'foo'
>>
>> I'm writing a trace() decorator for the sake of practice, and am trying to
>> print the name of the cl
Dennis Lee Bieber wrote:
> On Tue, 01 Aug 2006 11:09:57 -0500, Kirk Strauser <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> Actually, I meant 'b = foo' in this case - I want to find the name of the
>> class that b references, but the name of an instance (which may have zer
Kirk Strauser wrote:
> Bruno Desthuilliers wrote:
>
>> Kirk Strauser wrote:
>
>> class foo(object):
>> pass
>>> how can I find its name, such as:
>>>
>> b = foo
>
>> I suppose you mean b = foo() ?
>
> Actually, I meant 'b = foo' in this case - I want to find the name of the
> cl
Tim Chase a écrit :
> class Foo(object):
>>
>> ... pass
>> ...
>>
> b = Foo
> b.__name__
>>
>> 'Foo'
>
>
> While this is surely true, would somebody explain why I had such trouble
> finding this?
Mmm... Documentation needs update ?
> help(dir)
> > Help on built-in functi
Dennis Lee Bieber wrote:
> On Tue, 01 Aug 2006 10:56:52 -0500, Kirk Strauser <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> Larry Bates wrote:
>>
>>> print print b.__class__.__name__ gives what you want
>> That doesn't seem to do it, though. Here's the result of importin
Kirk Strauser wrote:
[snip]
> OK, now for the good stuff. In the code below, how can I find the name of
> the class that 'bar' belongs to:
>
> >>> class Foo(object):
> ... def bar(self):
> ... pass
> ...
> >>> b = Foo.bar
>>> print b.im_class.__name__
Foo
But if you are writing
Shane Hathaway wrote:
> Don't forget to file a bug.
I'm reluctant to call it a bug just yet. Here's more stuff below.
There's obviously a difference between old- and new-style classes. It
seems that as far as new-style is concerned, __name__ is an attribute of
__class__ (along with a bunch of
Bruno Desthuilliers wrote:
> Kirk Strauser wrote:
> class foo(object):
> pass
>>
>> how can I find its name, such as:
>>
> b = foo
> I suppose you mean b = foo() ?
Actually, I meant 'b = foo' in this case - I want to find the name of the
class that b references, but the name o
John Salerno wrote:
> >>> class Foo(object):
> pass
>
> >>> dir(Foo)
> ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
> '__hash__', '__init__', '__module__', '__new__', '__reduce__',
> '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__']
>
> Hmm
>> While this is surely true, would somebody explain why I had such trouble
>> finding this?
>
> I think __name__ is an attribute of the class itself, not the instance:
That makes sense, but what doesn't make sense is why, when you do
a dir(Foo), you don't get '__name__' in the returned list of
John Salerno wrote:
> Tim Chase wrote:
>
>> While this is surely true, would somebody explain why I had such
>> trouble finding this?
>
> I think __name__ is an attribute of the class itself, not the instance:
On the other hand:
>>> class Foo(object):
pass
>>> dir(Foo)
['__class__',
Larry Bates wrote:
> print print b.__class__.__name__ gives what you want
That doesn't seem to do it, though. Here's the result of importing a module
from my company's internally-developed library:
>>> from Daycos.TableCopier.copyfro import StateProcessor
>>> print StateProcessor.__class__.__n
Tim Chase wrote:
> While this is surely true, would somebody explain why I had such trouble
> finding this?
I think __name__ is an attribute of the class itself, not the instance:
>>> class Foo(object):
pass
>>> f = Foo()
>>> f.__name__
Traceback (most recent call last):
File ""
class Foo(object):
> ... pass
> ...
b = Foo
b.__name__
> 'Foo'
While this is surely true, would somebody explain why I had such
trouble finding this?
help(dir)
> Help on built-in function dir in module __builtin__:
continuing from your example...
>>> dir(b)
['__class
Kirk Strauser wrote:
> Given a class:
>
class foo(object):
pass
>
> how can I find its name, such as:
>
b = foo
print something(b)
> 'foo'
>
> I'm writing a trace() decorator for the sake of practice, and am trying to
> print the name of the class that a traced method be
Kirk Strauser wrote:
> Given a class:
>
class foo(object):
pass
>
> how can I find its name, such as:
>
b = foo
I suppose you mean b = foo() ?
print something(b)
> 'foo'
The name of a class is in the attribute '__name__' of the class. The
class of an object is in the a
Given a class:
>>> class foo(object):
>>> pass
how can I find its name, such as:
>>> b = foo
>>> print something(b)
'foo'
I'm writing a trace() decorator for the sake of practice, and am trying to
print the name of the class that a traced method belongs to. This seems
like it should be eas
21 matches
Mail list logo