Re: Spread a statement over various lines

2019-09-18 Thread Wolfgang Maier
On 17.09.19 20:59, Manfred Lotz wrote: > I have a function like follows > > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ > .replace('%', '.') \ > .replace('*', '.*') > > return '^' + rfpat + '$' > > > As I don't want to

[issue34232] Python3.7.0 exe installers (32 and 64 bit) failing on Windows7

2018-07-31 Thread Wolfgang Maier
Wolfgang Maier added the comment: Oh, sorry, I didn't realize there was another file and it seems I did not keep it so I just ran the installer again to reproduce. Attached is the new pair of log files. -- Added file: https://bugs.python.org/file47722/Python 3.7.0 (64-bit

[issue34232] Python3.7.0 exe installers (32 and 64 bit) failing on Windows7

2018-07-31 Thread Wolfgang Maier
Change by Wolfgang Maier : Added file: https://bugs.python.org/file47723/Python 3.7.0 (64-bit)_20180731180657.log ___ Python tracker <https://bugs.python.org/issue34

[issue34232] Python3.7.0 exe installers (32 and 64 bit) failing on Windows7

2018-07-26 Thread Wolfgang Maier
Change by Wolfgang Maier : Added file: https://bugs.python.org/file47712/Python 3.7.0 (64-bit)_20180726120531.log ___ Python tracker <https://bugs.python.org/issue34

[issue34232] Python3.7.0 exe installers (32 and 64 bit) failing on Windows7

2018-07-26 Thread Wolfgang Maier
New submission from Wolfgang Maier : System: Windows7 Enterprise SP1 64-bit Downloaded the executable installer from python.org (tried both 32- and 64-bit -> same error) Selected the default user-install and got an almost immediate Error message: The TARGETDIR variable must be provided w

Re: Can pip install packages for all users (on a Linux system)?

2018-07-24 Thread Wolfgang Maier
On 24.07.2018 20:07, John Ladasky wrote: I've been using "sudo pip3 install" to add packages from the PyPI repository. I have multiple user accounts on the computer in question. My goal is to install packages that are accessible to all user accounts. I know that using the Synaptic Package

Re: 转发: No pip for my Python 3.6.5!

2018-07-09 Thread Wolfgang Maier
On 07/09/2018 10:14 AM, 卢 嘉幸 wrote: Hi~ I am a beginner with Python. My computer is of Windows version. And I dowloaded the lastest version of python on the https://www.python.org/ . My book, Automate the Boring Stuff With Python, teaches me to install a third-party module with the command

Re: Question : Input after all prompts in python

2018-06-11 Thread Wolfgang Maier
On 06/11/2018 04:19 PM, moha...@gmail.com wrote: BTW i tried the code above, but i encountered a syntax error. print(u"\u001b[{}A".format(n), flush=True, end="") ^ SyntaxError :invalid syntax That's probably because you have been running

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-16 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: Try to think of it this way: By choosing a default of True, every new project with subparsers that aims for Python <3.7 compatibility will have to take some measures (either overwrite the default or special

[issue24068] statistics module - incorrect results with boolean input

2018-04-08 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: Fixed as part of resolving issue 25177. -- resolution: -> fixed stage: test needed -> resolved status: open -> closed ___ Python tracker <rep...@bugs.

[issue25177] OverflowError in statistics.mean when summing large floats

2018-04-08 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: Steven's commit here also fixed issue 24068. -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: Actually, in Python2.7 random.choice is implemented with the same susceptibility to the rounding bug as Python3's choices, still nobody ever reported a tempfile IndexError problem (I

[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: sorry, should have been issue 24567, of course. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: @serhiy as I understand issue 33228, the double rounding problem potentially causing an IndexError can only affect choices() if the len of the sequence to choose from is greater than 2049, but the string in qu

[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- keywords: +patch pull_requests: +6093 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier
New submission from Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: A rather trivial change: tempfile._RandomNameSequence could make use of random.Random.choices introduced in 3.6. IMO, the suggested change would give clearer and also faster code. It also updates the doc

[issue33193] Cannot create a venv on Windows when directory path contains dollar character

2018-04-03 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: An exotic case, but it also affects Linux: python3.7 -m venv 'at$test' Error: Command '['/home/maier/at$test/bin/python3.7', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 2.

[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-03 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: @selik: it's true _randbelow doesn't work for negative numbers, but the difference is that both branches are affected, the docstring does not make any guarantees about it, and no public part of the random

[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-03 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: @rhettinger: the reason the ValueError gets raised correctly in the getrandbits-dependent branch is because getrandbits itself does a n<=0 check (in C for random.Random, in Python for random.SystemRandom). So

[issue33144] random._randbelow optimization

2018-04-01 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: ok, I've created issue 33203 to deal with raising ValueError in _randbelow consistently. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-01 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- keywords: +patch pull_requests: +6050 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33203] random.choice: raise IndexError on empty sequence even when not using getrandbits internally

2018-04-01 Thread Wolfgang Maier
New submission from Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: from https://docs.python.org/3/library/random.html#random.choice: Return a random element from the non-empty sequence seq. If seq is empty, raises IndexError. Indeed: >>> import random &g

[issue33144] random._randbelow optimization

2018-03-28 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: In addition, I took the opportunity to fix a bug in the original _randbelow in that it would only raise the advertised ValueError on n=0 in the getrandbits-dependent branch, but ZeroDivisionError in the pure

[issue33144] random._randbelow optimization

2018-03-28 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: So, the PR implements the behaviour suggested by Serhiy as his cases 1 and 2. Case 2 changes *existing* behaviour because before it was sufficient to have a user-defined getrandbits anywhere in the inheritanc

[issue33144] random._randbelow optimization

2018-03-28 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- pull_requests: +6015 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33144] random._randbelow optimization

2018-03-27 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: Thanks, Raymond. I'll do that once I've addressed Serhiy's points. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33144] random._randbelow optimization

2018-03-27 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: Serhiy: > I like the idea in general, but have comments about the implementation. > > __init_subclass__ should take **kwargs and pass it to > super().__init_subclass__(). type(cls.random) is not t

Re: please test the new PyPI (now in beta)

2018-03-27 Thread Wolfgang Maier
For me, that's a window width issue. The sidebar with the filters only shows when the window is wide enough. Unfortunately, the text mentioning it doesn't change, so this should be fixed. On 03/27/2018 12:06 PM, Steven D'Aprano wrote: On Tue, 27 Mar 2018 10:48:15 +0100, Paul Moore wrote:

[issue33144] random._randbelow optimization

2018-03-26 Thread Wolfgang Maier
New submission from Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: Given that the random module goes a long way to ensure optimal performance, I was wondering why the check for a match between the random and getrandbits methods is performed per call of Random._randbelow

Re: Entering a very large number

2018-03-23 Thread Wolfgang Maier
On 03/23/2018 01:30 PM, Wolfgang Maier wrote: On 03/23/2018 01:16 PM, ast wrote: Hi I found this way to put a large number in a variable. C = int( "28871482380507712126714295971303939919776094592797" "22700926516024197432303799152733116

Re: Entering a very large number

2018-03-23 Thread Wolfgang Maier
On 03/23/2018 01:16 PM, ast wrote: Hi I found this way to put a large number in a variable. C = int( "28871482380507712126714295971303939919776094592797" "22700926516024197432303799152733116328983144639225" "94197780311092934965557841894944174093380561511397"

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: _wants_ is a bit a strong word, but, at least, you can do a bit a nicer job than the default error, like printing a nicely formatted list of subcommands as you would get it with the main parsers help. In fact,

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: On 03/20/2018 04:38 PM, Anthony Sottile wrote: > > Anthony Sottile <asott...@umich.edu> added the comment: > > The intention of the change in issue 26510 was to pick the least surprising >

Re: curious asymmetry in range limiting

2018-03-20 Thread Wolfgang Maier
On 03/20/2018 03:21 PM, Robin Becker wrote: I don't know how I never came across this before, but there's a curious asymmetry in the way ranges are limited Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Wolfgang Maier
New submission from Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: I find the True default for 'required' quite cumbersome introduced as a result of issue 26510. With existing parsers it can unnecessarily break compatibility between Python3.x versions only to make porting

Re: Console

2018-03-07 Thread Wolfgang Maier
On 03/07/2018 03:41 PM, Jeremy Jamar St. Julien wrote: I had an problem when trying to start the python GUI. It said there was a subprocess startup error. I was told to start IDLE in a console with idlelib and see what python binary i was runnning IDLE with. Im using windows 10 and i guess

Re: Ways to make a free variable local to a function?

2018-03-06 Thread Wolfgang Maier
On 03/05/2018 07:44 PM, Terry Reedy wrote: On 3/5/2018 9:34 AM, Chris Angelico wrote: On Tue, Mar 6, 2018 at 12:52 AM, Terry Reedy wrote: On 3/5/2018 7:12 AM, Kirill Balunov wrote: # 1. By passing through local variable's default values def func_local_1(numb, _int =

Re: Is there are good DRY fix for this painful design pattern?

2018-02-27 Thread Wolfgang Maier
On 26.02.2018 15:41, Steven D'Aprano wrote: I have a class with a large number of parameters (about ten) assigned in `__init__`. The class then has a number of methods which accept *optional* arguments with the same names as the constructor/initialiser parameters. If those arguments are None,

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-09 Thread Wolfgang Maier
On 02/09/2018 12:23 PM, John Ladasky wrote: On Friday, February 9, 2018 at 12:50:16 AM UTC-8, Tim Golden wrote: Gmane offers a newsgroup interface to the mailing list I haven't visited GMane in a few years, but I found it difficult to navigate. In particular, I found searching to be

[issue31978] make it simpler to round fractions

2017-11-09 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: That, of course, wasn't my original suggestion, but since Mark started discussing other possible forms this could take, like round-to-nearest analogs of mod and divmod, I thought maybe it's worth pointi

[issue31978] make it simpler to round fractions

2017-11-09 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: >>> for x in range(1,501): for y in range(1,501): if round(x/y, 1) != float(round(F(x,y), 1)): print(x,y) where F is fractions

[issue31978] make it simpler to round fractions

2017-11-09 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: > (E.g., if both `a` and `b` are not-too-large integers, `round(a / b)` is > still "safe" in that it will give the same result as if a non-lossy integer > division is used.) Well, it does no

[issue31978] make it simpler to round fractions

2017-11-08 Thread Wolfgang Maier
Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> added the comment: ok, I agree with you that the returned type should not change with the value of an argument. I simply didn't think one vs two argument versions here, but in terms of three different code branches where one retur

[issue31978] make it simpler to round fractions

2017-11-08 Thread Wolfgang Maier
New submission from Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: Hi, because of floating point inaccuracies it is suboptimal to use round(int1/int2) for rounding of a fraction. fractions.Fraction, OTOH, offers exact rounding through its implementation of __round__, but

Re: replacing `else` with `then` in `for` and `try`

2017-11-02 Thread Wolfgang Maier
On 11/02/2017 06:09 PM, Skip Montanaro wrote: Eh, what can I say? I guess I was paying too much attention to the baseball game. Yes, "else" handles the "fall off the end" termination, not the "exit early" termination. My apologies. I do think that having a way to spell "do this when the loop

Re: A use-case for for...else with no break

2017-11-02 Thread Wolfgang Maier
On 11/02/2017 12:45 PM, Alberto Berti wrote: "Steve" == Steve D'Aprano writes: py> for x in "abcdefgh": Steve> ... print(x, end='') Steve> ... py> efghpy> Steve> "For ... else" to the rescue! py> for char in "abcdefgh":

Re: Code Snippets

2017-11-01 Thread Wolfgang Maier
On 01.11.2017 18:25, Stefan Ram wrote: I started to collect some code snippets: Sleep one second __import__( "time" ).sleep( 1 ) Get current directory __import__( "os" ).getcwd() Get a random number __import__( "random" ).random() And so on. You get the idea. However,

Re: matplot plot hangs

2017-11-01 Thread Wolfgang Maier
On 01.11.2017 00:40, Andrew Z wrote: hello, learning python's plotting by using matplotlib with python35 on fedora 24 x86. Installed matplotlib into user's directory. tk, seemed to work - http://www.tkdocs.com/tutorial/install.html#installlinux - the window shows up just fine. but when trying

[issue31756] subprocess.run should alias universal_newlines to text

2017-10-22 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: -wolma ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue14465] xml.etree.ElementTree: add feature to prettify XML output

2017-10-22 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue31756] subprocess.run should alias universal_newlines to text

2017-10-22 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue28286] gzip guessing of mode is ambiguous

2017-10-22 Thread Wolfgang Maier
Change by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

Re: Textwrap doesn't honour NO-BREAK SPACE

2017-09-29 Thread Wolfgang Maier
On 29.09.2017 11:05, Wolfgang Maier wrote: On 29.09.2017 07:25, Steve D'Aprano wrote: I'm pretty sure this is a bug. Yes, it is a bug, but a known one: https://bugs.python.org/issue20491 The fix got backported even to 3.5, but I guess it depends which minor version you are running. I'm

Re: Simple board game GUI framework

2017-09-12 Thread Wolfgang Maier
On 11.09.2017 12:58, Paul Moore wrote: I'm doing some training for a colleague on Python, and I want to look at a bit of object orientation. For that, I'm thinking of a small project to write a series of classes simulating objects moving round on a chess-style board of squares. I want to

Re: Proposed new syntax

2017-08-10 Thread Wolfgang Maier
On 08/10/2017 04:28 PM, Steve D'Aprano wrote: Every few years, the following syntax comes up for discussion, with some people saying it isn't obvious what it would do, and others disagreeing and saying that it is obvious. So I thought I'd do an informal survey. What would you expect this syntax

Re: Write this accumuator in a functional style

2017-07-11 Thread Wolfgang Maier
On 07/11/2017 08:11 AM, Steven D'Aprano wrote: I have a colleague who is allergic to mutating data structures. Yeah, I know, he needs to just HTFU but I thought I'd humour him. Suppose I have an iterator that yields named tuples: Parrot(colour='blue', species='Norwegian', status='tired and

[issue27268] Incorrect error message on float('')

2017-07-06 Thread Wolfgang Maier
Wolfgang Maier added the comment: Could somebody turn this into a PR to move things forward? I guess Nofar mistakenly set resolution to "works for me", but meant "patch works for me"? -- nosy: +wolma ___ Python tracker <

Re: Transitioning from Linux to Windows

2017-06-03 Thread Wolfgang Maier
On 03.06.2017 15:44, chitt...@uah.edu wrote: I am looking for suggestions, ideas. I have developed python (3.6.x, 2.7.x) scripts that run well as a user on an ubuntu/16.04 system - the scripts look for files, parses the files, assembles an output for the user. I first cd into a particular

Re: Python not able to find package but it is installed

2017-05-31 Thread Wolfgang Maier
On 05/30/2017 09:27 PM, Mahmood Naderan via Python-list wrote: Well yes. It looks in other folders But $ find /opt -name openpyxl /opt/rocks/lib/python2.6/site-packages/openpyxl So, your pip knows about a search path that python doesn't know. That can have a number of reasons still and one

Re: Python not able to find package but it is installed

2017-05-30 Thread Wolfgang Maier
On 05/30/2017 10:18 AM, Mahmood Naderan via Python-list wrote: Hello, Although I have installed a package via pip on a centos-6.6, python interpreter still says there is no such package! Please see the output below $ python exread2.py input.xlsx tmp/output Traceback (most recent call last):

[issue30413] Add fnmatch.filterfalse function

2017-05-22 Thread Wolfgang Maier
Wolfgang Maier added the comment: Yet another thing I just realized (sorry for being so annoying): With os.normcase calling os.fspath in 3.6+ it is not really a NOP anymore even on posix. As a consequence, you can now do some weird things with fnmatch: in all cases, and only in these, where

[issue30413] Add fnmatch.filterfalse function

2017-05-22 Thread Wolfgang Maier
Wolfgang Maier added the comment: > Good catch! It seems to me that they are redundant. Please open a new issue > for this. done: issue 30427 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30427] isinstance checks in os.path.normcase redundant with os.fspath

2017-05-22 Thread Wolfgang Maier
Wolfgang Maier added the comment: Just created a PR for this, which eliminates the redundancy. This also changes the error message (making it less specific), but not the type of a raised exception. If you think that the error message deserves to be preserved that could, of course, be done too

[issue30427] isinstance checks in os.path.normcase redundant with os.fspath

2017-05-22 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- pull_requests: +1803 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30427] isinstance checks in os.path.normcase redundant with os.fspath

2017-05-22 Thread Wolfgang Maier
New submission from Wolfgang Maier: os.path.normcase as defined in both posixpath and ntpath is now calling os.fspath on its argument first. With that I think the following isinstance(str, bytes) checks have become redundant since AFAIU os.fspath is guaranteed to return either str or bytes

[issue30413] Add fnmatch.filter_false function

2017-05-21 Thread Wolfgang Maier
Wolfgang Maier added the comment: @serhiy: my bad! I just hadn't realized this behavior of the original. With this requirement I cannot see any simpler solution than Steven's. Some other questions though to everyone involved: 1) what do you think about "os.path is posixpath" vs jus

[issue30413] Add fnmatch.filter_false function

2017-05-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: Does it? I thought it does so only if normalize_case is True. Did I miss something? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30413] Add fnmatch.filter_false function

2017-05-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: Hi, seems I had the same thoughts as you, Steven. I had started working on a patch independently yesterday, but after making my changes to fnmatch itself, I found I had too many other things to do to address unittests and doc changes to turn this into a real

[issue30307] https://docs.python.org/3/tutorial/introduction.html#strings Section 3.1.2 doc issue

2017-05-09 Thread Wolfgang Maier
Wolfgang Maier added the comment: The section is correct as it is. Just try it in the interactive interpreter to convince yourself. -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Wolfgang Maier
On 03.05.2017 17:11, Thomas Nyberg wrote: On 05/03/2017 11:04 AM, Daiyue Weng wrote: nope, I was thinking it might be good to update to 3.5.3 for security reasons? (CCing back in python-list since I accidentally dropped it.) I wouldn't worry about it. Package managers tend to usually take

[issue30152] Reduce the number of imports for argparse

2017-04-26 Thread Wolfgang Maier
Wolfgang Maier added the comment: @rhettinger: I do not quite understand this harsh reaction. Making argparse more responsive could, in fact, be quite a nice improvement. This is particularly true, I guess, if you want argument completion with a package like https://pypi.python.org/pypi

[issue30152] Reduce the number of imports for argparse

2017-04-24 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30097] Command-line option to suppress "from None" for debugging

2017-04-20 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

Re: Python 3.5+ Arrow keys and others in the console

2017-04-16 Thread Wolfgang Maier
On 16.04.2017 10:56, Vincent Vande Vyvre wrote: Hi, I'm using Python 3.5 and 3.6 in venv and I see a strange behaviour in the interactive interpreter. The arrow keys can't be used to move the cursor into the current line of code or to rewrite the last lines. With the 3.5 I can use the

[issue25478] Consider adding a normalize() method to collections.Counter()

2017-03-14 Thread Wolfgang Maier
Wolfgang Maier added the comment: > >>> Counter(red=11, green=5, blue=4).normalize(100) # percentage > Counter(red=55, green=25, blue=20) I like this example, where the normalize method of a Counter returns a new Counter, but I think the new Counter should always only have

[issue29258] __init__.py required for pkgutil.walk_packages in python3

2017-03-10 Thread Wolfgang Maier
Wolfgang Maier added the comment: > all that's required here is to eliminate the check for __init__.py from > pkgutil._iter_file_finder_modules Ok, I was exaggerating here. To do it right would require a more complex change, but that's all that's needed to get an estimate of the

[issue29258] __init__.py required for pkgutil.walk_packages in python3

2017-03-10 Thread Wolfgang Maier
Wolfgang Maier added the comment: While it is rather trivial to implement the proposed functionality - all that's required here is to eliminate the check for __init__.py from pkgutil._iter_file_finder_modules - this would have undesired impacts on, e.g., pydoc.apropos: This function would

[issue19821] pydoc.ispackage() could be more accurate

2017-03-09 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue17062] An os.walk inspired replacement for pkgutil.walk_packages

2017-03-09 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29258] __init__.py required for pkgutil.walk_packages in python3

2017-03-09 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29769] pkgutil._iter_file_finder_modules should not be fooled by *.py folders

2017-03-09 Thread Wolfgang Maier
New submission from Wolfgang Maier: The current implementation of _iter_file_finder_modules parses folders with a valid Python module extension as modules (e.g. it would report a *folder* xy.py as a module xy). As a result, e.g., pydoc.apropos('') fails if such a folder is found anywhere

[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2017-03-06 Thread Wolfgang Maier
Wolfgang Maier added the comment: Sorry, for generating noise on this very old issue, but was there a specific reason to duplicate the code of ImpImporter.find_module in changeset 9101eab6178c instead of factoring it out? -- nosy: +wolma ___ Python

[issue29710] Incorrect representation caveat on bitwise operation docs

2017-03-03 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29414] Change 'the for statement is such an iterator' in Tutorial

2017-02-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: > [...] I prefere the chapter as it currently is, because IMHO it > introduces the concepts more gradually than your proposal. That's ok! It's your PR and I only wanted to show an alternative. I was hoping for a bit more people to provide feedback

[issue29414] Change 'the for statement is such an iterator' in Tutorial

2017-02-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: I studied the github PR and thought about it carefully, and that made me come to believe that the chapter deserves a larger rewrite not just of one section, but of several. I'm attaching my proposed change as a "classical" patch here for discussio

Re: Disallowing instantiation of super class

2017-02-24 Thread Wolfgang Maier
On 24.02.2017 01:19, Irv Kalb wrote: Hi, I have built a set of three classes: - A super class, let's call it: Base - A class that inherits from Base, let's call that: ClassA - Another class that inherits from Base, let's call that: ClassB ClassA and ClassB have some code in their __init__

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Wolfgang Maier
On 15.02.2017 13:42, poseidon wrote: On 15/02/17 12:16, Wolfgang Maier wrote: On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py file

Re: PTH files: Abs paths not working as expected. Symlinks needed?

2017-02-15 Thread Wolfgang Maier
On 15.02.2017 10:33, poseidon wrote: In /usr/lib/python3.6/site-packages I wrote a file tau4.pth. It contains the line /home/poseidon/tau4/swr/py3/src In /home/poseidon/tau4/swr/py3/src there's an __init__.py file, so it should be possible to write import tau4 in my programs. No, that's

Re: subprocess problem

2017-02-09 Thread Wolfgang Maier
On 09.02.2017 01:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result Here is the code in short: def get_path_pandoc(): settings = QSettings('Pandoc',

Re: subprocess problem

2017-02-09 Thread Wolfgang Maier
On 09.02.2017 01:56, Andreas Paeffgen wrote: The Problem with the subprocess code is: Using the sourcecode functioning as normal. The frozen app with cx_freeze on every platform just returns an empty result Here is the code in short: def get_path_pandoc(): settings = QSettings('Pandoc',

Re: Rename file without overwriting existing files

2017-01-30 Thread Wolfgang Maier
On 01/30/2017 03:49 AM, Steve D'Aprano wrote: This code contains a Time Of Check to Time Of Use bug: if os.path.exists(destination) raise ValueError('destination already exists') os.rename(oldname, destination) In the microsecond between checking for the existence of the

[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2017-01-12 Thread Wolfgang Maier
Wolfgang Maier added the comment: I think PEP 538 extended to the UTF-8 locale *would* help here. Specifically, it would coerce only LC_CTYPE to en_US.UTF-8 (unless OS X has C.UTF-8), which I guess is good enough for the purpose here. I do agree that it is not the kind of problem that PEP 538

[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2017-01-12 Thread Wolfgang Maier
Wolfgang Maier added the comment: To me this issue seems quite related to PEP 538. Maybe the LC_CTYPE coercion proposed in the PEP could be extended to cover the case of LC_CTYPE=UTF-8? -- nosy: +ncoghlan versions: +Python 3.7 ___ Python tracker

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-06 Thread Wolfgang Maier
On 1/6/2017 15:04, Peter Otten wrote: Example: you are looking for the minimum absolute value in a series of integers. As soon as you encounter the first 0 it's unnecessary extra work to check the remaining values, but the builtin min() will continue. The solution is a minimum function that

[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError

2016-12-13 Thread Wolfgang Maier
Wolfgang Maier added the comment: What's the justification for this proposed change? Isn't it better to report the fact that there isn't an unambiguous result instead of returning a rather arbitrary one? -- nosy: +steven.daprano, wolma versions: +Python 3.7 -Python 3.5

[issue28859] os.path.mount sometimes raises FileNotFoundError on Windows

2016-12-02 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- nosy: +wolma ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue18971] Use argparse in the profile/cProfile modules

2016-12-01 Thread Wolfgang Maier
Wolfgang Maier added the comment: oops, typing in wrong window. Very sorry. -- nosy: +wolma title: calendar -> Use argparse in the profile/cProfile modules ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.or

[issue18971] calendar

2016-12-01 Thread Wolfgang Maier
Changes by Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de>: -- title: Use argparse in the profile/cProfile modules -> calendar ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue15533] subprocess.Popen(cwd) documentation

2016-11-29 Thread Wolfgang Maier
Wolfgang Maier added the comment: Just found issue15451, which reports a similar inconsistency between Windows and POSIX for 'PATH' provided through the Popen env parameter as for cwd. It seems that, on POSIX-platforms, the PATH environment variable passed through env affects the executable

[issue14845] list() != []

2016-11-29 Thread Wolfgang Maier
Wolfgang Maier added the comment: running with "-W always": >>> def five(x): ... for _ in range(5): ... yield x ... >>> F = five('x') >>> [next(F) for _ in range(10)] Traceback (most recent call last): File "", line 1, in File

  1   2   3   4   >