Re: Question about properties

2008-07-17 Thread Fredrik Lundh
Frank Millman wrote: > I thought that the main point of using property was to prevent direct > access to the attribute. Not "prevent access to" as much as "add behaviour to". Is this a valid comment, or does it come under the category of 'we are all adults here'? The latter. And the "__" do

Question about properties

2008-07-17 Thread Frank Millman
Hi all I have started experimenting with properties. The example in the 2.5 docs uses an inconsistent mixture of single and double underscores for the internal representation of the attribute. I was going to file a documentation bug, but then I checked the 2.6 docs online, and I see it has been f

Re: Question about properties.

2007-08-10 Thread Gerardo Herzig
king kikapu wrote: >On Aug 10, 1:33 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > >>On Fri, 10 Aug 2007 03:21:29 -0700, king kikapu wrote: >> >> >>>Hi, >>> >>> >>>i read in a book the following code snippet that is dealing with >>>properties: >>> >>> >>>class Protec

Re: Question about properties.

2007-08-10 Thread Dustan
On Aug 10, 5:31 am, [EMAIL PROTECTED] wrote: > On Aug 10, 12:21 pm, king kikapu <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > i read in a book the following code snippet that is dealing with > > properties: > > > class ProtectAndHideX(object): > > def __init__(self, x): > > assert isin

Re: Question about properties.

2007-08-10 Thread Antti Rasinen
> Hi, > > i read in a book the following code snippet that is dealing with > properties: > > class ProtectAndHideX(object): > def __init__(self, x): > assert isinstance(x, int), '"x" must be an integer!"' > self.__x = ~x > > def get_x(self): > return ~self.__x > >

Re: Question about properties.

2007-08-10 Thread Steve Holden
king kikapu wrote: > On Aug 10, 1:33 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Fri, 10 Aug 2007 03:21:29 -0700, king kikapu wrote: >>> Hi, >>> i read in a book the following code snippet that is dealing with >>> properties: >>> class ProtectAndHideX(object): >>> def __init__

Re: Question about properties.

2007-08-10 Thread king kikapu
Maybe is just a writers' "play" and nothing else. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about properties.

2007-08-10 Thread king kikapu
On Aug 10, 1:33 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 10 Aug 2007 03:21:29 -0700, king kikapu wrote: > > Hi, > > > i read in a book the following code snippet that is dealing with > > properties: > > > class ProtectAndHideX(object): > > def __init__(self, x): > >

Re: Question about properties.

2007-08-10 Thread Marc 'BlackJack' Rintsch
On Fri, 10 Aug 2007 03:21:29 -0700, king kikapu wrote: > Hi, > > i read in a book the following code snippet that is dealing with > properties: > > class ProtectAndHideX(object): > def __init__(self, x): > assert isinstance(x, int), '"x" must be an integer!"' > self.__x = ~x

Re: Question about properties.

2007-08-10 Thread dijkstra . arjen
On Aug 10, 12:21 pm, king kikapu <[EMAIL PROTECTED]> wrote: > Hi, > > i read in a book the following code snippet that is dealing with > properties: > > class ProtectAndHideX(object): > def __init__(self, x): > assert isinstance(x, int), '"x" must be an integer!"' > self.__x = ~

Question about properties.

2007-08-10 Thread king kikapu
Hi, i read in a book the following code snippet that is dealing with properties: class ProtectAndHideX(object): def __init__(self, x): assert isinstance(x, int), '"x" must be an integer!"' self.__x = ~x def get_x(self): return ~self.__x x = property(get_x)