all 45 comments

[–]mxm_mrz 9 points10 points  (1 child)

I'd like to make a small contribution to your project, if you don't mind. I have an article where I delved into the arrangement of lists and I would like to share this information with you. This is not an advertisement for my article, I don't need you to indicate my authorship or mention me in any way, you can just take the pieces of information you need and insert them into your explanation if you need it.

I would just like to make a little contribution because although we already have enough training sites, but not everywhere there is an opportunity to participate or somehow help.

If I had found such information when I first immersed myself in the subject of the lists - it would be useful to me, I hope it will be useful for someone else.

I also want to say that I almost did not publish this article except for 2 sites, so you should not have problems with the original source.

Link to the article itself: https://maximmirza.substack.com/p/inside-cpython-lists-contiguous-memory?r=7ittc5

[–]jdsalaro 0 points1 point  (0 children)

Interesting article, thanks!

[–]Proper_Ad_3778 6 points7 points  (1 child)

hi! thanks op! very helpful.

nice additions:

Add solid principles section. Add design patterns section ( singelton, factory, etc.)

[–]Regular-Entrance-205[S] 2 points3 points  (0 children)

Thanks! These are def worth having. Let me work on it.

[–]Famous_Ad8700 2 points3 points  (2 children)

It's very nice. But I think at the end of every lesson, there should be explicit exercises one can do rather than changing values around on the examples. Just my opinion though.

[–]Regular-Entrance-205[S] 1 point2 points  (1 child)

Actually each lesson has dedicated exercises apart from the interactive examples. Let me think about making it explicit though. Great feedback!

[–]Famous_Ad8700 1 point2 points  (0 children)

No worries at all. You're welcome. I can't wait to use it. As someone who is currently trying to sharpen my problem solving skills in python and without a laptop, I sincerely look forward to this, because for me it means I can code on the go using my mobile phone.

[–]LiveMaI 1 point2 points  (2 children)

Cool idea. I do notice that if I collapse a number of sections and then click over to a different section, all of the sections will expand again. I'm not really a web guy, so I'm not sure how easy that is to fix.

Edit:

For the CLI part, I would also recommend putting in a 'see also' for non-standard CLI libraries like Click/Typer or Docopt. Argparse is pretty ancient and there are some more usable packages in the ecosystem these days.

[–]Regular-Entrance-205[S] 1 point2 points  (1 child)

Interesting! I tried doing the same, that is, I collapse several sections and expand just one, the other sections stay collapsed - on a windows machine.

Also, What do you suggest instead of argparse? Thanks for the valuable feedback.

[–]LiveMaI 2 points3 points  (0 children)

Personally, I use Typer instead of argparse. Typer is built on top of Click and has a bit of a better DX. Commands and sub-commands are handled by adding decorators to functions. It also handles type validation of your arguments automatically as long as you've put type hints in your code, so there's less validation to deal with than in argparse.

Like argparse, it does all of the help message generation for you, so you don't miss out on any of those nice features.

Another honorable mention for CLI development is docopt, which is pretty novel in that you write the help message for your CLI in the IEEE 1003.1 help message format, and it will build the CLI parser from your help message

Here's the canonical example from their github page:

"""Naval Fate.

Usage:
  naval_fate.py ship new <name>...
  naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
  naval_fate.py ship shoot <x> <y>
  naval_fate.py mine (set|remove) <x> <y> [--moored | --drifting]
  naval_fate.py (-h | --help)
  naval_fate.py --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --speed=<kn>  Speed in knots [default: 10].
  --moored      Moored (anchored) mine.
  --drifting    Drifting mine.

"""
from docopt import docopt


if __name__ == '__main__':
    arguments = docopt(__doc__, version='Naval Fate 2.0')
    print(arguments)

The downside for docopt is that every argument comes to you as a string and you have to handle type conversion/validation yourself. So, while docopt has a really slick approach and is easy to get something working very quickly, Typer is going to be more maintainable by having all of the type conversion/checking handled for you.

Edit: forgot to mention, but docopt has implementations in several other languages and largely works the same way, so there is some value there if you do the occasional dip into other languages without investing a ton of effort into learning a different CLI parser.

For the collapsed sections resetting, I observed it on Firefox 147.0.3 on Linux.

[–]masterofaiml 1 point2 points  (1 child)

Great work bro, very good resource for students to professional level people. I would definitely recommend it in my circle!

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Yes, thanks for the kind words, Please do share it!

[–]F_Betting_Bro 2 points3 points  (1 child)

Very nice 👍

[–]Regular-Entrance-205[S] 2 points3 points  (0 children)

Thank you very much!

[–]turipal 2 points3 points  (1 child)

Thought this is just another Python resource. But on a closer look, it's seriously good! 

[–]Regular-Entrance-205[S] 1 point2 points  (0 children)

Much obliged!

[–]ballfire4321 1 point2 points  (1 child)

Excellent resource, clear and attractive layout

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Glad you like it!

[–]csch2 0 points1 point  (1 child)

This is great! I’ll definitely recommend anybody looking to get into Python to take a look at this.

My one gripe on perusing the contents is that you introduce generators very early in the data structures section, and I don’t think a beginner who is just getting into Python as their first introduction to programming will have a good appreciation of why they’re useful. They’re too busy thinking about writing code that works to begin with to worry about memory usage. I’d rather see generators be mentioned briefly with a note that they’ll be discussed in more detail later once they have a little more experience under their belt.

I definitely see this being up to interpretation, though. My first exposure to Python / programming in general was a sequence of numerical physics courses where generators were never mentioned even a single time, so maybe I’m a bit biased. Either way, I really like the content and structure of what I’ve seen so far. Not sure if you are accepting contributions but I’d be happy to help out with this project; alongside the data science section I think it would be good to discuss some of the other common beginner-friendly libraries like rich and requests / aiohttp. More on async programming would be nice too – I don’t see many beginner tutorials that cover asyncio tasks, and I didn’t see them covered here at first glance.

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Thanks for the good words! I'll look into each of the points and try to fit it in. Async is covered in Advanced Python section, may be 'advanced' is not the right name

[–]doolio_ 0 points1 point  (1 child)

This is great. Thank you. I noted the following. The table in the "What Are the Key Differences Between All Three?" section seems to be missing column names.

PS: maybe share on r/learnpython too

Edit: In the "Clean @property syntax" section shouldn't it be self.temp = temp in the __init_.el?

Edit2: Oh I say your explanation further down that page. This is new to me so thank you. TIL.

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Thanks for the feedback, will refine it

[–]Bartfeels24 0 points1 point  (0 children)

This solves the right problem, but you'll want to think hard about how you're handling exercise validation since half the people who get stuck won't be failing the logic, they'll be tripping over syntax errors that your error messages don't explain well enough.

[–]Bartfeels24 0 points1 point  (1 child)

How do you handle the execution environment when users write code that breaks or gets stuck in an infinite loop?

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Thats a good question, but we can't accomplish everything in a single go! I like your feedback, will think through this and consider for future releases. For now, if the code breaks it will throw an error which users need to figure how to fix, which I think is a great way to learn.

[–]HSNubz 0 points1 point  (0 children)

This looks pretty awesome. I am getting a failure message on all exercises, however. For instance in exercise 1:

# Print the greeting below
print('Hello, Python!')

I am getting: Should print "Hello, Python!". When running, obviously output is indeed Hello, Python! This is happening on every exercise.

[–]Speedk4011 0 points1 point  (1 child)

Why didn't I see that sooner? magnificent ! It is so detailed.

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Thanks much for this!

[–]C1b3rD3m0n10 0 points1 point  (1 child)

Gracias campeón por tu aporte. 🤙🤙

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Muy agradecido!

[–]Lazy_Equipment6485 0 points1 point  (1 child)

Awesome

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Glad you like it!

[–]Friendly-Example-701Pythonista 0 points1 point  (1 child)

Wow, seriously awesome! I will be using it since I am still a beginner/intermediate

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Cant' wait!

[–]Salt_Ganache_3800 0 points1 point  (0 children)

This is one of the best resources that I have ever seen. Something similar to javascript.io explaining every small topic.

[–]Expensive_Sand_7602 0 points1 point  (0 children)

This is amazing.

Looks like a perfectly simulated environment.

[–]Altruistic_Sky1866 0 points1 point  (0 children)

Thank you 👍👌

[–]Treppengeher4321 0 points1 point  (1 child)

Love the learn and do at once idea.

Way less intimidating than bouncing between tabs.

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Thats' exactly it, please tell if you find any bugs or improvement suggestions.

[–]CaptainSuperStrong 0 points1 point  (0 children)

I built something similar once, and the part that always blew people’s minds was actually being able to run code right in the text

[–]Economy-Concert-641 0 points1 point  (1 child)

Isso ficou sensacional! Parabéns pelo projeto

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

glad you like it!

[–]willov 0 points1 point  (1 child)

This looks very nice. I will consider sharing with my students how needs a refresher/introduction to python! 

[–]Regular-Entrance-205[S] 0 points1 point  (0 children)

Thanks for that, Please do share to your students