Live data from Hacker News

What’s New in Python 3.7

docs.python.org

21–30 of 70 posts

Re: What’s New in Python 3.7

#21
post #3

"More than 255 arguments can now be passed to a function, and a function can now have more than 255 parameters." There are human devs who needed this? Or is this a sign that AI bots are now involved in language design?

They have issued tagged with the bug report and adding more arguments to named tuple and to general functions seems to be the issue. The motivation for some of these changes were due to automatic code generation.

See https://bugs.python.org/issue18896 and https://bugs.python.org/issue12844 for more information.

Also, Django 1.3 had issues with 255 arguments for named tuples.

To my knowledge there are no "AI Bots" that are involved in language design. Code generation is possible. Also solver aided languages See https://emina.github.io/rosette/

Re: What’s New in Python 3.7

#22

Earlier quoted context omitted.

First thing that pops to mind is ORM for extremely column-wide tables, which are not unusual in some domains.

I'm not too familiar with Python but something like that would typically be handled by passing a pointer to a data structure containing the column data, and not each column itself (or does/did it have a 255-item limit on its other data structures too...?)

OK, but then you need to populate the data structure. You can do it with individual member assignments of course, but some quick Googling (I am not a Python expert either) suggests that the default row/object constructor for SQLAlchemy is an arg-per-field function.

Re: What’s New in Python 3.7

#23
post #3

"More than 255 arguments can now be passed to a function, and a function can now have more than 255 parameters." There are human devs who needed this? Or is this a sign that AI bots are now involved in language design?

Saw one of those in a vb.net shop. It went that way:

- someone creates a function to do something on a business concept that was not materialized by a class. Think of a bunch (~ 8) of properties that belong together but for some bad reason are moved in separate variables all over the place

- another function has to work on a set of those objects. The dev who implements it thinks it would be a good idea to keep all parameters separate. No we have nproperties * nobjects parameters. The dev use a rigorous naming convention for readability (creatorFirstName, creatorLastName, validatorFirstName, etc)

- now we have multiple sets (creatorFirstName1, 2, 3 ...)

I don't remember the details but there was around three hundred parameters.

edit: formatting

Re: What’s New in Python 3.7

#25
post #5

Earlier quoted context omitted.

Not really, imho. It makes more things work out of the box, but input and output for things that used to be ASCII anyway remain the same.

Are you American? Americans always think that changing the encoding is a minor detail. Guess what, changing the default encoding breaks every language that is not English.

[deleted]

Re: What’s New in Python 3.7

#27

Unrelated to python 3.7, but they recently added this feature that you can add two dictionaries together in 3.5 by doing: new_dict = {**dict1, **dict2} It is so handy and nice

I didn't know about that. It's also unbounded:

    >>> d = {**{1:2,2:2,3:2}
            ,**{4:2,5:2,6:2}
            ,**{7:2,8:2,9:2}}
    >>> d
    { 1: 2, 2: 2, 3: 2
    , 4: 2, 5: 2, 6: 2
    , 7: 2, 8: 2, 9: 2}

Re: What’s New in Python 3.7

#28
Some nice optimisations included:

    Added two new opcodes: LOAD_METHOD and CALL_METHOD to avoid instantiation of bound method objects for method calls, which results in method calls being faster up to 20%. (Contributed by Yury Selivanov and INADA Naoki in bpo-26110.)
    Searching some unlucky Unicode characters (like Ukrainian capital “Є”) in a string was to 25 times slower than searching other characters. Now it is slower only by 3 times in worst case. (Contributed by Serhiy Storchaka in bpo-24821.)
    Fast implementation from standard C library is now used for functions erf() and erfc() in the math module. (Contributed by Serhiy Storchaka in bpo-26121.)
    The os.fwalk() function has been sped up by 2 times. This was done using the os.scandir() function. (Contributed by Serhiy Storchaka in bpo-25996.)
    Optimized case-insensitive matching and searching of regular expressions. Searching some patterns can now be up to 20 times faster. (Contributed by Serhiy Storchaka in bpo-30285.)
    selectors.EpollSelector.modify(), selectors.PollSelector.modify() and selectors.DevpollSelector.modify() may be around 10% faster under heavy loads. (Contributed by Giampaolo Rodola’ in bpo-30014)
edit: That one around the unlucky Unicode characters is fascinating. https://bugs.python.org/issue24821

Due to the way that regex searching is optimised, it trips up because: ".. the lowest byte of the code of Ukrainian capital letter Є (U+0404) matches the highest byte of codes of most Cyrillic letters (U+04xx). There are similar issues with some other scripts ..."

Re: What’s New in Python 3.7

#30
post #5

Earlier quoted context omitted.

Not really, imho. It makes more things work out of the box, but input and output for things that used to be ASCII anyway remain the same.

Are you American? Americans always think that changing the encoding is a minor detail. Guess what, changing the default encoding breaks every language that is not English.

I'm Finnish, thank you for asking, so I'm quite aware of different encodings.
Post reply on HN