Live data from Hacker News

Python 2.x vs 3.x use survey

surveymonkey.com

31–40 of 119 posts

Re: Python 2.x vs 3.x use survey

#31
post #17

The biggest thing that drives me nuts about py3 is just that its repl doesn't evaluate generators. I'm sure they had their reasons, but I use python as my go-to calculator, and when simple operations with maps/ranges give me a representation of a generator ("<map object at ...", whatever), then it's just less useful to me. I could be alone in that use case though...

[deleted]

Re: Python 2.x vs 3.x use survey

#32
post #17

The biggest thing that drives me nuts about py3 is just that its repl doesn't evaluate generators. I'm sure they had their reasons, but I use python as my go-to calculator, and when simple operations with maps/ranges give me a representation of a generator ("<map object at ...", whatever), then it's just less useful to me. I could be alone in that use case though...

Consider a generator that yields results indefinitely, or even merely millions of results. Are you still sure you want those printed to the repl? :)

Re: Python 2.x vs 3.x use survey

#33
post #25

"Do you think Python 3.x was a mistake?" That's where I stop filling out the survey. And that's the python community biggest problem. Moving forward, everyone needs to pick a version (and I'd pick 3). A new user just sits and spins his head. Even the training materials are all over the place.

I wouldn't, not yet. There's not enough support. Great ideas, but the support isn't there for it yet: not in libraries, not in operating systems, not in documentation.

I don't think Python3 was a mistake, but the migration is going to take time. Cutting off either group would have been a terrible decision, and I'm glad they didn't.

Re: Python 2.x vs 3.x use survey

#34
post #25

"Do you think Python 3.x was a mistake?" That's where I stop filling out the survey. And that's the python community biggest problem. Moving forward, everyone needs to pick a version (and I'd pick 3). A new user just sits and spins his head. Even the training materials are all over the place.

I don't think it's a leading question - I think if they get a large enough sample size, it will be a worthwhile survey of the Python community's 2/3 behavior.

Ultimately, you did pro-Python 3 supporters a disservice by not speaking up.

Re: Python 2.x vs 3.x use survey

#35

Missing a question. "Would you switch to python 3 if they brought back the print statement" Edit: I really just like the statement for the interpreter, and IPython Notebook. To me the statement syntax feels less like programming, and more like using a computer.

What is the advantage of python 2 print over python 3 print? I believe that python 3 print can do everything python 2 print can do on the same level of elegancy. Also, python 2 print has a weird trailing-comma syntax. When a trailing comma is added to a print statement, a space is printed when another print statement is used. For example, print 'hi', # prints hi (no extra space in the end) print 'hi',; print 'hi' # p…

no trailing space is a convenient shorthand - print by itself prints with a newline (so it might make sense to have print() vs println()); print + comma omits the newline and waits for the next print statement, so that

    print 'hi',
    do_something()
    print 'there'
and

    print 'hi', 'there'
both yield

    hi there
(Assuming do_something() doesn't call print itself)

Re: Python 2.x vs 3.x use survey

#36

The survey is missing sets of answers for users who rejected or moved away from python because they were turned off by the disconnect between core devs and the community when python 3 got released.

I can't say I understand this attitude. It's analogous to cutting off your nose to spite your face. Both Python 2 and 3 are actively supported, and there's a clear migration path defined. The migration isn't complete yet, but it's progressing at a development friendly pace.

I say this as someone still on Python 2.6 due to environment restrictions.

Re: Python 2.x vs 3.x use survey

#37
post #35

Earlier quoted context omitted.

What is the advantage of python 2 print over python 3 print? I believe that python 3 print can do everything python 2 print can do on the same level of elegancy. Also, python 2 print has a weird trailing-comma syntax. When a trailing comma is added to a print statement, a space is printed when another print statement is used. For example, print 'hi', # prints hi (no extra space in the end) print 'hi',; print 'hi' # p…

no trailing space is a convenient shorthand - print by itself prints with a newline (so it might make sense to have print() vs println()); print + comma omits the newline and waits for the next print statement, so that print 'hi', do_something() print 'there' and print 'hi', 'there' both yield hi there (Assuming do_something() doesn't call print itself)

FWIW:

    pprint = functools.partial(print, end=' ')
    pprint('hi')
    do_something()
    print('there')

    print('hi', 'there', sep=' ')
I appreciate the fine grained control, and the ability to do things like `functools.partial` on it.

    fprint = functools.partial(print, file='/var/log/foo.log')
    fprint("I'm writing to a file!")
    fprint("So am I")

Re: Python 2.x vs 3.x use survey

#39

There was a dynamic graph somewhere showing the number Python 3 and Python 2 packages on PyPi against time, no amount of googling can find it, does anyone know what I'm referring to? I'd love that link.

Do you mean the wall of shame/superpowers? https://python3wos.appspot.com/

Nope, there was a graph, though that is interesting too. I'm actually quite impressed with how green it is!

Re: Python 2.x vs 3.x use survey

#40
post #22
post #17

The biggest thing that drives me nuts about py3 is just that its repl doesn't evaluate generators. I'm sure they had their reasons, but I use python as my go-to calculator, and when simple operations with maps/ranges give me a representation of a generator ("<map object at ...", whatever), then it's just less useful to me. I could be alone in that use case though...

Write it as a list comprehension instead; it has identical syntax except for using square brackets instead of parentheses, and returns a list.

A list comprehension would work for GP, who wants a calculator. But others like to try out snippets of code in the REPL before using them in programs, and in that case you want the code to be the same.

Would the following work? It's been a while since I've had Py3 installed, so I can't casually try it. In your PYTHONSTARTUP, place the following:

  _map = map
  def map(f, *args):
    return list(_map(f, *args))
So you get lists in interactive mode, but iterators in actual scripts.
Post reply on HN