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


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

Re: Using an object inside a class

Started byEthan Furman <ethan@stoneleaf.us>
First post2012-01-23 12:51 -0800
Last post2012-01-23 12:51 -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: Using an object inside a class Ethan Furman <ethan@stoneleaf.us> - 2012-01-23 12:51 -0800

#19285 — Re: Using an object inside a class

FromEthan Furman <ethan@stoneleaf.us>
Date2012-01-23 12:51 -0800
SubjectRe: Using an object inside a class
Message-ID<mailman.4982.1327351525.27778.python-list@python.org>
Gary Herron wrote:
> If the method does not bind it, then Python will look in the class for 
> foo.  This could work
> 
> class Class1:
>      foo = whatever # Available to all instances
>      def __init__(self):
>            foo.bar.object

              self.foo.bar.object

               ^- needs the self reference or will not work

~Ethan~

[toc] | [standalone]


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


csiph-web