Re: [Python-ideas] Syntax to import modules before running command from the command line

2018-01-09 Thread Ivan Pozdeev via Python-ideas
On 10.01.2018 0:54, Barry Warsaw wrote: Steve Barnes wrote: Currently invoking `python -c "some;separated;set of commands;"` will, if you need to use any library functions, require one or more import somelib; sections in the execution string. This results in rather complex "one liners". On the

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-09 Thread Ivan Pozdeev via Python-ideas
First of all, many thanks for such a excellently writen letter. It was a real pleasure to read. On 10.01.2018 0:15, Rob Speer wrote: Hi! I joined this list because I'm interested in filling a gap in Python's standard library, relating to text encodings. There is an encoding with no name of it

Re: [Python-ideas] Allow to compile debug extension against releasePython in Windows

2018-01-09 Thread Ivan Pozdeev via Python-ideas
On 09.01.2018 23:31, Barry Scott wrote: I not a user of distutils or setuptools but some googling seems to say that the build command has a --debug to do what you want. If that does not work it would seem like you could ask the setuptools maintainers how to do the reason thing of a debug build.

Re: [Python-ideas] Allow to compile debug extension against releasePython in Windows

2018-01-09 Thread Ivan Pozdeev via Python-ideas
On 09.01.2018 21:35, Ivan Pozdeev via Python-ideas wrote: On 08.01.2018 0:11, Steve Dower wrote: It’s not a good idea. You end up with two different C runtimes in memory that cannot communicate, and many things will not work properly. If you compile your debug build extension with the non

Re: [Python-ideas] Allow to compile debug extension against releasePython in Windows

2018-01-09 Thread Ivan Pozdeev via Python-ideas
ls and binaries. You can use a proper debug build against the debug binaries (python_d.exe). Cheers, Steve Top-posted from my Windows phone *From: *Ivan Pozdeev via Python-ideas <mailto:python-ideas@python.org> *Sent: *Saturday, December 30, 2017 13:01 *To: *python-ideas@python.org <mailto:

Re: [Python-ideas] [Python-Dev] subprocess not escaping "^" on Windows

2018-01-07 Thread Ivan Pozdeev via Python-ideas
On 07.01.2018 22:32, Christian Tismer wrote: Hi Chris, On 07.01.18 18:18, Chris Angelico wrote: Redirecting this part of the conversation to python-ideas. On Mon, Jan 8, 2018 at 3:17 AM, Christian Tismer wrote: As a side note: In most cases where shell=True is found, people seem to need eval

[Python-ideas] Allow to compile debug extension against release Python in Windows

2017-12-29 Thread Ivan Pozdeev via Python-ideas
The Windows version of pyconfig.h has the following construct:     if defined(_DEBUG)    pragma comment(lib,"python37_d.lib")     elif defined(Py_LIMITED_API)    pragma comment(lib,"python3.lib")     else    pragma comment(lib,"python37.lib")     endif /* _DEBUG */ which

Re: [Python-ideas] Repr of lambda

2017-12-17 Thread Ivan Pozdeev via Python-ideas
On 17.12.2017 22:20, Serhiy Storchaka wrote: Currently repr of doesn't contain much of information besides that it is a lambda. >>> lambda x: x**2 at 0x7f3479b74488> All lambdas have the same repr, different only by unreadable hexadecimal address. What if include the signature and the expr

Re: [Python-ideas] Add a dict with the attribute access capability

2017-12-01 Thread Ivan Pozdeev via Python-ideas
On 01.12.2017 1:19, Greg Ewing wrote: Ivan Pozdeev via Python-ideas wrote: I needed to hold an external function reference in an object instance (if I assigned it to an attribute, it was converted into an instance method). No, that only happens to functions stored in *class* attributes

Re: [Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?

2017-11-30 Thread Ivan Pozdeev via Python-ideas
On 29.11.2017 9:08, Steven D'Aprano wrote: On Tue, Nov 28, 2017 at 12:31:06PM -0800, Raymond Hettinger wrote: I also cc python-dev to see if anybody here is strongly in favor or against this inclusion. Put me down for a strong -1. The proposal would occasionally save a few keystokes but comes

Re: [Python-ideas] Add a dict with the attribute access capability

2017-11-30 Thread Ivan Pozdeev via Python-ideas
I use argparse.Namespace whenever I need this. In reply to Chris Barker's concern of "is this code or is this data", the last time I used it is when I needed to hold an external function reference in an object instance (if I assigned it to an attribute, it was converted into an instance method

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-28 Thread Ivan Pozdeev via Python-ideas
On 28.11.2017 20:23, Ethan Furman wrote On 11/28/2017 08:03 AM, Ivan Pozdeev via Python-ideas wrote: On 28.11.2017 16:36, Nick Coghlan wrote:    it doesn't need to be a statement any more > Another benefit of a statement vs function is only evaluating the error-related argume

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-28 Thread Ivan Pozdeev via Python-ideas
On 28.11.2017 16:36, Nick Coghlan wrote: On 28 November 2017 at 15:41, Steven D'Aprano wrote: On Tue, Nov 28, 2017 at 05:12:36AM +0300, Ivan Pozdeev via Python-ideas wrote: Unlike C, Python does the aforementioned checks all the time, i.e. it's effectively always in "debug mod

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-28 Thread Ivan Pozdeev via Python-ideas
results in two different interfaces. In normal mode, it enforces types while in -O, accepts anything that passes the duck test. Elazar בתאריך יום ג׳, 28 בנוב׳ 2017, 09:12, מאת Ivan Pozdeev via Python-ideas ‏mailto:python-ideas@python.org>>: On 28.11.2017 8:59, Steven D'Apran

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-27 Thread Ivan Pozdeev via Python-ideas
On 28.11.2017 8:59, Steven D'Aprano wrote: On Tue, Nov 28, 2017 at 07:35:45AM +0300, Ivan Pozdeev via Python-ideas wrote: Actually, the way I'm using them,     assert condition, "error message", type would probably be the most expressive way. I disagree that is exp

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-27 Thread Ivan Pozdeev via Python-ideas
On 28.11.2017 6:34, Ned Batchelder wrote: You are proposing:     assert condition, type, value Not specifically this, that's just an example. Actually, the way I'm using them,     assert condition, "error message", type would probably be the most expressive way. Why not just use Python a

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-27 Thread Ivan Pozdeev via Python-ideas
On 28.11.2017 5:19, Chris Angelico wrote: Actually, Python does have a way of disabling assertions (the -O flag), so they should be treated the same way they are in C. Assertions should not be used as shorthands for "if cond: raise Exc" in the general case. I'm claiming, and provided evidence, t

[Python-ideas] Repurpose `assert' into a general-purpose check

2017-11-27 Thread Ivan Pozdeev via Python-ideas
The `assert' statment was created the same as in previous languages like C/C++: a check to only do in debug mode, when you can't yet trust your code to manage and pass around internal data correctly. Examples are array bounds and object state integrity constraints. Unlike C, Python does the af

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-07 Thread Ivan Pozdeev via Python-ideas
On 08.11.2017 0:26, Paul Moore wrote: On 7 November 2017 at 20:38, Chris Barker wrote: On Tue, Nov 7, 2017 at 5:04 AM, Thomas Jollans wrote: As Ivan said earlier, perhaps the Windows installers should provide a "python3" executable, so "python3 -m pip" works everywhere. absolutely! I really,

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-07 Thread Ivan Pozdeev via Python-ideas
On 07.11.2017 23:38, Chris Barker wrote: with ensurepip, having pip no installed in a python is getting less common, so maybe this isn't needed anymore, but pip is problematic in environments that have their own package manager (i.e. anything but bare Windows) because it doesn't honor its c

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-07 Thread Ivan Pozdeev via Python-ideas
on why executables of Python proper cannot do the same. In fact, the reason why Windows version went Py instead of this seems to rather be to solve a completely different problem -- the filetype association (when running a script via ShellExecute, it autodetects which Python version to invoke).

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-07 Thread Ivan Pozdeev via Python-ideas
On 07.11.2017 16:11, Paul Moore wrote: It is, but like any such approach (Cygwin is similar, in principle if not in execution) that makes one OS "look like" another, whether it's appropriate is very dependent on circumstances. Training potential Windows developers in a bash/Ubuntu style environme

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-06 Thread Ivan Pozdeev via Python-ideas
On 07.11.2017 1:48, Chris Barker wrote: On Mon, Nov 6, 2017 at 9:52 AM, Michel Desmoulin mailto:desmoulinmic...@gmail.com>> wrote: I know and you still: - have to use py -m on windows, python3 linux, python in virtualenv... can't you use python3 -m pip install . everywhere? You

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-06 Thread Ivan Pozdeev via Python-ideas
On 06.11.2017 9:47, Michel Desmoulin wrote: Hello, Today I'm going to give a training in Python again. And again it will go the same way. On Mac I will have to make people install python, then tell them to use pip3. On Windows, I will have to warn them about checking the "add python executabl

Re: [Python-ideas] Python-ideas Digest, Vol 131, Issue 106

2017-10-30 Thread Ivan Pozdeev via Python-ideas
On 31.10.2017 8:37, python-ideas-requ...@python.org wrote: On Tue, Oct 31, 2017 at 3:50 PM, Ivan Pozdeev via Python-ideas wrote: On 30.10.2017 17:32, Guido van Rossum wrote: This is a key example of a case where code speaks. Can you write an implementation of how you would want single() to

Re: [Python-ideas] Add single() to itertools

2017-10-30 Thread Ivan Pozdeev via Python-ideas
On 30.10.2017 17:32, Guido van Rossum wrote: This is a key example of a case where code speaks. Can you write an implementation of how you would want single() to work in Python code? On Mon, Oct 30, 2017 at 2:49 AM, Ivan Pozdeev via Python-ideas mailto:python-ideas@python.org>>

[Python-ideas] Add processor generation to wheel metadata

2017-10-30 Thread Ivan Pozdeev via Python-ideas
Generally, packages are compiled for the same processor generation as the corresponding Python. But not always -- e.g. NumPy opted for SSE2 even for Py2 to work around some compiler bug (https://github.com/numpy/numpy/issues/6428). I was bitten by that at an old machine once and found out that t

Re: [Python-ideas] Add single() to itertools

2017-10-30 Thread Ivan Pozdeev via Python-ideas
On 30.10.2017 9:29, python-ideas-requ...@python.org wrote: If I have understood your use-case, you have a function that returns a list of results (or possibly an iterator, or a tuple, or some other sequence): print(search(haystack, needle)) # prints ['bronze needle', 'gold needle', '

[Python-ideas] Add single() to itertools

2017-10-29 Thread Ivan Pozdeev via Python-ideas
The eponymous C#'s LINQ method, I found very useful in the following, quite recurring use-case: I need to get a specific element from a data structure that only supports search semantics (i.e. returns a sequence/iterator of results). For that, I specify very precise search criteria, so only tha