Python 3 angst 2016 edition
-
@cartman82 said in Python 3 angst 2016 edition:
Zed Shaw shoots back
I’ve been trying to get out of the technology industry since 2008
Coincidentally, this is when Python 3 came out. Coincidence? I THINK NOT!
-
Whatever you think of him, he does make a good point here:
Yet, here’s where everyone I know becomes deathly afraid of the coders. These groups of programmers used to have large sway over what was successful and chosen, but at the same time were horribly uninformed about basic computer science. They ran to Node.js because of “events are better than threads” and had no idea Hoare or coroutines existed. They manually went to hand convert all Python 2 code to Python 3 code, rather than just asking why the Python 3 VM can’t just…run Python 2 code too. Then they believe the mega load of bullshit that this is impossible despite all proofs and evidence stating otherwise. For all their claims of superiority for having once bought a copy of The Art of Computer Programming the previous generation of programmers are sadly uninformed about basic shit.
TL;DR version: people follow what's cool, not what works.
-
@RaceProUK
IIRC, the Python "VM" changes with each version of python, so it can only ever run one version. It's not a general-purpose VM like Java.Yes, it would've been better if I could have a python 3.4 script interacting with a python 2.7 script and maybe a python 2.3 script - this way we could switch to python 3 on a script basis, not on an environment basis.
However, while this is possible, let's face it - it really is a hell of a lot of work to design and maintain.
-
@CreatedToDislikeThis said in Python 3 angst 2016 edition:
However, while this is possible, let's face it - it really is a hell of a lot of work to design and maintain.
That is true. It's definitely doable, but I get the feeling the reason it isn't done is not 'because it's really hard', but 'because it isn't cool'.
-
@RaceProUK said in Python 3 angst 2016 edition:
does make a good point here:
people follow what's cool, not what works.That is true and a good point to raise if you discuss MondoDB, proliferation of JS frameworks, microservices or whatever is the latest fashion.
But it is not relevant in discussion of Python 3 vs 2. "New way of handling unicode" is hardly exciting.
If people took the time they use to complain about Python 3 and instead applied those small fixes to their code, the issue would be over long ago.An another note, I don't condemn following what's cool. I don't like many of the currently fashionable things, but seek technologies which are cool for me anyway.
It is enjoyable to build software in a way you find elegant, it gives a way to be proud of your work - and can be the motivation for the work in the first place.
-
@cartman82 said in Python 3 angst 2016 edition:
Not sure this is the correct approach, but I find myself way more engaged with his material than just passively reading coding theory.
I'm not his target audience. I don't need a for loop explained. I already know how to write for loops in languages A, B and C; I just need to know how to do it in D. Besides the condescending, code-monkey attitude, I find his presentation not well suited to extracting the information I need efficiently. I'm sure I'm missing learning some pythonisms, but I'm finding just googling for stuff and landing on (mostly) python.org or (occasionally) SO results in getting actual work done.
-
@Adynathos And isn't it basically the case that if it works correctly in Python 2.7, it ought to work in Python 3.x with maybe a few little adjustments that don't break backwards compatibility?
I just don't get what the fuss is about.
-
@gordonjcp said in Python 3 angst 2016 edition:
if it works correctly in Python 2.7, it ought to work in Python 3.x with maybe a few little adjustments that don't break backwards compatibility
There are breaking changes. It may be possible to write code that works in both; I'm not sure, because I started learning Python after 3 was already well established, so I saw no point in trying to learn 2.
AIUI, the biggest problem isn't the core language, it's library compatibility. Some libraries have been updated to use 3 features, and thus cannot be used with 2. Other libraries have not been updated for whatever reasons, and still use 2 syntax that no longer works in 3. Although the syntax changes are few and small, at least one of them affects pretty much every script and library ever written. If you are maintaining the library, it's a trivial fix, but if you depend on a library that isn't being maintained, or is maintained by a 3-hater, you're SOL.
-
@HardwareGeek Then fork the library and make the handful of changes you require.
People need to get out of this attitude of just slapping a few libraries together and calling it done.
-
@gordonjcp said in Python 3 angst 2016 edition:
@HardwareGeek Then fork the library and make the handful of changes you require.
People need to get out of this attitude of just slapping a few libraries together and calling it done.
But this is how all modern software is built! Anything else is
-
@HardwareGeek for some reason every python tutorial presumes you are learning how to code. It's frustrating
-
Isn't Zed Shaw the person who ragequit the Ruby on Rails community because said community didn't kowtow to him?
-
@RaceProUK said in Python 3 angst 2016 edition:
Whatever you think of him, he does make a good point here:
Yet, here’s where everyone I know becomes deathly afraid of the coders. These groups of programmers used to have large sway over what was successful and chosen, but at the same time were horribly uninformed about basic computer science. They ran to Node.js because of “events are better than threads” and had no idea Hoare or coroutines existed. They manually went to hand convert all Python 2 code to Python 3 code, rather than just asking why the Python 3 VM can’t just…run Python 2 code too. Then they believe the mega load of bullshit that this is impossible despite all proofs and evidence stating otherwise. For all their claims of superiority for having once bought a copy of The Art of Computer Programming the previous generation of programmers are sadly uninformed about basic shit.
TL;DR version: people follow what's cool, not what works.
I recently watched an interesting talk on that by one of those previous generation programmers (Robert Martin):
https://www.youtube.com/watch?v=ecIWPzGEbFcWhich was somewhat related to the previous video I'd watched (by Zed Shaw) (Note: lots of empty air time at the beginning. Skip to 8:25):
https://www.youtube.com/watch?v=c5Xh2Go-jkMAnd now this.
I haven't quite finished contemplating the relationships between these things (post and videos both), but there seems to be something interesting there.
-
@RaceProUK said in Python 3 angst 2016 edition:
@CreatedToDislikeThis said in Python 3 angst 2016 edition:
However, while this is possible, let's face it - it really is a hell of a lot of work to design and maintain.
That is true. It's definitely doable, but I get the feeling the reason it isn't done is not 'because it's really hard', but 'because it isn't cool'.
evee tackles this point in his rebuttal to the Zed's OP. Hint: it's not that.
-
@Helix said in Python 3 angst 2016 edition:
Isn't this the issue with nearly all open source languages. Maintaining an environment of open source software is is like trying to fit together a box of broken glass shards back into a window pane.
Blakey, is that you? Why are you posting from @Helix's account?
Filed Under: Someone had to make that joke.
-
@ScholRLEA couldn't possibly be Blakey, insufficient 'open sores' and WHARRRRRRRRRRRRGLE
-
@dkf said in Python 3 angst 2016 edition:
@Gurth said in Python 3 angst 2016 edition:
No idea how they handle different versions of libraries, though
Badly.
-
@anonymous234 said in Python 3 angst 2016 edition:
Let me skip down the article a bit...
To be fair, very few things you can run on a finitely-large physical computer are Turing complete by the strictest definition.
-
@ben_lubar said in Python 3 angst 2016 edition:
@anonymous234 said in Python 3 angst 2016 edition:
Let me skip down the article a bit...
To be fair, very few things you can run on a finitely-large physical computer are Turing complete by the strictest definition.
Technically, as long as you add capacity at least as fast as it consumes it, you can be Turing complete and still finite. Which is sort of the basis for the SCOTUS deciding that ever-lengthening copyright on Mickey Mouse is okay as long as it always has a finite (if mutable) limit.
-
@ben_lubar said in Python 3 angst 2016 edition:
To be fair, very few things you can run on a finitely-large physical computer are Turing complete by the strictest definition.
That's not much of a problem, as the program can just pause and wait for you to insert another storage device. (Also, you don't want infinite storage as it will take forever to write that much, one byte at a time…)
In reality, turing complete just means “got storage,
while
loops and a few other basic operations”.
-
@Dreikin said in Python 3 angst 2016 edition:
@ben_lubar said in Python 3 angst 2016 edition:
@anonymous234 said in Python 3 angst 2016 edition:
Let me skip down the article a bit...
To be fair, very few things you can run on a finitely-large physical computer are Turing complete by the strictest definition.
Technically, as long as you add capacity at least as fast as it consumes it, you can be Turing complete and still finite. Which is sort of the basis for the SCOTUS deciding that ever-lengthening copyright on Mickey Mouse is okay as long as it always has a finite (if mutable) limit.
Reminds me of a conversation I once had at the local government office...
Hi, I'd like to suspend my business license.
Sure, how long would you like to suspend it for?
Permanently.
I'm sorry, that's not possible.
Really? I read somewhere that it was.
No, sorry, it can only be suspended until a given date.
OK... So if I say that date is 1 January 2100?
Not a problem!
-
@ben_lubar Python as a language is (most likely) Turing-complete since it does not specify any limits on how many elements an array can have or how large a number can be. Those are just a function of the physical implementation.
Filed under: pedantry escalation
-
I really do not understand why people dislike python3 at all - the language has some massive advantages.
For example, the "all things are unicode" change does not sound like much, but it has reduced our locale related bugs massively - in python2 it was exceedingly difficult to not accidentally do something like "Cannot process the string: " + u"Gütiger Himmel" - which would end in a funny unicodedecodeerror. Especially third party libs like matplotlib where extremely annoying in such circumstances.
-
Most of the complaints I have seen really boil down to either "I don't like having to put parentheses around print strings" and "I hate when things change even if the change is an improvement". I have not read this particular screed yet, but my guess is that it is mostly those two complaints repeated over and over again.
-
@ScholRLEA said in Python 3 angst 2016 edition:
I have not read this particular screed yet, but my guess is that it is mostly those two complaints repeated over and over again.
To save your time, it is this one:
"I hate when things change even if the change is an improvement"
-
@HdS said in Python 3 angst 2016 edition:
I really do not understand why people dislike python3 at all
If it makes you feel happier, I also dislike python2… ;)
-
@ScholRLEA This one is also "I don't understand how strings or Unicode work at all".
-
@Jarry said in Python 3 angst 2016 edition:
@HardwareGeek for some reason every python tutorial presumes you are learning how to code. It's frustrating
My experience is that this is the case for almost every tutorial in any "standard" language (I.e. not languages that are explicitly built on top of another, or for a very specific purpose). I had the same issue recently when searching for some C++ tutorial for someone that already knows programming, just not this one.
-
@Jarry said in Python 3 angst 2016 edition:
@HardwareGeek for some reason every python tutorial presumes you are learning how to code. It's frustrating
I hate tutorials because they either assume I know stuff I don't, or spend way too long explaining stuff I already do.
That's why they need to be designed so you can just skip the parts you don't care about.
-
I don't use Python 3 because I like the old print command.
-
I think most of Python is okay. I don't have a preference between 2 and 3.
My biggest issue with Python is that it takes something that should be simply a non-functional style decision and gives semantic meaning to it. Whitespace code blocks is, IMO, the dumbest thing the language has. And the fact that it simply counts the characters means anyone trying to read code that uses a mix of spaces and tabs has a lot more work to do.
-
@djls45 said in Python 3 angst 2016 edition:
I think most of Python is okay. I don't have a preference between 2 and 3.
My biggest issue with Python is that it takes something that should be simply a non-functional style decision and gives semantic meaning to it. Whitespace code blocks is, IMO, the dumbest thing the language has. And the fact that it simply counts the characters means anyone trying to read code that uses a mix of spaces and tabs has a lot more work to do.
I like indentation-based blocking, but I agree that allowing freely mixed indents types is a problem. Pick tabs or spaces, disallow other whitespace at the beginning of a line for indentation, and stick with it. My personal thinking is that indentation-based blocking should use tabs alone for indentation, and only allow spaces after all the necessary tabs at the beginning of a line, and only for certain allowed types of alignment (e.g., line continuations such as lining up multi-line function parameters). And maybe if you really want to do something different, braces might be opted-in for.
Tabs for indentation, spaces for alignment is already a pretty popular pattern, so this would just canonify it in the language and remove some redundancy at the same time.
I think, but can not yet prove, that Python could be made to enforce that pattern.
-
@Dreikin said in Python 3 angst 2016 edition:
allowing freely mixed indents types is a problem
Python does not allow mixed indents. Indents must be the same in the whole file.
My personal thinking is that indentation-based blocking should use tabs alone for indentation,
Good, semantic decision :)
-
@djls45 said in Python 3 angst 2016 edition:
that should be simply a non-functional style decision and gives semantic meaning to it
I think, because of the way people read code, it generally already has semantic meaning for the programmer, even if the language itself doesn't care. I don't think it's likely to be non-functional in that sense any time soon, and it's rather more useful for humans than braces anyway (visual indication of blocking is, in most cases, easier for humans to keep track of than brace-count blocking.[citation needed]).
-
@Adynathos said in Python 3 angst 2016 edition:
Python does not allow mixed indents. Indents must be the same in the whole file.
Oh good. For some reason I'd got the idea that it was possible to do otherwise. (As you can tell, I don't do much Python yet).
-
@Adynathos said in Python 3 angst 2016 edition:
Python does not allow mixed indents. Indents must be the same in the whole file.
Do they enforce that, or does stuff just break if you get it wrong?
-
@djls45 I'm of the opposite opinion:
In traditional languages, the code blocks end up being presented in two ways - the braces syntax (which computers read) and the indentation (which humans read).
Python removes this duplication and I quite like the result - less noise, no needless infromation-less lines, etc.You really shouldn't be mixing tabs and spaces for indentation but I agree python could've handled this better by disallowing it altogether, requiring either all tabs or all spaces for indentation for each file, giving a clear error if this is violated.
-
@dkf said in Python 3 angst 2016 edition:
Do they enforce that, or does stuff just break if you get it wrong?
If they are mixed, it says:
IndentationError: unindent does not match any outer indentation level
or
TabError: inconsistent use of tabs and spaces in indentation
-
@CreatedToDislikeThis said in Python 3 angst 2016 edition:
requiring either all tabs or all spaces for indentation for each file, giving a clear error if this is violated
It does exactly that.
-
@Adynathos said in Python 3 angst 2016 edition:
@Dreikin said in Python 3 angst 2016 edition:
allowing freely mixed indents types is a problem
Python does not allow mixed indents. Indents must be the same in the whole file.
So an indentation "pattern" of space-tab-space-tab-space-space-tab is acceptable if it's used throughout the file.
-
@djls45 said in Python 3 angst 2016 edition:
So an indentation "pattern" of space-tab-space-tab-space-space-tab is acceptable if it's used throughout the file.
No, its
n x tab
xorn x space
forn >= 1
if i remember correctly.
-
@CreatedToDislikeThis said in Python 3 angst 2016 edition:
no needless infromation-less lines
So you prefer vertically cramped code? I find that almost as unreadable as code that is not block-aligned on the left side. Line breaks and braces on their own lines help a lot to add readability to complex code by breaking up small logical chunks.
-
@Adynathos said in Python 3 angst 2016 edition:
@djls45 said in Python 3 angst 2016 edition:
So an indentation "pattern" of space-tab-space-tab-space-space-tab is acceptable if it's used throughout the file.
No, its
n x tab
xorn x space
forn >= 1
if i remember correctly.IIRC, that's only "enforced" by some Python code editors.
-
@djls45 said in Python 3 angst 2016 edition:
@Adynathos said in Python 3 angst 2016 edition:
@djls45 said in Python 3 angst 2016 edition:
So an indentation "pattern" of space-tab-space-tab-space-space-tab is acceptable if it's used throughout the file.
No, its
n x tab
xorn x space
forn >= 1
if i remember correctly.IIRC, that's only "enforced" by some Python code editors.
I mean it works this way in the CPython 3.5 interpreter implementation, some simple tests support that hypothesis:
Mixed indentation causes an exception.
--- well next post proves that wrong :D ---
-
@Adynathos said in Python 3 angst 2016 edition:
@djls45 said in Python 3 angst 2016 edition:
So an indentation "pattern" of space-tab-space-tab-space-space-tab is acceptable if it's used throughout the file.
No, its
n x tab
xorn x space
forn >= 1
if i remember correctly.This works just fine, it seems:
https://ideone.com/xNVJSAThis indicates that it's only that each indentation level must match, and that it's a Python 3 thing.
-
@Dreikin said in Python 3 angst 2016 edition:
This works just fine, it seems:
https://ideone.com/xNVJSAIndeed, good test!
I just remember reading about it and considered that is sensible and never looked at the topic again because why would I use mixed indents? :P
-
@Adynathos Any reasonable Python IDE will complain about PEP8 violations anyway.
-
@Adynathos said in Python 3 angst 2016 edition:
@Dreikin said in Python 3 angst 2016 edition:
This works just fine, it seems:
https://ideone.com/xNVJSAIndeed, good test!
I just remember reading about it and considered that is sensible and never looked at the topic again because why would I use mixed indents? :PI can't take credit for it though - I just
stoleborrowed it from the second link.
@djls45 said in Python 3 angst 2016 edition:
@CreatedToDislikeThis said in Python 3 angst 2016 edition:
no needless infromation-less lines
So you prefer vertically cramped code? I find that almost as unreadable as code that is not block-aligned on the left side. Line breaks and braces on their own lines help a lot to add readability to complex code by breaking up small logical chunks.
I remember this showing up in the WTF Bites thread:
https://twitter.com/UdellGames/status/788690145822306304
...and while for C/C++ that is clearly a massive , it is pretty nice (for C-ish syntax) to read. All the important information is encoded in the spacing, and the braces and semi-colons are redundant (assuming they match the spacing). It can be made less cramped by just putting in one or two empty lines — no need for braces.
-
@Dreikin said in Python 3 angst 2016 edition:
it is pretty nice (for C-ish syntax) to read
. . . if your code is nice and short like that. Once you start getting longer functions and loops, it can get quite out of hand.
-
@Dreikin said in Python 3 angst 2016 edition:
semi-colons are redundant
Exactly, why did they put them into C++ / Java?
Having 2 statements in one line is ugly anyway.
Python's idea to separate statements with newlines is more intuitive, and if you have a long expression, you can put it into a ().Anyway, the root of the problem here is that the existing tools still treat code as text, even though there exist many texts which are not valid code.
Somehow we do not have holy wars about styles of binary encoding of a PNG image.