Live data from Hacker News

Python 3.11

docs.python.org

31–40 of 156 posts

Re: Python 3.11

#31
post #23
post #3

This is just a change log its better to link to the 3.11 what’s new: https://docs.python.org/3.11/whatsnew/3.11.html

Between this link and the OP, we're seeing the first improvements to drop from Mark Shannon's Microsoft-funded full-time work on CPython optimization, alongside Eric Snow and Guido van Rossum: https://www.theregister.com/2021/05/19/faster_python_mark_sh... https://github.com/markshannon/faster-cpython/blob/master/pl... - indicates that this is step 2 of 4, where the forthcoming steps actually plan to introduce JIT co…

With Python style favoring exceptions, I could see just the zero-cost try alone being a meaningful improvement.

Re: Python 3.11

#32
post #29
post #6

just spent about 4 hrs getting Python 2 and pip setup on my Mac. Any time I have the misfortune of needing to use python I get cold sweats at the thought of the environment stuff. Why is this still such a massive problem?

1. Python has a low barrier to entry and is a popular first language, so most users don't realise how bad it is. 2. Python was originally popular with old-school sysadmins, Debian types, and a lot of its package management is based around that philosophy of carefully hand-tended servers shared by multiple users.

Care to elaborate on what is bad? How bad are they compared to other languages? (Assuming you are always accepting some tradeoffs when moving from one eco system to another)

Re: Python 3.11

#33
post #6

just spent about 4 hrs getting Python 2 and pip setup on my Mac. Any time I have the misfortune of needing to use python I get cold sweats at the thought of the environment stuff. Why is this still such a massive problem?

Using Python 2 is a big part of the problem. Modern Python 3 is a lot nicer. Also you're much better off if each Python project has its own virtual environment using the venv module.

While I also quirked an eyebrow at the exact version, is 3 better at package management & environments?

Re: Python 3.11

#34
post #29
post #6

just spent about 4 hrs getting Python 2 and pip setup on my Mac. Any time I have the misfortune of needing to use python I get cold sweats at the thought of the environment stuff. Why is this still such a massive problem?

1. Python has a low barrier to entry and is a popular first language, so most users don't realise how bad it is. 2. Python was originally popular with old-school sysadmins, Debian types, and a lot of its package management is based around that philosophy of carefully hand-tended servers shared by multiple users.

> a lot of its package management is based around that philosophy of carefully hand-tended servers shared by multiple users.

Is it? I'd love for apt to support virtual environments or `apt install --user` like pip does, let alone populating venvs with requirements.txt.

Re: Python 3.11

#35
In https://docs.python.org/3.11/whatsnew/3.11.html :

> A new function operator.call has been added, such that

    operator.call(obj, *args, **kwargs) == obj(*args, **kwargs).
Isn't this the same as the old apply function?

https://docs.python.org/2/library/functions.html#apply

Ah, it was discussed:

https://bugs.python.org/issue44019#msg400821

> Python2's apply has different semantics: it takes non-unpacked arguments, i.e.

    def apply(f, args, kwargs={}): return f(*args, **kwargs)
> rather than

    def call(f, *args, **kwargs): return f(*args, **kwargs)

Re: Python 3.11

#36
post #6

just spent about 4 hrs getting Python 2 and pip setup on my Mac. Any time I have the misfortune of needing to use python I get cold sweats at the thought of the environment stuff. Why is this still such a massive problem?

[deleted]

Re: Python 3.11

#37
post #5

I'm waiting for Python for Workgroups 3.11

Close...

  Python 3.8.10 (default, Jun  2 2021, 10:49:15)
  [GCC 9.4.0] on linux
  Type "help", "copyright", "credits" or "license" for more 
  information.
  >>> print(3.11 - 3.1)
  0.009999999999999787
  >>>

Re: Python 3.11

#38

Earlier quoted context omitted.

Using Python 2 is a big part of the problem. Modern Python 3 is a lot nicer. Also you're much better off if each Python project has its own virtual environment using the venv module.

While I also quirked an eyebrow at the exact version, is 3 better at package management & environments?

Yes, virtual environments are baked into the language. python3 -m venv venv will make an environment named venv. source venv/bin/activate activates it. pip install package in an activated environment installs the package only into the active environment.

Re: Python 3.11

#39
post #21
post #6

just spent about 4 hrs getting Python 2 and pip setup on my Mac. Any time I have the misfortune of needing to use python I get cold sweats at the thought of the environment stuff. Why is this still such a massive problem?

i sympathize. the problem is apple. they are (understandably) refusing to ship an up-to-date global python interpreter with macOS. not only that, they aren't removing the default 2.7 that they ship. macOS Big Sur ships Python 2.7. ha. ha. ha. none of the proposed "virtual environments" solutions are going to rescue you when you operate globally at the OS-level and not in a sandbox. been there.

> not only that, they aren't removing the default 2.7 that they ship.

Yes they are:

    $ python

    WARNING: Python 2.7 is not recommended. 
    This version is included in macOS for compatibility with legacy software. 
    Future versions of macOS will not include Python 2.7. 
    Instead, it is recommended that you transition to using 'python3' from within Terminal.
    
    Python 2.7.16 (default, Aug 30 2021, 14:43:11) 
    [GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>>

Re: Python 3.11

#40
> When printing tracebacks, the interpreter will now point to the exact expression that caused the error instead of just the line. For example:

  Traceback (most recent call last):
    File "distance.py", line 11, in 
      print(manhattan_distance(p1, p2))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "distance.py", line 6, in manhattan_distance
      return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y)
                             ^^^^^^^^^
  AttributeError: 'NoneType' object has no attribute 'x'
This is such a great quality of life improvement.
Post reply on HN