dabeaz-course / python-mastery Goto Github PK
View Code? Open in Web Editor NEWAdvanced Python Mastery (course by @dabeaz)
License: Creative Commons Attribution Share Alike 4.0 International
Advanced Python Mastery (course by @dabeaz)
License: Creative Commons Attribution Share Alike 4.0 International
From Exercise 7.1 (b):
Note: This part doesn't involve a lot of code, but there are a lot of low-level fiddly bits. The solution will look almost the same as for Exercise 6.6.
There is no Exercise 6.6. The previous exercise was 6.5, not 6.6.
Hi David, first of all thanks for providing this course, it’s been great so far (currently chapter 6).
I just wanted to share some comments/questions that came up while looking at the slides:
In the slide 3-77 there is an extra handler
in formatter = TextTableFormatter(handler)
The MRO of 4-21 doesn't match the hierarchy previously defined
(__main__.E, __main__.C, __main__.A, __main__.D, __main__.B, object)
(__main__.D, __main__.B, object)
In 5-14 the following is mentioned:
Important: there are no type signatures or other details to help people reading your code. If you can help clarify, that's usually good.
Type hints although not enforced by python exist so it can help (they’re even mentioned on the next slide), so imo the sentence may be confusing
The doc says locale.getencoding()
is used as the default. On Windows, it's the ANSI codepage.
When running structure.py from excercise 7_6 I am getting an error:
line 69, in <listcomp>
cls._fields = tuple([v.name for v in validators])
AttributeError: 'String' object has no attribute 'name'
This is a not modified file, straight from repository, so I am not sure why this happens?
Use discussions to:
I'm not always available to answer detailed course questions, but perhaps discussions can be used as an ongoing knowledge base for the course.
Cheers,
Dave
The memory should drop quite a bit.
in Exercises/ex2_6.md
seems like a non sequitur, because there was no previous tracemalloc.get_traced_memory()
call in the same exercise.
WHERE CAN I GET JAVASCRIPT LIKE THIS PLEASE?
In the example for context manager.
Shouldn't the following:
if type:
print('An exception occurred')
be instead
if ty:
print('An exception occurred')
Thank you very very much for this material. It's amazing! I'm super grateful for it.
I think I spotted a small error in the code on slide 2-44:
-for n in squares:
+for n in squares([1, 2, 3, 4, 5]):
I think the squares should be called to be effective.
Thank you again for sharing your knowledge.
In slide I.II it is mentioned:
There are no block comments in Python (e.g., /* ... */).
While triple quotes are technically strings not comments, they could serve the same purpose as block comments? do you think this is worth mentioning?
Thank you
On page 98 (2-27):
>>> allrices['HPE']
34.23
>>> allprices['F']
51.1
>>>
Should be >>> allprices['HPE']
In PythonMastery.pdf page 2-6, the sentence An unordered set of values indexed by "keys"
should be changed, because dictionaries are ordered since Python 3.6
Even if you don't include an implementation, you should include the correct results for the exercise prompt.
How many bus routes exist in Chicago?
'Number of unique routes:'
181
How many people rode the number 22 bus on February 2, 2011? What about any route on any date of your choosing?
'Number of route 22 riders on 02/02/2011:'
[Row(route='22', date='02/02/2011', daytype='W', rides=5055)]
What is the total number of rides taken on each bus route?
'Most popular routes:'
[('79', 133796763), ('9', 117923787), ('49', 95915008)]
What five bus routes had the greatest ten-year increase in ridership from 2001 to 2011?
'Route with most increase in passengers between 2001 and 2011:'
[('15', 2732209),
('147', 2107910),
('66', 1612958),
('12', 1612067),
('14', 1351308)]
The Discussion at the end of Exercise 7.2 says the following:
Writing robust decorators is often a lot harder than it looks. Recommended reading:
However, there's no recommendation. Perhaps it was omitted accidentally?
The slide entitled "Function Error Checking" appears twice, once as slide 5-41 and then again as slide 5-42.
The slide states:
Variable names follow same rules as C
[A-Za-z_][A-Za-z0-9_]*
However, since Python 3.0 variable names can also contain non-non-ASCII letters (such as accented characters, Cyrillic, Greek, Kanji, etc.).
https://docs.python.org/3/reference/lexical_analysis.html#identifiers
Thanks for the helpful course.
Small issue I ran into in exercise 2_5 in:
import collections
class RideData(collections.Sequence):
Gave me an attribute error running python 3.11 on a windows machine.
This is due to:
`DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated
since Python 3.3, and in 3.10 it will stop working`
This issue provides more detail.
adding
'import collections.abc'
and
'class RideData(collections.abc.Sequence)'
Solves this
The relative path is written as ../../Data/portfolio.dat
, but unfortunately this results in a FileNotFoundError: [Errno 2] No such file or directory: '../../Data/portfolio.dat'
. In my solution I had to use the pathlib
library to construct a path as such:
root_dir = Path(__file__).resolve().parent.parent.parent
relative_dir = 'Data/portfolio.dat'
filename = root_dir / relative_dir
f = open(filename, 'r')```
I suggest adding the topics tutorial
, python-tutorial
in the About section. Thanks for your project.
Your challenge is to modify the RideData class, however to show the expected result you use readrides.read_rides_as_columns() as an example and this method does not currently return a RideData object...
Should this method also be modified to return a RideData object? Otherwise modifying RideData will have no affect on the output of readrides.read_rides_as_columns() ?
python-mastery/Exercises/ex2_5.md
Lines 295 to 302 in afec76d
Shouldn't the following line:
threading.Thread(target=func, args=(2, 3, fut).start()
be instead
threading.Thread(target=func, args=(2, 3, fut)).start()
Thank you so much for this! Its great! Would be awesome if we can have one for C++ too :)
minegrub/assets/splashes.txt
Originally posted by @Patish11 in Lxtharia/minegrub-theme#21 (comment)
Instead of
for r in rows:
it should be
for r in range(rows):
In the last challenge of this exercise, we are asked to eliminate the need for providing names to typedproperty
. I can't get this to work with the closure template provided. Can I get some more hints or just the solution, as I have been banging my head against this problem for a couple of hours now? I realize that __set_name__
is called under the hood when assigning properties to the class, and this was pretty clear in the valiidate.py exercise. I'm unsure how this works when extending the class with these typedproperty
methods. Thanks for the help.
The handler is the same object isn't it?
Should the sentence:
Notice how various steps of the algorithm are deferred to a separate handler object
Be phrased:
Notice how various steps of the algorithm are deferred to a separate (method|function) of the handler object
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.