Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue of example1.py of chapter 8 #12

Open
zangetsudo opened this issue Jan 12, 2017 · 1 comment
Open

issue of example1.py of chapter 8 #12

zangetsudo opened this issue Jan 12, 2017 · 1 comment

Comments

@zangetsudo
Copy link

hi, David

i have just tested
python-cookbook/src/8/lazily_computed_attributes/example1.py
but happened to findout it does not workout like what the book tell, which i meam python cookbook, 3rd.
After a little research, i found that you need to put a object there, like this :
class lazyproperty(object):
but i dont konw why.
please tell me if you know.

PS:

TEST based on

PyCharm 2016.3.1
Build #PY-163.9735.8, built on December 15, 2016
Subscription is active until February 25, 2017
JRE: 1.8.0_111-b14 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation

Python
2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32

@dabeaz
Copy link
Owner

dabeaz commented Jan 12, 2017

The cookbook is written for Python 3. If using Python 2, you'll need to use new-style classes (i.e., inherit from object as you've noted).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants