Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20523 > unrolled thread

Re: list of properties

Started byEmile van Sebille <emile@fenx.com>
First post2012-02-16 10:02 -0800
Last post2012-02-16 10:02 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: list of properties Emile van Sebille <emile@fenx.com> - 2012-02-16 10:02 -0800

#20523 — Re: list of properties

FromEmile van Sebille <emile@fenx.com>
Date2012-02-16 10:02 -0800
SubjectRe: list of properties
Message-ID<mailman.5895.1329415247.27778.python-list@python.org>
On 2/16/2012 9:19 AM Emmanuel Mayssat said...
> Hello,
>
> Is there a way to list 'properties' ?

dir(thingy)

>
>
> from PyQt4.QtCore import *
>
> class LObject(QObject):
>      def __init__(self, parent=None):
>          super(LObject, self).__init__(parent)
>          self.arg1 = 'toto'
>
>      def getArg2(self):
>          return self.arg1 + " <--"
>      arg2 = property(getArg2)
>
> l = LObject()
> print l.__dict__
>
> returns only arg1

arg2 is defined at the class level and not the instance level. 
l.__dict__ returned the instance attributes. Look in LObject.__dict__ 
for arg2.

Emile


>
>
> How can I find that arg2 is a 'virtual' attribute (i.e. property)?
>
> Regards,
> --
> E
>
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web