Setter Propertys' mro?

2008-09-06 Thread cipher
Whats the mro (method resolution order) of a setter property (__set__
on a descriptor).
i seem to be experiencing some weird issue with them.
for example

>>> class test:
...  def _test(self):
...   return 4
...  def _stest(self):pass # dont change value
...  def _dtest(self,value):pass
...  p=property(_test,_stest,_dtest)
>>> t=test()
>>> t.p
4
>>> t.p=5
>>> t.p
5

Why is that being 'overridden' ( by that i mean that it is storing
that value in t's __dict__)

>>> t.__dict__
{'t': 5}

why DIDNT the setter get hit?
however, if i specify the metaclass in the class definition it works
just fine...

class test:
 __metaclass__=type
 def _test(self):
  return 4
 def _stest(self,value):pass # dont change value
 def _dtest(self):pass
 p=property(_test,_stest,_dtest)
>>> t=test()
>>> t.p
4
>>> t.p=5
>>> t.p
4

why do i have to set the __metaclass__ ? this seems like a bug?
i know that i probably shouldn't worry about this because if a
programmer does want to set my value and it causes an error, thats his
problem but this bothers me. whats the point of the __set__ method
then?


Thanks in advanced.

--
Cipher
--
http://mail.python.org/mailman/listinfo/python-list


Re: found a bug with smtpd, where can i report this?

2008-09-06 Thread cipher
On Sep 5, 4:01 am, "Marcus.CM" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Where should i report the bug?
> smtpd bug.
>
> Marcus.CM

http://bugs.python.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Setter Propertys' mro?

2008-09-06 Thread cipher
On Sep 6, 9:10 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sat, 06 Sep 2008 18:15:33 -0700, cipher wrote:
> > Whats the mro (method resolution order) of a setter property (__set__ on
> > a descriptor).
> > i seem to be experiencing some weird issue with them. for example
>
> >>>> class test:
>
> Unless you're using Python 3, there's your problem right there. In Python
> 2.x, properties only work correctly for new style classes, not classic
> classes. Change the above line to:
>
> class Test(object):  # by convention, classes start with Uppercase.
>
> and all should work (or at least you'll discover new and exciting
> different problems with your code).
>
> > however, if i specify the metaclass in the class definition it works
> > just fine...
>
> > class test:
> >  __metaclass__=type
>
> which is more or less the same as inheriting from object, except uglier.
>
> --
> Steven

Thanks to both of you!! that solved it.
i wonder why the getters would work fine though??
neways, wtf do i care :)


again, thank you both.

__
Cipher

--
http://mail.python.org/mailman/listinfo/python-list