A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/343234.html below:

defining classes

defining classes defining classesMichael Hoffman cam.ac.uk at mh391.invalid
Fri Sep 2 16:19:07 EDT 2005
LeRoy Lee wrote:

> class foo2:
>    def __init__(self):
>        self.j = 5
> 
>>> h = foo2()
>>> h.j
> 
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
> AttributeError: foo2 instance has no attribute 'j'

Try again:

 >>> class foo2:
...    def __init__(self):
...        self.j = 5
...
 >>> h = foo2()
 >>> h.j
5
-- 
Michael Hoffman

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4