Comments (2)
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AM
D64)] on win32
from data_science_tool_book_code.
I think this issue could be closed now, as I found the reason why this happened. The final internal numbers of the variable depend on the types of the object numbers they are assigned,
- if the number which is assigned to variable is integer number, the result will be like the book showed - the variables will be assigned the same internal numbers as the integer number:
id(7)
93874755162328
usd_to_cny=7
id(usd_to_cny)
93874755162328
dollar_rate=7
id(dollar_rate)
93874755162328
dollar_rate=usd_to_cny=7
id(7)
93874755162328
id(dollar_rate)
93874755162328
id(usd_to_cny)
93874755162328
- if the number which is assigned to variable is fractional number, the result will NOT be like the book showed - the variables will be assigned the internal numbers as the fractional number, at the same time, the fractional number will get another internal number:
id(6.188)
93874755233432
usd_to_cny=6.188
id(6.188)
93874755233456
id(usd_to_cny)
93874755233432
dollar_rate=6.188
id(6.188)
93874755233480
id(dollar_rate)
93874755233456
dollar_rate=usd_to_cny=6.188
id(6.188)
93874755233432
id(dollar_rate)
93874755233480
id(usd_to_cny)
93874755233480
Another found while I doing the test is: I found all the fractional numbers are using the same internal numbers:
id(6.639)
93874755233456
id(6.63)
93874755233456
id(6.6)
93874755233456
id(6.0)
93874755233456
id(6)
93874755162352
id(5.5)
93874755233456
id(5.1)
from data_science_tool_book_code.
Related Issues (6)
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 data_science_tool_book_code.