[Python-ideas] Re: On the history and usage of vars [was Re: Re: Unpack operator "**" and Mapping]

2020-12-30 Thread Steve Barnes
>len() is an important abstraction for containers, and its usage deserves a >short name (just like unary minus and abs() for numbers). This is crucial even >though >you have to use its "true name" >(https://xkcd.com/2381/

[Python-ideas] Re: Make for/while loops nameable.

2020-12-05 Thread Steve Barnes
How about reserving unicode numeric superscript characters 0..9 as label identifiers only to be used for loop & break, etc. Then the example below would become: while¹ not processed(): for x in the_stuff as 37: if all_done(x): break¹ Steve Barnes From: David M

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-29 Thread Steve Barnes
Wouldn't `local` make sense as the opposite of `global` - personally I would rather see that than LET. -Original Message- From: Cameron Simpson Sent: 30 November 2020 07:13 To: sairamkumar2...@gmail.com Cc: python-ideas@python.org Subject: [Python-ideas] Re: Making the for statement wo

[Python-ideas] Re: Making "Any" a builtin

2020-11-29 Thread Steve Barnes
it is imported from there as well. From: Paul Bryan Sent: 30 November 2020 06:30 To: Steve Barnes ; Inada Naoki ; Abdulla Al Kathiri Cc: python-ideas Subject: Re: [Python-ideas] Re: Making "Any" a builtin pbryan@dynamo<mailto:pbryan@dynamo>:~$ python3 Python 3.8.6 (default,

[Python-ideas] Re: Making "Any" a builtin

2020-11-29 Thread Steve Barnes
Any only works as an annotation: In [3]: def fn(*argv: Any) -> Any: ...: return argv[0] ...: From: Paul Bryan Sent: 30 November 2020 05:55 To: Inada Naoki ; Abdulla Al Kathiri Cc: python-ideas Subject: [Python-ideas] Re: Making "Any" a builtin pbryan@dynamo:

[Python-ideas] Re: Global flag for whether a module is __main__

2020-11-13 Thread Steve Barnes
useful in trying to resolve circular imports, imports via importlib or exec, etc. The code need would be slightly more complex needing to check the current call stack at the time of import but I don't think that it would be too much overhead. Steve Barnes From: Henshaw, Andy via Python-

[Python-ideas] Re: Optimize out setting unused underscored local variables

2020-10-20 Thread Steve Barnes
Of course there is also the problem of detecting any functions assigned to _ or _T that may be called - otherwise there is a risk of breaking the typical gettext usage in I18n! Steve Barnes Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Wind

[Python-ideas] Re: Add _KB, _MB, _GB to numeric literals

2020-10-13 Thread Steve Barnes
I would also suggest taking a look at human friendly https://pypi.org/project/humanfriendly/ which does a lot this for you on the user input/output front. Steve Barnes From: malin...@163.com<mailto:malin...@163.com> Sent: 13 October 2020 13:14 To: python-ideas@python.org<mailto:pyt

[Python-ideas] Suggest mentioning venv --upgrade in installer output & release notes

2020-09-24 Thread Steve Barnes
If you are upgrading a maintenance version (following the major.minor.maintenance naming) of python, e.g. 3.8.5 -> 3.8.6 it is also a good idea to update any 3.8 venvs that you may be using. The venv –upgrade flag is reasonably new and I think that relatively few people will have heard about it

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-15 Thread Steve Barnes
>>> 1 / 0 >>> 1 / 0.0 inf Is not true as since python 3 has adopted true division 1/1 returns 1.0 so 1/0 would also return inf. Steve Barnes Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: Cade Brown<mailto:brown.c...@gmail.c

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-15 Thread Steve Barnes
o pick a random name) is False (the default) such operations will raise an exception but if it is True INF, -INF or NaN is returned (ideally with some debug output – this would be in the spirit of the IEEE Signalling NaN). Steve Barnes ___ Python-ideas mailing li

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-13 Thread Steve Barnes
(overflow at 1e6145) & Octuple (256 bit) overflow at about 1.62e78913 values and in the future 512/1024 bit floats – I love the cross platform support of python. Sorry to be teaching grandma to suck eggs. Steve Barnes ___ Python-ideas mail

[Python-ideas] Re: 'Infinity' constant in Python

2020-09-12 Thread Steve Barnes
Indeed the usual definition of isnan reads: def isnan(x): return x != x ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.p

[Python-ideas] Option Read/Write Files without discarding comments

2020-08-27 Thread Steve Barnes
get told off for 2 related but divergent elements in one thread! Steve Barnes Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Improve error message for trying to import itself

2020-08-22 Thread Steve Barnes
). Might be worth some thinking! Steve Barnes Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: Gustav O<mailto:gus...@odinger.se> Sent: 22 August 2020 10:41 To: python-ideas@python.org<mailto:python-ideas@python.org> Subject: [Python-ideas]

[Python-ideas] Re: Tracebacks for C code in Python

2020-08-16 Thread Steve Barnes
to raise ticket(s) and possibly pull requires for those error messages to clarify them – I am reasonably sure that the authors of Pandas would welcome constructive feedback but it does need to be specific of course. Steve Barnes ___ Python-ideas mailing

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-08-05 Thread Steve Barnes
Like it! Sent from Samsung Mobile on O2 Get Outlook for Android<https://aka.ms/ghei36> From: André Roberge Sent: Wednesday, August 5, 2020 7:54:06 PM To: Steve Barnes Cc: python-ideas@python.org Subject: Re: [Python-ideas] Re: Improve handling of Unicode

[Python-ideas] Re: New clause in FOR and WHILE instead of ELSE

2020-07-14 Thread Steve Barnes
ueError as err: print(err) else: # to try print("No Exception") finally: print("Try Ended") Where the multitude of elses makes my eyes cross. Steve Barnes ___ Python-ideas mailing list -- python-ideas@python.org T

[Python-ideas] Re: Else assert statement

2020-07-02 Thread Steve Barnes
a':a, 'b':b, 'c':c, } def foo_default_handler(): """ Handler for remaining cases of foo """ print("Input value must be one of", foo_action_dict.keys()) # Call the approp

[Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-27 Thread Steve Barnes
I found this in the code base I did manage to get it replaced but not without resistance from some parties). Personally I think that community guidelines is better than trying to spell out what is unacceptable in a document such as PEP-8. Steve Barnes -Original Message- From: Greg Ewing

[Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted

2020-06-15 Thread Steve Barnes
-Original Message- From: Greg Ewing Sent: 15 June 2020 07:23 To: python-ideas@python.org Subject: [Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted On 15/06/20 5:11 pm, Steve Barnes wrote: > Of course if we had a NaN value for integ

[Python-ideas] Re: For quicker execution, don't refcount objects that can't be deleted

2020-06-14 Thread Steve Barnes
behavior, you'd have to either change the refcount type from ssize_t to size_t, or else keep the DECREF calls and set the initial value to something like PY_SSIZE_T_MAX/2.) [Steve Barnes] Of course if we had a NaN value for integers, int('NaN'), then we could just set the initial c

[Python-ideas] Re: Bringing the print statement back

2020-06-11 Thread Steve Barnes
is as your preference. There are other benefits as well. So I would suggest simply pip install ipython and type one extra letter when starting your python REPL. Steve Barnes -Original Message- From: Greg Ewing Sent: 11 June 2020 07:51 To: python-ideas@python.org Subject: [Python-ideas] Re: Br

[Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-06-01 Thread Steve Barnes
-Original Message- From: Eryk Sun Sent: 02 June 2020 02:02 To: python-ideas@python.org Cc: Christopher Barker ; Steve Barnes Subject: Re: [Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous On 5/25/20

[Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-05-25 Thread Steve Barnes
Server 2008 R2, Windows Server 2008 which I think covers all of the currently supported versions of Windows. -Original Message- From: Steve Barnes Sent: 25 May 2020 18:56 To: Steven D'Aprano ; python-ideas@python.org Subject: [Python-ideas] Re: How to propose a change with tests wher

[Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-05-25 Thread Steve Barnes
script.txt - it does need to be run as admin. Steve Barnes -Original Message- From: Steven D'Aprano Sent: 25 May 2020 15:34 To: python-ideas@python.org Subject: [Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous On Fri

[Python-ideas] Re: len(path) == len(str(path))

2020-05-24 Thread Steve Barnes
familiar option, (for those used to the bash shell), would be to use a bare - as the marker for where to put the result(s) from the previous stage. Steve Barnes -Original Message- From: Stephen J. Turnbull Sent: 25 May 2020 02:28 To: Dan Sommers <2qdxy4rzwzuui...@potatochowder.com&

[Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-05-22 Thread Steve Barnes
From: Guido van Rossum Sent: 21 May 2020 16:59 To: Steve Barnes Cc: remi.lape...@henki.fr; python-ideas@python.org Subject: Re: [Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous Hi Steve, Have you considered and

[Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-05-21 Thread Steve Barnes
file then the problem would not occur so I guess that it would need to be patched in a transparent manner. Steve Barnes -Original Message- From: remi.lape...@henki.fr Sent: 21 May 2020 13:56 To: python-ideas@python.org Subject: [Python-ideas] Re: How to propose a change with tests

[Python-ideas] How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-05-21 Thread Steve Barnes
eing exceeded? Steve Barnes ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/arch

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-11 Thread Steve Barnes
From: David Mertz Sent: 11 May 2020 08:34 To: Steve Barnes Cc: python-ideas@python.org Subject: Re: [Python-ideas] Re: Improve handling of Unicode quotes and hyphens A third-party module on PyPI for "fix-the-horrible-things-Outlook-does" could be useful. There is no way the standa

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-11 Thread Steve Barnes
-Original Message- From: Steven D'Aprano Sent: 11 May 2020 06:02 To: python-ideas@python.org Subject: [Python-ideas] Re: Improve handling of Unicode quotes and hyphens On Mon, May 11, 2020 at 04:28:38AM +0000, Steve Barnes wrote: > So we currently have a situation where

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-10 Thread Steve Barnes
My personal experience of the most common problematic substitutions by tools such as Outlook, Word & some web tools: 1. Double Quotes \u201c & \u201d “” 2. Single Quotes \u2018 & \u2019 ‘’ 3. The m-hyphen \2013 – 4. Copyright © \xa9 and others, Registered ® \xae and trademark ™ \u2122

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-10 Thread Steve Barnes
erything but potentially user code could be using these characters legitimately inside of strings or comments e.g. the copywrite symbol. Steve Barnes -Original Message- From: Andrew Barnert Sent: 10 May 2020 21:17 To: Steve Barnes Cc: python-ideas@python.org Subject: Re: [Python-ideas]

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-10 Thread Steve Barnes
smart quotes. Very clever! My mail client prefers the plain text part when it is available, which is usually exactly what I would want. But in this case, it confused me for a bit. -- Steven [Steve Barnes] So we currently have a situation where not only does whether code works or not depends o

[Python-ideas] Improve handling of Unicode quotes and hyphens

2020-05-10 Thread Steve Barnes
icit is better than implicit but still leaves it to the user to correct the erroneous input (which could be argued is both good and bad). I would like to suggest that an incremental approach might be the best - clarifying the existing error message being the thing that should not break anything and

[Python-ideas] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-04 Thread Steve Barnes
e that is used to extend the exhausted iterator(s). I think that this would also work well for map as well. Steve Barnes (sorry for top posting - Outlook) -Original Message- From: MRAB Sent: 04 May 2020 17:55 To: python-ideas@python.org Subject: [Python-ideas] Re: PEP 618: Add O

[Python-ideas] Re: Adding a "once" function to functools

2020-04-28 Thread Steve Barnes
n(): """ Finished with gun for now """ draw.reset() One of the issues that newcomers to iterators suffer from is the fact that you need to delete and recreate them if you need to re-use them from the beginning however removing and redefining a function is much

[Python-ideas] Aside RE: Re: macaddress or networkaddress module

2020-04-06 Thread Steve Barnes
As an aside I have a perfect example to back up what Paul is saying below. I work for a large corporation where developers are permitted to install python modules on their development machines, (subject to some licence restrictions), but the proxy settings required to get to PyPi vary from user

[Python-ideas] Re: About python3 on windows

2020-03-25 Thread Steve Barnes
Of course if, rather than creating symlinks, you create a batch file called python3.bat and containing the line: @py -3 %* Then save it to somewhere on your path, e.g. the python scripts directory, then issuing, from the command line or another batch file the command python3 should just work (as

[Python-ideas] Re: About python3 on windows

2020-03-24 Thread Steve Barnes
https://docs.python.org/3.8/using/windows.html#installing-without-ui gives details of all of the options. The Microsoft Store version does not offer any options full stop! From: Kyle Stanley Sent: 24 March 2020 18:10 To: Frédéric De Jaeger Cc: Python-ideas < > Subject: [Python-ideas] Re: About

[Python-ideas] Re: About python3 on windows

2020-03-23 Thread Steve Barnes
answers your problem. Steve Barnes -Original Message- From: Frédéric De Jaeger Sent: 23 March 2020 18:00 To: python-ideas@python.org Subject: [Python-ideas] About python3 on windows Hi all, There is a recurring problem in my company where we use python in various places (python3). We

[Python-ideas] Re: New explicit methods to trim strings

2020-03-22 Thread Steve Barnes
I personally think that there is a better case for an ignore_case flag – the number of times that I have been caught out with [‘a.doc’, ‘b.Doc’, ‘c.DOC’] especially on MS platforms. Steve Barnes From: Kyle Stanley Sent: 23 March 2020 05:49 To: Stephen J. Turnbull Cc: python-ideas Subject

[Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread Steve Barnes
-Original Message- From: Chris Angelico Sent: 05 March 2020 11:42 To: python-ideas@python.org Subject: [Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type On Thu, Mar 5, 2020 at 8:27 PM Steve Barnes wrote: > > One of the

[Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread Steve Barnes
Fascinating material André. I am sure that some people would love the idea of a fractional or decimal iterator, (as long as they don’t try to use it as an index). Steve From: André Roberge Sent: 05 March 2020 09:56 To: Steve Barnes Cc: python-ideas@python.org Subject: Re: [Python-ideas] IDEA

[Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread Steve Barnes
Comments in-line (I wish Outlook would behave sensibly) -Original Message- From: Paul Moore Sent: 05 March 2020 09:52 To: Steve Barnes Cc: python-ideas@python.org Subject: Re: [Python-ideas] IDEA: Allow override of all assignments of a built in type to be a different type On Thu, 5

[Python-ideas] IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread Steve Barnes
se interpreter I do not think that this is a suitable one for an external PyPi library or at least some hooks in the interpreter would be required to make it possible. Any thoughts, feedback, interest, expressions of horror? Or is this already t

[Python-ideas] Re: PyPI should include PEP 440-compliant version strings for including in install_requires

2020-02-10 Thread Steve Barnes
n't mandate it. Most of the time, it won't matter, so don't create problems downstream. ChrisA [Steve Barnes] Good points above! I know that this discussion is about pip requires versioning but I would like to add one point were it is important to pin to __exact__ releases for

[Python-ideas] Re: python -m anomaly Was: quality of life improvements

2020-01-10 Thread Steve Barnes
lready exists, both for running scripts on the path using -m and scripts with arbitrary file names without -m. Have I missed some subtlety in your proposal? [Steve Barnes] I did notice one anomaly in the behaviour of python -m: taking your code structure above and using : > py -mzipfile -c

[Python-ideas] Re: more readable "if" for multiple "in" condition

2020-01-01 Thread Steve Barnes
rguments they are all tested for truth but if a single argument then it must be an iterable. Steve Barnes P.S. Happy New Year & RIP Python 2. -Original Message- From: Steven D'Aprano Sent: 01 January 2020 02:01 To: python-ideas@python.org Subject: [Python-ideas] Re: more

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-29 Thread Steve Barnes
From: David Mertz Sent: 29 December 2019 15:58 To: Steve Barnes Cc: Steven D'Aprano ; python-ideas Subject: Re: [Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?] On Sun, Dec 29, 2019, 10:51 AM Steve Barnes mailto:gadgetst...@live.co.uk>> wrote: I do have

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-29 Thread Steve Barnes
y to get a sNAN out as the result of any Decimal operation. Invalid operations will either return a quiet NAN, or raise. Either way, float or Decimal, the only way to get a sNAN in your data is to put it there yourself. Why not just raise at the point of inserting the ~~landmine~~ sNAN instead

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-28 Thread Steve Barnes
From: Andrew Barnert Sent: 28 December 2019 20:21 To: Steve Barnes Cc: Christopher Barker ; gu...@python.org; python-ideas Subject: Re: [Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?] On Dec 28, 2019, at 00:03, Steve Barnes mailto:gadgetst...@live.co.uk>>

[Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?]

2019-12-28 Thread Steve Barnes
Personally I still like the fundamental: def is_nan(num): “”” Test for NaN “”” return num != num So simple! From: Christopher Barker Sent: 28 December 2019 07:54 To: gu...@python.org Cc: python-ideas Subject: [Python-ideas] Re: Testing for NANs [was Re: Fix statistics.median()?] opps,

[Python-ideas] Re: Suggest having a mechanism to distinguish import sources

2019-11-09 Thread Steve Barnes
? perhaps by adding a level keyword argument to the __import__ built in. __import__ already has a 'level' argument. [Steve Barnes] To be honest this is the first that I have heard of __import__(level) but looking at the docs and help for 3.8 doesn’t read like what you describe below – m

[Python-ideas] Suggest having a mechanism to distinguish import sources

2019-11-07 Thread Steve Barnes
Hi, I hope that his hasn't been discussed to death in the past but I quite often encounter cases where developers have unwittingly created a file or directory that has a name clash with either a system import or a pip installed library import. This can be very confusing to new users! And, of co

[Python-ideas] Re: Stdlib Module

2019-07-15 Thread Steve Barnes
Just out of interest there must be something like this in venv - how else can it decide what to include in the virtual environment as copies or links? That would give the platform specific list. Steve Barnes -Original Message- From: Chris Angelico Sent: 16 July 2019 06:21 To: python

[Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default

2019-07-10 Thread Steve Barnes
Issue raised as bpo-37556 & a PR as #14701 Steve Barnes From: Brett Cannon Sent: 10 July 2019 22:06 To: Steve Barnes Cc: Python-Ideas Subject: Re: [Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default I'll also mention it's covered in the

[Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default

2019-07-10 Thread Steve Barnes
Brett, Can I suggest that it might be an idea to add the honouring of PY_PYTHON and PY_PYTHON2 environmental variables to the help text. This is the missing piece as far as I am concerned. Steve From: Brett Cannon Sent: 10 July 2019 18:41 To: Steve Barnes Cc: Python-Ideas Subject: Re

[Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default

2019-07-10 Thread Steve Barnes
fast & future proof (addressing Ben's concerns). -Original Message- From: Alex Walters Sent: 10 July 2019 07:23 To: 'Steve Barnes' ; 'Python-Ideas' Subject: RE: [Python-ideas] Suggestion: Windows launcher default to not using pre-releases by default I have

[Python-ideas] Suggestion: Windows launcher default to not using pre-releases by default

2019-07-08 Thread Steve Barnes
g to undertake the changes. Steve Barnes ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at h

Re: [Python-ideas] zipfile refactor and AES

2019-06-03 Thread Steve Barnes
One specific pain point with zipfile is that if you zip a directory that contains the target zip file you end up trying to add the target file to itself which leads to a rapidly growing archive. From: Python-ideas On Behalf Of Robert Collins Sent: 03 June 2019 21:12 To: Daniel Hillier Cc: Pyt

Re: [Python-ideas] Add a "week" function or attribute to datetime.date

2019-03-04 Thread Steve Barnes
If anybody is looking for such components then wx.DateTime (https://wxpython.org/Phoenix/docs/html/datetime_overview.html) it is derived from wxDateTime (https://docs.wxwidgets.org/3.1/classwx_date_time.html) and should support all of its methods including things like DST changes, etc., support

Re: [Python-ideas] PEP 8 update on line length

2019-02-18 Thread Steve Barnes
s because of line length, plus the issues already mentioned. / Anders [Steve Barnes] If you are getting to 40 spaces of indent, (for _most_ people that is 10 scope changes, e.g. fn then 9 levels of if), then you are already facing a major cognitive burden and should probably be refactoring.

Re: [Python-ideas] Discuss: what should statistics.mode do?

2019-02-18 Thread Steve Barnes
s, I mostly imagined that mode() would be used interactively, using the interpreter as a calculator.) Would changing the behaviour break your code? Note that this question is seperate from that of whether or not there should be a multimode function. [Steve Barnes] Can I suggest that one opti

Re: [Python-ideas] Consistency in naming [was Re: ...ALL CAPS]

2019-02-03 Thread Steve Barnes
nice to change it so that the > > class was DateTime. But changing it *now* is not free, it has real, > > serious costs which are probably greater than the benefit gained. > Why can’t we put “now” as a property of the module itself, reccomend that, and > formally deprecate but never

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-30 Thread Steve Barnes
On 30/09/2018 16:36, David Mertz wrote: > On Sun, Sep 30, 2018 at 11:31 AM Steve Barnes <mailto:gadgetst...@live.co.uk>> wrote: > > No complex can be converted to float without accessing either the real > or imag component. > > > Sure. Not in Python 3.7.

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-30 Thread Steve Barnes
On 30/09/2018 16:26, David Mertz wrote: > On Sun, Sep 30, 2018 at 11:17 AM Steve Barnes <mailto:gadgetst...@live.co.uk>> wrote: > > Note that my statements above had a single = i.e. > float(NaNAwareInt('nan')) produces float('nan

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-30 Thread Steve Barnes
On 30/09/2018 16:13, David Mertz wrote: > On Sun, Sep 30, 2018 at 11:01 AM Steve Barnes <mailto:gadgetst...@live.co.uk>> wrote: > > Adding inf & -inf would be nice but to do so we would need a better > name > than NaNAwareInt. > > > My placeho

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-30 Thread Steve Barnes
On 30/09/2018 15:48, Chris Angelico wrote: > On Mon, Oct 1, 2018 at 12:45 AM Anders Hovmöller wrote: >> But making any change to the basic types truth table is a big -1 from me. >> This seems like a Python 2-3 transition to me. >> > > Far FAR worse than anything that changed in Py2->Py3. > >

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-30 Thread Steve Barnes
On 30/09/2018 15:15, David Mertz wrote: > For similar reasons, I'd like an iInf too, FWIW.  It's good for an > overflow value, although it's hard to get there in Python ints (would > 'NaNAwareInt(1)/0' be an exception or iInf?).  Bonus points for anyone > who knows the actual maximum size of P

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-30 Thread Steve Barnes
On 30/09/2018 13:55, Steven D'Aprano wrote: > On Sun, Sep 30, 2018 at 12:09:45PM +0300, Serhiy Storchaka wrote: >> 30.09.18 04:07, Steven D'Aprano пише: >>> Telling people that they don't understand their own code when you don't >>> know their code is not very productive. >> >> I can't tell him w

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Steve Barnes
On 29/09/2018 09:56, Serhiy Storchaka wrote: > 29.09.18 11:43, Steve Barnes пише: >> On 29/09/2018 08:50, Serhiy Storchaka wrote: >>> Python is dynamically typed language. What is such processing that would >>> work with iNaN, but doesn't work with float('

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Steve Barnes
On 29/09/2018 14:00, Steven D'Aprano wrote: > On Sat, Sep 29, 2018 at 06:31:46AM +0000, Steve Barnes wrote: > >> One of the strengths of the IEEE float, (to set against its many >> weaknesses), > > o_O > > Since I'm old enough to (just barely) re

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Steve Barnes
On 29/09/2018 08:50, Serhiy Storchaka wrote: > 29.09.18 10:35, Steve Barnes пише: >> On 29/09/2018 08:24, Serhiy Storchaka wrote: >>> 29.09.18 09:31, Steve Barnes пише: >>>> I think that it should be relatively simple to extend the Python >>>> integer

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Steve Barnes
On 29/09/2018 08:24, Serhiy Storchaka wrote: > 29.09.18 09:31, Steve Barnes пише: >> I think that it should be relatively simple to extend the Python integer >> class to have a NaN flag, possibly by having a bit length of 0, and have >> it follow the same rules for the handl

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Steve Barnes
On 29/09/2018 08:18, Michael Selik wrote: > On Fri, Sep 28, 2018 at 11:32 PM Steve Barnes wrote: >> One of the strengths of the IEEE float, (to set against its many >> weaknesses), is the presence of the magic value NaN. Not a Number, or >> NaA, is especially useful in tha

Re: [Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-29 Thread Steve Barnes
On 29/09/2018 07:52, Nathaniel Smith wrote: > On Fri, Sep 28, 2018 at 11:31 PM, Steve Barnes wrote: >> One specific use case that springs to mind would be for Libraries such >> as Pandas to return iNaN for entries that are not numbers in a column >> that it has been told

[Python-ideas] Suggestion: Extend integers to include iNaN

2018-09-28 Thread Steve Barnes
One of the strengths of the IEEE float, (to set against its many weaknesses), is the presence of the magic value NaN. Not a Number, or NaA, is especially useful in that it is a valid value in any mathematical operation, (always returning NaN), or comparison, (always returning False). In functio

Re: [Python-ideas] Combine f-strings with i18n - How about using PEP 501?

2018-09-18 Thread Steve Barnes
On 18/09/2018 08:59, Hans Polak wrote: > >>> I don't see how this immediately helps the OP, who wants a *literal* >>> expression that automatically invokes the translation machinery as >>> well as the interpolation machinery. > Actually, no, I do not want the expression to be automatically > t

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-16 Thread Steve Barnes
On 16/09/2018 10:45, David Mertz wrote: > You have missed the use of *reductio ad absurdum* in my comment and > several others. This argument structure is one of the fundamental forms > of good logical reasoning, and shows nothing dismissive or insulting. > The specifics book titles I used we

Re: [Python-ideas] Keyword only argument on function call

2018-09-12 Thread Steve Barnes
On 12/09/2018 16:38, Steven D'Aprano wrote: > On Wed, Sep 12, 2018 at 03:58:25PM +0100, Jonathan Fine wrote: > >> My question is about correctly implementing of __params__ as a keyword >> identifier, with semantics as in Steve B's code snippet above. > > The semantics of Steve's code snippet a

Re: [Python-ideas] Keyword only argument on function call

2018-09-10 Thread Steve Barnes
On 10/09/2018 22:00, Ethan Furman wrote: > On 09/10/2018 12:52 PM, Chris Barker via Python-ideas wrote: > >> I've spent this whole thread thinking: "who in the world is writing >> code with a lot of spam=spam arguments? If you are transferring that >> much state in a function call, maybe you s

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-23 Thread Steve Barnes
On 24/08/2018 02:04, Mike Barnett wrote: > Wow, Thank you Steve! > > > This is exactly the kind of information I was hoping for!! > > > >> Acceptance for *what* precisely? > > That is a great question... you're right shoulda asked a specific question. > > I would like to see if become som

Re: [Python-ideas] Off topic: 'strike a balance' - second language English

2018-08-21 Thread Steve Barnes
On 21/08/2018 17:55, Jonathan Fine wrote: > Nick Loadholtes wrote (elsewhere, quoted in this thread - by me). > >> Make your docs work as hard as your code does. Clear examples will >> make your code stand out in a good way. > > With a bit more searching I found: > > https://www.reddit.com/r/

Re: [Python-ideas] Off topic: 'strike a balance' - second language English

2018-08-18 Thread Steve Barnes
On 18/08/2018 10:34, Jonathan Fine wrote: > Summary: I look at the phrase 'strike a balance' in different languages, > and rewrite some wikipedia text on accessibility. > > I found in https://en.wikipedia.org/wiki/Jargon#Accessibility_issues > === > There is a balance to be struck, as excessive

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-14 Thread Steve Barnes
On 14/08/2018 20:42, Michael Selik wrote: > > Good comparisons can be found in other fields: > * Driving -- brakes vs stoppers > * Sailing -- starboard vs right-side > * Medicine -- postprandial vs after-meal > * Biology -- dinosaur vs direlizard > While NOT wanting to start another fight I fe

Re: [Python-ideas] Add the imath module

2018-07-13 Thread Steve Barnes
Looking for some information on how long it has taken to generate large primes I stumbled across https://arxiv.org/ftp/arxiv/papers/1709/1709.09963.pdf which makes interesting reading. It concentrates on giving no false negatives (never saying n is not a prime when it is) but giving an increasi

Re: [Python-ideas] Add a __cite__ method for scientific packages

2018-06-28 Thread Steve Barnes
On 28/06/2018 00:00, Nathan Goldbaum wrote: > This is an interesting proposal. Speaking as a developer of scientific > software packages it would be really cool to have support for something > like this in the language itself. > > The software sustainability institute in the UK have written s

Re: [Python-ideas] Secure string disposal (maybe other inmutable seq types too?)

2018-06-23 Thread Steve Barnes
On 23/06/2018 06:21, Nathaniel Smith wrote: > On Fri, Jun 22, 2018 at 6:45 PM, Steven D'Aprano wrote: >> On Sat, Jun 23, 2018 at 01:33:59PM +1200, Greg Ewing wrote: >>> Chris Angelico wrote: Downside: You can't say "I'm done with this string, destroy it immediately". >>> >>> Also it w

Re: [Python-ideas] Allow filtered dir built in

2018-06-14 Thread Steve Barnes
On 14/06/2018 13:33, Steven D'Aprano wrote: > On Thu, Jun 14, 2018 at 09:27:05AM +0000, Steve Barnes wrote: > > [...] >> What I would like to suggest is extending the dir built-in to allow an >> optional filter parameter that takes fnmatch type wild card as an >&g

[Python-ideas] Allow filtered dir built in

2018-06-14 Thread Steve Barnes
Currently when working with interactive sessions using the dir() or dir(module) built in is incredibly useful for exploring what functionality is available in a module. (Especially the regrettable libraries or modules that add really valuable functionality but have no or limited docstrings). H

Re: [Python-ideas] Was `os.errno` undocumented?

2018-05-29 Thread Steve Barnes
On 29/05/2018 23:58, Guido van Rossum wrote: > Have we received complaints about other cases? Whenever this  breaks > code for which I am responsible I just blush and fix it, I don't > complain. Repeating the same warning typically just causes warning > fatigue rather than helping anyone. >

Re: [Python-ideas] String and bytes bitwise operations

2018-05-18 Thread Steve Barnes
On 18/05/2018 07:07, Greg Ewing wrote: > Steven D'Aprano wrote: >> But XORing bytes seems perfectly reasonable. Bytes are numbers, even >> if we display them as ASCII characters. > > Yep. Implement it for bytes, then the user can decode/encode > as appropriate for the application. > Personall

Re: [Python-ideas] Please consider skipping hidden directories in os.walk, os.fwalk, etc.

2018-05-09 Thread Steve Barnes
On 08/05/2018 15:53, Giampaolo Rodola' wrote: > > > On Tue, May 8, 2018 at 2:00 PM, David Mertz > wrote: > > I like the idea. I think an argument to os.walk() is the simplest > option for most users. But per some comments, "hidden" is actually > more subtle

[Python-ideas] Please consider skipping hidden directories in os.walk, os.fwalk, etc.

2018-05-07 Thread Steve Barnes
In a lot of uses of os.walk it is desirable to skip version control directories, (which are usually hidden directories), to the point that almost all of the examples given look like: import os for root, dirs, files in os.walk(some_dir): if 'CVS' in dirs: dirs.remove('CVS') # or .s

Re: [Python-ideas] A "local" pseudo-function

2018-04-28 Thread Steve Barnes
On 28/04/2018 04:34, Yury Selivanov wrote: > Hi Tim, > > This is interesting. Even "as is" I prefer this to PEP 572. Below are some > comments and a slightly different idea inspired by yours (sorry!) > > On Fri, Apr 27, 2018 at 10:41 PM Tim Peters wrote: > [..] >> As an expression, it's > >>

Re: [Python-ideas] Allow multiple imports from a package while preserving its namespace

2018-04-27 Thread Steve Barnes
On 27/04/2018 12:14, Nick Coghlan wrote: > On 27 April 2018 at 01:22, Serhiy Storchaka wrote: >> I think this special cases isn't special enough to introduce a special >> syntax. > > While I'm mostly inclined to agree, I do think it would be nice to > have a clean spelling for "ensure this modu

Re: [Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

2018-04-16 Thread Steve Barnes
> Here are the three most popular syntax options, and how each would be > explained: > > 1) "target := expr" ==> It's exactly the same as other forms of > assignment, only now it's an expression. > 2) "expr as name" ==> It's exactly the same as other uses of "as", > only now it's just grabbing t

Re: [Python-ideas] collections.Counter should implement __mul__, __rmul__

2018-04-15 Thread Steve Barnes
On 16/04/2018 06:07, Tim Peters wrote: > [Peter Norvig] >> For most types that implement __add__, `x + x` is equal to `2 * x`. >> >> That is true for all numbers, list, tuple, str, timedelta, etc. -- but not >> for collections.Counter. I can add two Counters, but I can't multiply one >> by a scal

  1   2   >