It's funny how the differences between python 2.7 & 3.x is less than swift 2 to 3, yet python stays in 2.7 land forever.
New features you can't use unless you are in Python 3
151–160 of 264 posts
Re: New features you can't use unless you are in Python 3
#152Just wondering but what should you do if you decide to go with Python 3 and find a library you want to use that isn't compatible and you are short on time?
At this point in time, if you want to use a library and it isn't compatible with py3, then you probably shouldn't use that library. Essentially all actively maintained libraries are converted, and we are even starting to see libs that do not support py2.
Re: New features you can't use unless you are in Python 3
#153Earlier quoted context omitted.
Overloading operators for cute purposes is usually a misfeature. There was a fad for this in the early C++ days. I once wrote a marshalling library which overloaded "||", so that you could write p = stream || rec.a || rec.b || rec.c; and get an object which, if written, marshalled the record, and if read, unmarshalled it. The marshalling order was only specified once. Cute, but in retrospect, bad. Python's classic ov…
> It seems to be best to restrict the math operators to math. Ken Iverson would probably disagree.
Re: New features you can't use unless you are in Python 3
#154Earlier quoted context omitted.
Nice, do they have similar for base64 too?
import base64
Re: New features you can't use unless you are in Python 3
#155Earlier quoted context omitted.
What do you mean, default ? "/usr/bin/python" symlinked to "/usr/bin/python3" instead of "/usr/bin/python2"?
Installed by default.
It's not the default because /bin/python is synlinked to python2. You have to explicitly run it.
Re: New features you can't use unless you are in Python 3
#156Earlier quoted context omitted.
> It seems to be best to restrict the math operators to math. Ken Iverson would probably disagree.
I've coded in APL. There's a reason it died out. Although it was the first language with "do this on all that stuff" operators.
Judging from its surviving successors (J particularly), the reason is “keyboards” not “operator overloading”.
Re: New features you can't use unless you are in Python 3
#157I did not know you could append to a Path via "/", but that's really awesome! I also really love working with generators when I write Python. They are just such a simple idea that's very powerful and I miss them so much when I go back to javascript (I know javascript has them now, but I haven't written them, and they don't look as fluent as Python 3, where the large parts of the language design is based around them).
Overloading operators for cute purposes is usually a misfeature. There was a fad for this in the early C++ days. I once wrote a marshalling library which overloaded "||", so that you could write p = stream || rec.a || rec.b || rec.c; and get an object which, if written, marshalled the record, and if read, unmarshalled it. The marshalling order was only specified once. Cute, but in retrospect, bad. Python's classic ov…
Re: New features you can't use unless you are in Python 3
#158I did not know you could append to a Path via "/", but that's really awesome! I also really love working with generators when I write Python. They are just such a simple idea that's very powerful and I miss them so much when I go back to javascript (I know javascript has them now, but I haven't written them, and they don't look as fluent as Python 3, where the large parts of the language design is based around them).
Overloading operators for cute purposes is usually a misfeature. There was a fad for this in the early C++ days. I once wrote a marshalling library which overloaded "||", so that you could write p = stream || rec.a || rec.b || rec.c; and get an object which, if written, marshalled the record, and if read, unmarshalled it. The marshalling order was only specified once. Cute, but in retrospect, bad. Python's classic ov…
Every single time I see printing to an IO stream in C++ I think 'why are they bit-shifting that... oh right'.
Re: New features you can't use unless you are in Python 3
#159Earlier quoted context omitted.
Consistency and keyword args are useful.
"11. There should be one-- and preferably only one --obvious way to do it." from the Zen of Python. Somebody intentionally misread it as, "There should be only one way to do it." They obviously made a grave mistake. Same with many 2->3 changes.
Re: New features you can't use unless you are in Python 3
#160Earlier quoted context omitted.
Compare these instead: for i in range(n): yield i yield from range(n)
Both seem quite readable, really. Seems similar to the usual "list comprehensions vs. for loop" arguments; to which I always think "use whichever is readable for the given code".
I fail to see how anything similar would apply here.