On Wed, Sep 12, 2012 at 4:22 AM, pyjoshsys wrote:
> The output is still not what I want. Now runtime error free, however the
> output is not what I desire.
[SNIP]
> class Trial(object):
> '''class to demonstrate with'''
> def __init__(self):
> object.__init__(self)
> sel
so decorators only pass the object and not any instance of the object as the
implied argument? Is this right?
The idea was to use @setname instead of instance.SetName(instance.__name__).
I thought decorators would do this, but it seems not.
--
http://mail.python.org/mailman/listinfo/pyth
On Wed, 12 Sep 2012 03:22:31 -0700 (PDT), pyjoshsys
wrote:
The output is still not what I want. Now runtime error free,
however the output is not what I desire.
def setname(cls):
'''this is the proposed generator to call SetName on the
object'''
try:
cls.SetName(cls.__name
The output is still not what I want. Now runtime error free, however the output
is not what I desire.
def setname(cls):
'''this is the proposed generator to call SetName on the object'''
try:
cls.SetName(cls.__name__)
except Exception as e:
print e
finally:
Am 12.09.2012 04:28 schrieb j.m.dagenh...@gmail.com:
I'm trying to call SetName on an object to prevent me from ever having to call
it explictly again on that object. Best explained by example.
def setname(cls):
'''this is the proposed generator to call SetName on the object'''
try:
On Sep 12, 12:28 pm, j.m.dagenh...@gmail.com wrote:
> def setname(cls):
> '''this is the proposed generator to call SetName on the object'''
> try:
> cls.SetName(cls.__name__)
> finally:
> yield cls
A generator is (basically) a callable that acts like an iterator.
You'd
On Wednesday, 12 September 2012 07:58:10 UTC+5:30, pyjoshsys wrote:
> I'm trying to call SetName on an object to prevent me from ever having to
> call it explictly again on that object. Best explained by example.
>
[snip]
In your decorator, you are using `yield cls` - it should be `return cls` 99
I'm trying to call SetName on an object to prevent me from ever having to call
it explictly again on that object. Best explained by example.
def setname(cls):
'''this is the proposed generator to call SetName on the object'''
try:
cls.SetName(cls.__name__)
finally:
yi