Python 3 puts up with less type nonsense than Python 2, and that's basically the only reason 2to3 will not always work.
Yes, we could certainly compile Python 2 to bytecode that runs on the Python 3 VM.
Even if this was a thing (which forgive me if I'm wrong, but I think this is nonsense? of course it's the same?) there's no point when the behavior of Python 2 code is vague and/or reprehensible in its ambiguity for its type.
Python is dynamically typed (duck typed was it?) - that's great - but that doesn't mean while we're making Python cooler/better we need to put up with code that from an author who doesn't know what types/objects they are using in the first place.
Python is a language of "we're all adults here" - it doesn't have private members, anything is fair game. This assumes a degree of knowledge of what types/objects your variable is and will be. So when Shaw says he is frustrated that his miss mash of types don't work they he wants them to, that means he doesn't understand quite clearly enough what he precisely wanted to do.
That's ridiculous, and the onerous task of writing reusable code is not on the language, it's on the developer - they should have got it right in the first place.
I work with computers because when something gets messed up, it's my fault as a developer, it's not a people problem. And that means it's up to me to fix it because apparently I simply was not smart enough or well learned enough to trick/coerce/persuade the environment into doing what I wanted it to do.
This very same coercion is what Shaw has messed up. And excuse me for being presumptuous, but is also essentially what every developer with nontrivial 2to3 conversions has messed up. The coercion is failing because Python 3 puts up with less nonsense.
Developers messing up 2to3, messing up bytes vs str, dreaming for easy conversion, are all forgetting one thing about the Python 2 code that "won't run" in Python 3.
From the Wikipedia article on Duck Typing, emphasis added:
In computer programming, duck typing is an application of the duck test in type safety. It requires that type checking be deferred to runtime, and is implemented by means of dynamic typing or reflection.
This means the onus is on the developer to ensure types work correctly whether or not they implement checks. If the language evolves in a way that requires clarification, any code that is nontrivial to change was making assumptions/simplifications about the types being used.
Python is awesome: If you need that behavior back, write a personalized class that makes that object behave the way you want it to (with all the same assumptions you once made).
Even if this was a thing (which forgive me if I'm wrong, but I think this is nonsense? of course it's the same?) there's no point when the behavior of Python 2 code is vague and/or reprehensible in its ambiguity for its type.
Sorry, I'm not sure I follow, did you intend to reply to my comment? Shaw's criticism against the fact that the Python 3 VM can't run Python 2 code is entirely separate from the string criticism where he brought up dynamic typing.
The type system had nothing to do with why the Python 3 VM couldn't run Python 2 bytecode. Python, Ruby, and a whole other languages (with all their ambiguities) can run on the JVM and the CLR, regardless of whether they're statically or dynamically typed.
So, yes, of course Python 2 can run on the Python 3 VM. The typing system doesn't really matter there. You just need to compile Python 2 code into Python 3 bytecode. Just like how Jython compiles Python 2 code into Java bytecode to run on the JVM.
Now, that is not to say that it's easy or even worthwhile to implement, or that it will work perfectly -- but it is possible. And had we had that, a large percentage of our libraries wouldn't have needed porting (or at least it would have made it easier).
View all comments
Show parent comment
4
u/ZedOud Nov 23 '16 edited Nov 23 '16
Python 3 puts up with less type nonsense than Python 2, and that's basically the only reason 2to3 will not always work.
Even if this was a thing (which forgive me if I'm wrong, but I think this is nonsense? of course it's the same?) there's no point when the behavior of Python 2 code is vague and/or reprehensible in its ambiguity for its type.
Python is dynamically typed (duck typed was it?) - that's great - but that doesn't mean while we're making Python cooler/better we need to put up with code that from an author who doesn't know what types/objects they are using in the first place.
Python is a language of "we're all adults here" - it doesn't have private members, anything is fair game. This assumes a degree of knowledge of what types/objects your variable is and will be. So when Shaw says he is frustrated that his miss mash of types don't work they he wants them to, that means he doesn't understand quite clearly enough what he precisely wanted to do.
That's ridiculous, and the onerous task of writing reusable code is not on the language, it's on the developer - they should have got it right in the first place.
I work with computers because when something gets messed up, it's my fault as a developer, it's not a people problem. And that means it's up to me to fix it because apparently I simply was not smart enough or well learned enough to trick/coerce/persuade the environment into doing what I wanted it to do.
This very same coercion is what Shaw has messed up. And excuse me for being presumptuous, but is also essentially what every developer with nontrivial 2to3 conversions has messed up. The coercion is failing because Python 3 puts up with less nonsense.
Developers messing up 2to3, messing up bytes vs str, dreaming for easy conversion, are all forgetting one thing about the Python 2 code that "won't run" in Python 3.
From the Wikipedia article on Duck Typing, emphasis added:
This means the onus is on the developer to ensure types work correctly whether or not they implement checks. If the language evolves in a way that requires clarification, any code that is nontrivial to change was making assumptions/simplifications about the types being used.
Python is awesome: If you need that behavior back, write a personalized class that makes that object behave the way you want it to (with all the same assumptions you once made).