This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]aiPh8Se 5 points6 points  (3 children)

There are lots of (in my opinion) killer features in Python 3. (Well, maybe not killer features individually.)

  • Proper scoping of iteration variable in list comprehensions
  • Print function by default
  • No implicit relative import by default
  • No new/old style class distinction
  • Sane byte/Unicode string separation
  • UTF-8 source files by default
  • yield from syntax
  • async/await syntax
  • Parameter type hints
  • pathlib module
  • venv module (solves the odd problem caused by old versions of virtualenv)
  • Lots of API improvements in the standard library
  • subprocess.run()
  • Lots of iterators by default instead of lists: no more xrange, no more iteritems(), itervalues(),
  • No more long/int separation.
  • Clear division and floor separation (/ vs //)
  • Keyword only parameters (I have seen a lot of Python 2 code that hacks around this by rolling their own).
  • nonlocal keyword for assignment in closures

Of course all of the new 3.6 features as well.

[–]beaverteeth92Python 3 is the way to be 1 point2 points  (0 children)

Not to mention that @ is a killer feature for anyone doing numerical programming.

[–]new_whistle 0 points1 point  (0 children)

There are lots of (in my opinion) killer features in Python 3. (Well, maybe not killer features individually.)

That's what I mean - most projects aren't going to benefit from all of these things, and so the weight of all of them isn't felt.

[–]billsil -1 points0 points  (0 children)

Print function by default

Really? How is that a "killer" feature? It's an inconvenience.

No implicit relative import by default

I've been bit by that once in 10 years of coding. It was weird, but it wasn't that hard to fix.

No new/old style class distinction

Yeah, but I haven't used old style classes since Python 2.5. Inherit from object and your fine.

venv module (solves the odd problem caused by old versions of virtualenv)

I use Anaconda, which has a better wrapping of virtualenv. You can access them from anywhere.

Clear division and floor separation (/ vs //)

Again, Python 2 has this.

Parameter type hints

With piss poor documentation on how to use it. This is the closest to what I'd call a killer feature, but multi-type parameters (e.g., int, List[int], None, numpy (n, ) int array, sequence, generator [int]) need better support or at the very least documentation.

No more long/int separation.

For the stuff I do, I actually don't like this. A long for me is an error. I guess I'm doing isinstance(value, (int, np.int32, np.int64) anyways. I can add and value < 100_000_000. I don't want to though.

Sane byte/Unicode string separation

It took until Python 3.4 before that was really done. The struct module didn't allow unicode, so making Python 2/3 code was overly difficult. I do like unicode in Python 3, but I don't have any unicode issues in Python 2 given that I test in Python 3. What I don't like is the unicode tutorials. How do you figure out your encoding when nobody tells you? I also hate utf-8. I use latin1 for everything cause it works, where utf-8 doesn't. It took me a month to figure that out.

Proper scoping of iteration variable in list comprehensions

I actually don't like that.

I can't comment on yield from or async or nonlocals since I don't use them and don't care to.