[EMAIL PROTECTED] wrote:
> If you change it to this it works. You should provide a get and a set
> function for a property.
The OP did:
-> command=property(getCommand, setNothing)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PRO
Michael Schneider <[EMAIL PROTECTED]> wrote:
> Thanks to all, I added the object as a subclass (should this be
> required for 2.4.1 ???)
It _IS_ required, because Python these days moves *very slowly indeed*
before changing semantics of existing code in any way that is not
backwards compatible
Thanks to all, I added the object as a subclass (should this be
required for 2.4.1 ???)
I also switched to the decorator with the @property syntax
Thank you very much for the help for adding @property to the language.
what a great language :-)
Mike
Michael Schneider wrote:
> Hello All,
>
>
Thanks to all, I added the object as a subclass (should this be
required for 2.4.1 ???)
I also switched to the decorator with the @property syntax
Thank you very much for the help for adding @property to the language.
what a great language :-)
Mike
Michael Schneider wrote:
> Hello All,
>
>
Michael Schneider wrote:
> Could someone please point out my error, I have dents in my forehead
> for this one.
> --
>
> from unittest import TestCase
> import unittest
Here you need to add:
__metaclass__ = type
this will make you
Michael Schneider wrote:
> Rather then dispatching the property assignment to setNothing, the
> property object is being replaced with a string.
properties are for newstyle classes only (i. e. classes that inherit from
object).
from unittest import TestCase
import unittest
class Task(object):
I was thinking that in Python2.4, all class definitions inherited from
new-style classes. There may be a bug here. I can make your code work
as expected by changing the class definition to:
class Task(object):
with that change, the assignment raises an attribute error. You could
also accomplish
Michael Schneider wrote:
> The get property access is working, but the the set
> property is not working.
The classes need to be "new style" for properties to work right. Just
change "class Task:" to "class Task(object):".
Your "setNothing" method is unnecessary, if you don't proved a "setter"
If you change it to this it works. You should provide a get and a set
function for a property.
class Task:
def __init__(self, value):
self._command = value
def setCommand(self, value):
self._command = value
def getCommand(self):
return self._command
command=property(
If you change it to this it works. You should provide a get and a set
function for a property.
class Task:
def __init__(self, value):
self._command = value
def setCommand(self, value):
self._command = value
def getCommand(self):
return self._command
command=property(
Hello All,
I have been working on learning how to use python properties.
The get property access is working, but the the set
property is not working.
Rather then dispatching the property assignment to setNothing, the
property object is being replaced with a string.
I must be doing something ver
11 matches
Mail list logo