Comments (1)
Hi Kirill!
I'll start with (2), as you are absolutely right. While @typing.overload
should work as I describe normally, it doesn't play well with other decorators. That was a major oversight on my part. Thankfully, my publisher is reprinting the book, so we'll get that fixed.
As to (1), you're definitely correct that if 1 in formula.keys():
fails. That should have checked for H
instead. Not sure how I overlooked that obvious detail.
As to the concern about the possible brittleness of using __hash__()
like this, I'm not terribly concerned. I did write the classes to depend on that implementation detail, so the element symbol (guaranteed unique for all real elements entered correctly) is used as the unique identifier. You're correct that it tightly couples Element and Compound, but that's one of those acceptable little compromises to make a sane example. In fact, this is one of my least favorite examples in the book...it took me three weeks to develop, and I was fairly going out of my mind by time I finished it. On the upside, it shows how hashes are used, and that makes the compromise a bit valuable in itself.
Thanks for your comments!
from deadsimplepython.
Related Issues (5)
- Walrus operator and parenthesis HOT 3
- Misc feedback HOT 2
- Listing 3-36 problem HOT 5
- Possible Listing 12-36 / 12-38 Issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deadsimplepython.