A Python Guide for the Ages
gto76.github.io
A Python Guide for the Ages
1–10 of 59 posts
Re: A Python Guide for the Ages
#2For those of you for whom this list is too terse, check out the excellent LearnXinYminutes site at https://learnxinyminutes.com/docs/python/
Re: A Python Guide for the Ages
#3Re: A Python Guide for the Ages
#4There are a couple of language features in Python that I thought were cool when I discovered them, but actually have never ever find a need for them in my code. The first is using an "else" clause in a "for" loop, and the second is returning a value from a generator. Curious whether anybody actually uses either of those.
I think the idea is cool (albeit rarely useful), but a different word than "else" for the same functionality would go a long way.
Re: A Python Guide for the Ages
#5Other cheatsheets (excluding learnxinyminutes already mentioned in another comment)
* Python Crash Course: https://ehmatthes.github.io/pcc_2e/cheat_sheets/cheat_sheets...
* Scientific Python: https://ipgp.github.io/scientific_python_cheat_sheet/
Re: A Python Guide for the Ages
#6https://perso.limsi.fr/pointal/_media/python:cours:mementopy...
Re: A Python Guide for the Ages
#7There are a couple of language features in Python that I thought were cool when I discovered them, but actually have never ever find a need for them in my code. The first is using an "else" clause in a "for" loop, and the second is returning a value from a generator. Curious whether anybody actually uses either of those.
I'd like a different name for for "for's" else.
I've been using method/function redefinition in place of conditionals related to initialization.
Re: A Python Guide for the Ages
#8There are a couple of language features in Python that I thought were cool when I discovered them, but actually have never ever find a need for them in my code. The first is using an "else" clause in a "for" loop, and the second is returning a value from a generator. Curious whether anybody actually uses either of those.
I've used both, for with else more often. It avoided some booleans and if's that would have been much less clear/easy to get wrong. I'd like a different name for for "for's" else. I've been using method/function redefinition in place of conditionals related to initialization.
Re: A Python Guide for the Ages
#9Earlier quoted context omitted.
I've used both, for with else more often. It avoided some booleans and if's that would have been much less clear/easy to get wrong. I'd like a different name for for "for's" else. I've been using method/function redefinition in place of conditionals related to initialization.
It’s consistent with try…else and if…else so I actually think it’s ok.
In a for loop, the else clause only runs if the loop successfully completes (isn't broken), so the else in for-else means the total opposite of what it means in every other pattern.
I think it would make a lot more sense if it were replaced with "done" or "upon" or something else that communicates how it works.
Re: A Python Guide for the Ages
#10There are a couple of language features in Python that I thought were cool when I discovered them, but actually have never ever find a need for them in my code. The first is using an "else" clause in a "for" loop, and the second is returning a value from a generator. Curious whether anybody actually uses either of those.