Re: [Python-ideas] Idea: Importing from arbitrary filenames

2018-04-16 Thread Paul Moore
On 16 April 2018 at 17:22, Nick Coghlan wrote: > If we're not covering explicit __path__ manipulation anywhere, we > should definitely mention that possibility. > https://docs.python.org/3/library/pkgutil.html#pkgutil.extend_path > does talk about it, but only in the context

Re: [Python-ideas] Rewriting file - pythonic way

2018-04-15 Thread Paul Moore
On 15 April 2018 at 11:22, Elazar wrote: > בתאריך יום א׳, 15 באפר׳ 2018, 13:13, מאת Serhiy Storchaka > ‏: >> Actually the reliable code should write into a separate file and replace >> the original file by the new file only if writing is successful. Or >>

Re: [Python-ideas] Rewriting file - pythonic way

2018-04-15 Thread Paul Moore
On 15 April 2018 at 10:49, Alexey Shrub wrote: > В Воскресенье, 15 апр. 2018 в 12:40 , Serhiy Storchaka > написал: >> >> If the problem is that you want to use a single line instead of three >> line, you can add a function > > > Yes, I think that single

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

2018-04-13 Thread Paul Moore
On 13 April 2018 at 16:13, Guido van Rossum wrote: > Regarding the precedence of :=, at this point the only acceptable outcome > for me is one where at the statement level, := and = can be used > interchangeably and will have the same meaning (except probably we wouldn't > allow

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

2018-04-12 Thread Paul Moore
On 11 April 2018 at 22:28, Chris Angelico wrote: > On Thu, Apr 12, 2018 at 1:22 AM, Nick Coghlan wrote: >> This argument will be strengthened by making the examples used in the >> PEP itself more attractive, as well as proposing suitable additions to >> PEP

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

2018-04-11 Thread Paul Moore
On 11 April 2018 at 19:05, David Mertz wrote: > How about this, Brendan? > > _, x1, x2 = (D := b**2 - 4*a*c), (-b + sqrt(D))/2, (-b - sqrt(D))/2 > > I'm not sure I love this, but I don't hate it. Seriously, how is this in any way better than D = b**2 - 4*a*c x1, x2 = (-b +

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

2018-04-11 Thread Paul Moore
On 11 April 2018 at 16:22, Nick Coghlan wrote: > Similar to my suggestion above, you may also want to consider making > this example a filtered comprehension in order to show the proposal in > its best light: > > results = [(x, y, x/y) for x in input_data if (y := f(x) )]

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

2018-04-11 Thread Paul Moore
On 11 April 2018 at 14:54, Chris Angelico wrote: > Sure, if you're just assigning zero to everything. But you could do > that with a statement. What about this: > > q = { > lambda: x := lambda y: z := a := 0, > } > > Yes, it's an extreme example, but look at all those colons

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

2018-04-11 Thread Paul Moore
On 11 April 2018 at 14:25, Chris Angelico wrote: > On Wed, Apr 11, 2018 at 10:23 PM, Clint Hepner wrote: >>> Differences from regular assignment statements >>> -- >>> >>> An assignment statement can assign to

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

2018-04-11 Thread Paul Moore
On 11 April 2018 at 13:23, Clint Hepner wrote: >># Even complex expressions can be built up piece by piece >>y = ((eggs := spam()), (cheese := eggs.method()), cheese[eggs]) > I find the assignments make it difficult to pick out what the final > expression looks

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

2018-04-11 Thread Paul Moore
On 11 April 2018 at 10:30, Chris Angelico wrote: > The PEP has kinda pivoted a bit since its inception, so I'm honestly > not sure what "original motivating use case" matters. :D I'm just > lumping all the use-cases together at the same priority now. Fair point, and reading

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-11 Thread Paul Moore
On 11 April 2018 at 04:41, Steven D'Aprano wrote: >> > But in a way that more intuitively expresses the intent of the code, it >> > would be great to have more options on the market. >> >> It's worth adding a reminder here that "having more options on the >> market" is pretty

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-10 Thread Paul Moore
On 10 April 2018 at 19:25, Peter O'Connor wrote: > Kyle Lahnakoski made a pretty good case for not using itertools.accumulate() > earlier in this thread I wouldn't call it a "pretty good case". He argued that writing *functions* was a bad thing, because the name of a

Re: [Python-ideas] Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2018-04-07 Thread Paul Moore
On 7 April 2018 at 08:44, Raymond Hettinger wrote: > Agreed that the "chain([x], it)" step is obscure. That's a bit of a bummer > -- one of the goals for the itertools module was to be a generic toolkit for > chopping-up, modifying, and splicing iterator streams

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-05 Thread Paul Moore
On 5 April 2018 at 22:26, Peter O'Connor wrote: > I find this a bit awkward, and maintain that it would be nice to have this > as a built-in language construct to do this natively. You have to admit: > > smooth_signal = [average = (1-decay)*average + decay*x for x

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-30 Thread Paul Moore
On 30 March 2018 at 06:17, Nick Coghlan wrote: > The fact that deep nesting of lexical scopes within an expression is > almost always going to be an unreadable mess in practice is one of the > reasons I don't think there's a strong case for either backwards > compatibility

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-29 Thread Paul Moore
On 29 March 2018 at 16:27, Nick Coghlan <ncogh...@gmail.com> wrote: > On 28 March 2018 at 04:47, Paul Moore <p.f.mo...@gmail.com> wrote: >> To me, that would be the ideal. I assume there are significant >> technical challenges, though, as otherwise I'd have thou

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-27 Thread Paul Moore
On 27 March 2018 at 19:43, Ethan Furman wrote: > On 03/27/2018 11:12 AM, Ivan Levkivskyi wrote: >> >> On 27 March 2018 at 18:19, Guido van Rossum wrote: > >>> Hm, so maybe we shouldn't touch lambda, but we can at least fix the scope >>> issues for comprehensions and genexprs.

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-27 Thread Paul Moore
On 27 March 2018 at 16:51, Joao S. O. Bueno wrote: > Well, there is an idiom to "keep everything as is", and work around > the current limitations: > > class A: >def b(): >x = 1 >d = [i + x for i in range(2)] >return locals() >

Re: [Python-ideas] Fixing class scope brainstorm

2018-03-27 Thread Paul Moore
On 27 March 2018 at 15:32, Joao S. O. Bueno wrote: > Yes - but that would be the intention of the code beign written as in > your example - > > class C: > x = 1 > f = staticmethod(lambda: print(x)) > > While, the classic behavior can be attained by

Re: [Python-ideas] In-place assignment for "boolean or"?

2018-03-26 Thread Paul Moore
See https://www.python.org/dev/peps/pep-0505/ On 26 March 2018 at 14:56, Cammil Taank wrote: > Given the arguments you've raised, I am now inclined to agree with you. > > However, for completeness of the discussion, I want to indicate the primary > intended use case: > >

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-24 Thread Paul Moore
On 24 March 2018 at 12:18, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Mar 24, 2018 at 11:06 PM, Paul Moore <p.f.mo...@gmail.com> wrote: >> On 24 March 2018 at 11:55, Chris Angelico <ros...@gmail.com> wrote: >>> On Sat, Mar 24, 2018 at 10:49 PM, Pa

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-24 Thread Paul Moore
On 24 March 2018 at 11:55, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Mar 24, 2018 at 10:49 PM, Paul Moore <p.f.mo...@gmail.com> wrote: >> On 24 March 2018 at 09:18, Chris Angelico <ros...@gmail.com> wrote: >>> Except that a list comprehension is imp

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-24 Thread Paul Moore
On 24 March 2018 at 09:49, Chris Angelico wrote: >> Of course we don't want to necessarily impose unreasonable performance >> and maintence costs on any implementation. But surely performance >> cost is a quality of implementation issue. It ought to be a matter of >> trade-offs:

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-24 Thread Paul Moore
On 24 March 2018 at 09:18, Chris Angelico wrote: > On Sat, Mar 24, 2018 at 8:07 PM, Christoph Groth > wrote: >> Chris Angelico wrote: >> >>> Thank you; both of these have now been incorporated into the document. >> >> Thanks! Just a small comment.

Re: [Python-ideas] New PEP proposal -- Pathlib Module ShouldContain All File Operations -- version 2

2018-03-23 Thread Paul Moore
On 23 March 2018 at 22:22, Mike Miller wrote: > > On 2018-03-23 13:47, Jason Maldonis wrote: >> >> I’ve found it odd that there doesn’t even seem to be acknowledgment >> among >> longtime python users that the current hodgepodge is pretty >> dysfunctional >>

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-03-23 Thread Paul Moore
On 23 March 2018 at 10:01, Chris Angelico wrote: > # ... except when function bodies are involved... > if (input("> ") as cmd): > def run_cmd(): > print("Running command", cmd) # NameError > > # ... but function *headers* are executed immediately

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations -- version 2

2018-03-18 Thread Paul Moore
On 18 March 2018 at 14:44, Barry Scott wrote: > It seems that the main quest to answer first is this. > > Should Path() have methods to access all file operations? No, (Counterexample, having a Path operation to set Windows ACLs for a path). > Maybe it was a mistake to

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations

2018-03-18 Thread Paul Moore
On 18 March 2018 at 04:41, Nathaniel Smith wrote: > My understanding is that the point of Path is to be a convenient, > pleasant-to-use mechanism for accessing common filesystem operations. > And it does a pretty excellent job of that. But it seems obvious to me > that it's still

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations -- version 2

2018-03-18 Thread Paul Moore
On 17 March 2018 at 22:49, George Fischhof wrote: >>> >>> * os.truncate >>> >>> * shutil.copyfileobj >>> >>> >>> This function does not take paths as arguments. I guess it does not belong >>> here. > > No path, it is true (right now), but it has sense to have this

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Paul Moore
On 14 March 2018 at 15:10, Robert Vanden Eynde wrote: > Indeed, linters are the place to go, but I think there is no > "official" linter (am I wrong ?), are pyflakes and pylint independant > projects ? Ironically, many of the places I see implicit concatenation

Re: [Python-ideas] Implicit string literal concatenation considered harmful?

2018-03-14 Thread Paul Moore
On 14 March 2018 at 15:34, Serhiy Storchaka wrote: > 10.05.13 21:48, Guido van Rossum пише: >> >> I just spent a few minutes staring at a bug caused by a missing comma >> -- I got a mysterious argument count error because instead of foo('a', >> 'b') I had written foo('a'

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Paul Moore
On 14 March 2018 at 14:22, Facundo Batista <facundobati...@gmail.com> wrote: > 2018-03-14 10:54 GMT-03:00 Paul Moore <p.f.mo...@gmail.com>: > >> Also, we need to consider the significant body of code that would >> break if this construct were prohibited. Even if we

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Paul Moore
On 14 March 2018 at 13:40, Søren Pilgård wrote: > We can't remove all potential pitfalls, but I do think there is value > in evaluating whether something has bigger potential to cause harm > than the benefits it brings, especially if there are other ways to do > the same.

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations

2018-03-12 Thread Paul Moore
On 12 March 2018 at 20:57, George Fischhof wrote: > Good day all, > > as it seemed to be a good idea, I wrote a PEP proposal for pathlib to > contain file operations. > > Here is the draft. What do you think about this? I don't know for certain what I think I feel about the

Re: [Python-ideas] An alternative to PEP 572's Statement-Local Name Bindings

2018-03-03 Thread Paul Moore
On 3 March 2018 at 07:45, Nick Coghlan wrote: > On 3 March 2018 at 11:36, Greg Ewing wrote: >> >> 1. Name bindings local to an expression: >> >>roots = ([(-b-r)/(2*a), (-b+r)/(2*a)] where r = sqrt(b*b-4*a*c)) >> >> B. In an expression,

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-02 Thread Paul Moore
On 2 March 2018 at 14:23, Nick Coghlan <ncogh...@gmail.com> wrote: > On 2 March 2018 at 23:26, Paul Moore <p.f.mo...@gmail.com> wrote: >> >> Adding "mustn't just be another way to spell name = expr" to the >> requirements is an extra requirement - and ar

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-02 Thread Paul Moore
On 2 March 2018 at 12:48, Nick Coghlan wrote: > The design intent related rationale stems from the fact that closed over > references can live for an arbitrarily long time (as can regular function > locals in a generator or coroutine), and I think statement locals should be >

Re: [Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

2018-03-02 Thread Paul Moore
On 2 March 2018 at 11:43, Chris Angelico wrote: > After dozens of posts and a wide variety of useful opinions and > concerns being raised, here is the newest version of PEP 572 for your > debating pleasure. This is a distinct improvement - thanks for incorporating the varied

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-02 Thread Paul Moore
On 2 March 2018 at 11:15, Nick Coghlan <ncogh...@gmail.com> wrote: > On 2 March 2018 at 19:05, Paul Moore <p.f.mo...@gmail.com> wrote: >> >> The problem with statement local variables is that the extent over >> which the name is in scope is not as clear

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-02 Thread Paul Moore
On 2 March 2018 at 05:08, Nick Coghlan <ncogh...@gmail.com> wrote: > On 1 March 2018 at 19:30, Paul Moore <p.f.mo...@gmail.com> wrote: >> >> Agreed. This feels far to much like Perl's "sigils" that attach to a >> name ($var is a scalar, @var is a list

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-01 Thread Paul Moore
On 28 February 2018 at 21:48, Robert Vanden Eynde wrote: > We are currently like a dozen of people talking about multiple sections of a > single subject. > > Isn't it easier to talk on a forum? Not for me, certainly. I could probably learn how to effectively work with a

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-02-28 Thread Paul Moore
On 28 February 2018 at 20:16, Alex Walters wrote: > For what its worth, I'm +1 on it. > > I actually like that it would allow: > > while (something() as var): > something_else(var) > > ...without being a bug magnet. The bug magnet isn't the assignment of a > name in

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-02-28 Thread Paul Moore
On 28 February 2018 at 19:41, Chris Angelico <ros...@gmail.com> wrote: > On Thu, Mar 1, 2018 at 3:30 AM, Paul Moore <p.f.mo...@gmail.com> wrote: > Here's another equally untested piece of code: > > [(-b + (sqrt(b*b - 4*a*c) as disc)) / (2*a), (-b - disc) / (2*a)] Yeah,

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-02-28 Thread Paul Moore
On 28 February 2018 at 13:45, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Feb 28, 2018 at 10:49 PM, Paul Moore <p.f.mo...@gmail.com> wrote: >> While there's basically no justification for doing so, it should be >> noted that under this proposal, 1 as x

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-02-28 Thread Paul Moore
On 28 February 2018 at 15:18, Chris Angelico wrote: >> a = (2 as a) >> >> there is a temporary variable 'a', which gets assigned 2, and the SLNB is >> evaluated as 2, which should then get assigned back to the local variable >> 'a'. In other words, the final print from

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-02-28 Thread Paul Moore
On 27 February 2018 at 22:27, Chris Angelico wrote: > This is a suggestion that comes up periodically here or on python-dev. > This proposal introduces a way to bind a temporary name to the value > of an expression, which can then be used elsewhere in the current > statement. >

Re: [Python-ideas] Temporary variables in comprehensions

2018-02-15 Thread Paul Moore
On 15 February 2018 at 05:56, fhsxfhsx wrote: > As far as I can see, a comprehension like > alist = [f(x) for x in range(10)] > is better than a for-loop > for x in range(10): > alist.append(f(x)) > because the previous one shows every element of the list explicitly so that >

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Paul Moore
On 7 February 2018 at 19:35, Steve Dower wrote: > Checking the Version (!=SysVersion) property should be enough (and perhaps > we need to set it properly on install). The launcher currently only works > with PythonCore entries anyway, so no need to worry about other

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Paul Moore
On 7 February 2018 at 14:57, Alex Walters <tritium-l...@sdamon.com> wrote: > > >> -Original Message----- >> From: Paul Moore [mailto:p.f.mo...@gmail.com] >> Sent: Wednesday, February 7, 2018 4:15 AM >> To: Alex Walters <tritium-l...@sdamon.com> &

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Paul Moore
On 7 February 2018 at 05:36, Alex Walters wrote: > While this thread has focused on the location and means of managing py.ini, > I think there is a more general solution that should be considered to the > original problem, as described. The problem isn't that it's

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-06 Thread Paul Moore
On 6 February 2018 at 15:23, Eric Fahlgren wrote: > Right, different planets, but orbiting the same star. I was thinking about > the consolidation of the Windows registry layout a year or two ago, don't > recall who spearheaded that (Steve Dower?). In any case, if the

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-06 Thread Paul Moore
PDATA. > If they were all in a common location (or the same file with separate > sections), that would make life a tiny bit easier. > > Eric > > On Tue, Feb 6, 2018 at 3:30 AM, Paul Moore <p.f.mo...@gmail.com> wrote: >> >> I'm reluctant to expand the feature set of the

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-06 Thread Paul Moore
I'm reluctant to expand the feature set of the launcher in this direction. It's written in C, and tightly focused on being a lightweight launcher. Adding code to manage user options and persist them to the py.ini file would be a non-trivial overhead, as well as being hard to maintain (because C

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-05 Thread Paul Moore
On 5 February 2018 at 08:10, Steve Barnes wrote: > When a new version of python is in alpha/beta it is often desirable to > have it installed for tests but remain on a previous version for day to > day use. > > However, currently the Windows py launcher defaults to the

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

2018-02-05 Thread Paul Moore
On 5 February 2018 at 06:40, Serhiy Storchaka wrote: > 05.02.18 05:01, Nick Coghlan пише: >> >> On 2 February 2018 at 16:52, Steven D'Aprano wrote: >>> >>> If it were my decision, I'd have these codecs raise a warning (not an >>> error) when used for

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Paul Moore
On 19 January 2018 at 18:19, Stefan Krah <ste...@bytereef.org> wrote: > On Fri, Jan 19, 2018 at 05:30:43PM +0000, Paul Moore wrote: > [cut] >> I'd think that the idea of a site-packages/stest directory would need >> a much more compelling use case to justify it. >

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Paul Moore
On 19 January 2018 at 17:08, Stefan Krah <ste...@bytereef.org> wrote: > On Fri, Jan 19, 2018 at 04:23:23PM +0000, Paul Moore wrote: >> Another common approach is to not ship tests as part of your (runtime) >> package at all - they are in the sdist but not the wheels nor

Re: [Python-ideas] Official site-packages/test directory

2018-01-19 Thread Paul Moore
Another common approach is to not ship tests as part of your (runtime) package at all - they are in the sdist but not the wheels nor are they deployed with "setup.py install". In my experience, this is the usual approach projects take if they don't have the tests in the package directory. (I don't

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

2018-01-16 Thread Paul Moore
On 16 January 2018 at 17:36, Sylvain MARIE wrote: > (trying with direct reply this time) > >> Why do you do this? What's the requirement for delaying evaluation of the >> condition? > > Thanks for challenging my poorly chosen examples :) > > The primary

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

2018-01-16 Thread Paul Moore
I fixed the reply-to this time, looks like you're still getting messed up by Google Groups. On 16 January 2018 at 16:25, smarie wrote: > Let's consider this example where users want to define on-the-fly one of the > validation functions, and combine it with

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

2018-01-16 Thread Paul Moore
Grr, Google Groups gateway messes up reply-to. Apologies to anyone who gets a double-post, please can posters ensure that reply-to is set to the list, and *not* to the Google Groups gateway? Thanks. Paul On 16 January 2018 at 15:54, Paul Moore <p.f.mo...@gmail.com> wrote: > On 16 Jan

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

2018-01-10 Thread Paul Moore
On 10 January 2018 at 04:16, Nick Coghlan wrote: > On 10 January 2018 at 13:56, Rob Speer wrote: >> One other thing I've noticed that's related to the WHATWG encoding list: in >> Python, the encoding name "windows-874" seems to be missing. The _encoding_

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

2018-01-10 Thread Paul Moore
On 10 January 2018 at 02:39, Nick Coghlan wrote: > For the coverage.py use case, an environment-based solution is also > genuinely helpful, since you typically can't modify subprocess > invocations just because the software is being tested. At the moment, > there are

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

2018-01-05 Thread Paul Moore
On 5 January 2018 at 08:12, Nick Coghlan wrote: > However, the issue then is that "python -M numpy" would just be a less > flexible alternative to a command like "python -C 'import numpy as > np'". For quick one-liners don't underestimate the value of avoiding punctuation:

Re: [Python-ideas] __intancehook__ special method

2017-12-26 Thread Paul Moore
On 26 December 2017 at 09:13, Yahya Abou 'Imran via Python-ideas wrote: > In a personnal project I feel the need (or the desire) to implement > something like this: > > assert isinstance(1, PositiveInteger) > assert not isinstance(-1, PositiveInteger) To me, this seems

Re: [Python-ideas] Support floating-point values in collections.Counter

2017-12-20 Thread Paul Moore
On 20 December 2017 at 03:09, Joel Croteau wrote: > Well here is some code I wrote recently to build a histogram over a weighted > graph, before becoming aware that Counter existed (score is a float here): > > from collections import defaultdict > > total_score_by_depth =

Re: [Python-ideas] a sorting protocol dunder method?

2017-12-04 Thread Paul Moore
On 4 December 2017 at 11:41, Steven D'Aprano wrote: > On Sun, Dec 03, 2017 at 10:48:18PM -0800, Carl Meyer wrote: >> I think this is an interesting idea, and I don't believe that either >> performance or "sortable vs comparable" are very relevant. > > Performance is always

Re: [Python-ideas] PEP 505 vs matrix multiplication

2017-12-01 Thread Paul Moore
On 1 December 2017 at 13:40, Nick Coghlan wrote: > I genuinely don't think these kinds of operators are all that useful > outside the specific domain of working with semi-structured > hierarchical data stored in graph databases and document stores like > MongoDB,

Re: [Python-ideas] How assignment should work with generators?

2017-12-01 Thread Paul Moore
ty, etc... Personally I don't think it's a significant enough benefit but I'm willing to be swayed if good enough arguments are presented (currently the "a, b, ... = value" syntax is my preferred proposal, but I don't think there's enough benefit to justify implementing it). > 2017-

Re: [Python-ideas] How assignment should work with generators?

2017-11-30 Thread Paul Moore
On 30 November 2017 at 16:16, Steve Barnes wrote: > I had a sneaky feeling that it did, which raises the question of what > the bleep this enormous thread is about, since the fundamental syntax > currently exists Essentially, it's about the fact that to build

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

2017-11-29 Thread Paul Moore
On 29 November 2017 at 12:41, Nick Coghlan wrote: > On 29 November 2017 at 22:38, Stephan Houben wrote: >> What about more English-like syntax: >> >> X or else Y > > The problem with constructs like this is that they look like they > should mean the same

Re: [Python-ideas] How assignment should work with generators?

2017-11-27 Thread Paul Moore
On 27 November 2017 at 21:54, Kirill Balunov <kirillbalu...@gmail.com> wrote: > 2017-11-27 19:23 GMT+03:00 Paul Moore <p.f.mo...@gmail.com>: > >> >> It should be reasonably easy >> to do a code search for something like "=.*islice", to find code >&

Re: [Python-ideas] How assignment should work with generators?

2017-11-27 Thread Paul Moore
On 27 November 2017 at 16:05, Chris Angelico wrote: > On Tue, Nov 28, 2017 at 2:35 AM, Steven D'Aprano wrote: >> In this case, there is a small but real benefit to counting the >> assignment targets and being explicit about the number of items to >> slice.

Re: [Python-ideas] Possible Enhancement to py.exe Python Launcher

2017-11-23 Thread Paul Moore
If I understand your proposal correctly, this is already possible, see https://www.python.org/dev/peps/pep-0397/#python-version-qualifiers The details are likely a little different than what you're proposing, but if they don't cover what you're trying to do, maybe you could give a more specific

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

2017-11-21 Thread Paul Moore
[Excuse any attribution errors, the quoting appears to have got badly messed up somehow] On 21 November 2017 at 06:21, Steve Barnes wrote: > > On 21/11/2017 00:32, Chris Barker wrote: >> I >> don't know what would be the best approach for adding copies/links of >>

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

2017-11-20 Thread Paul Moore
>> BTW -- does pip install a "pip3" on Windows? > > No. Just "pip.exe". Looks like I should have checked. As others pointed out, it does (pip3.exe and pip3.6.exe). Apologies. Paul ___ Python-ideas mailing list Python-ideas@python.org

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

2017-11-20 Thread Paul Moore
On 20 November 2017 at 21:59, Chris Barker wrote: > I don't understand any of this enough to have an opinion, so while I'd like > to see py.exe be renamed python.exe, let's not let "the perfect be the enemy > of good enough". So, if someone can make the case that they can

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

2017-11-17 Thread Paul Moore
On 17 November 2017 at 01:57, Nick Coghlan wrote: > On 17 November 2017 at 05:15, Chris Barker wrote: >> >> On Wed, Nov 15, 2017 at 11:07 AM, Steve Dower >> wrote: >>> >>> If you write such a PEP, please also research and write

Re: [Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

2017-11-16 Thread Paul Moore
My instinct is not to worry about it unless someone has actually hit the issue in practice and raised a bug. Paul On 16 November 2017 at 10:23, Serhiy Storchaka wrote: > Currently the re module ignores only 6 ASCII whitespaces in the re.VERBOSE > mode: > > U+0009

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

2017-11-16 Thread Paul Moore
On 16 November 2017 at 06:49, Nick Coghlan wrote: > On 16 November 2017 at 05:29, Zachary Ware > wrote: >> >> On Wed, Nov 15, 2017 at 1:07 PM, Steve Dower >> wrote: >> > My preferred solution for this is to rename

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

2017-11-15 Thread Paul Moore
On 15 November 2017 at 08:22, Nick Coghlan wrote: > On 15 November 2017 at 16:13, Steve Barnes wrote: >> >> - "pip -X[.Y][-32|-64] operation ..." tries to find a python matching >> -X[.Y][-32|-64] and if it succeeds executes "python -m pip operation

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

2017-11-14 Thread Paul Moore
On 14 November 2017 at 10:02, Nathaniel Smith <n...@pobox.com> wrote: > On Tue, Nov 14, 2017 at 12:56 AM, Paul Moore <p.f.mo...@gmail.com> wrote: >> On 14 November 2017 at 03:08, Nathaniel Smith <n...@pobox.com> wrote: >>> On Nov 13, 2017 6:47 PM, "

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

2017-11-14 Thread Paul Moore
On 14 November 2017 at 03:08, Nathaniel Smith wrote: > On Nov 13, 2017 6:47 PM, "Nick Coghlan" wrote: >> and a pip.bat with the equivalent contents on Windows? >> (Bonus: maybe this would fix the problem with upgrading pip on >> Windows?) > > Depending on how

Re: [Python-ideas] venv *is* provided in the standard Python install on Debian/Ubuntu

2017-11-12 Thread Paul Moore
On 12 November 2017 at 18:38, Antoine Pitrou <solip...@pitrou.net> wrote: > On Sun, 12 Nov 2017 12:20:45 +0000 > Paul Moore <p.f.mo...@gmail.com> wrote: >> >> > Well, not exactly. Do you do python -m venv, or py -x.x -m venv or >> > pythonx -m venv ? Wai

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

2017-11-12 Thread Paul Moore
On 12 November 2017 at 13:18, Nick Coghlan wrote: >> Seriously? Debian don't provide venv in the standard Python install? >> That's just broken. > > Yup. And RHEL/CentOS don't provide Python 3.x by default at all - you > need to grab it via other means. Wow. I have no problem

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

2017-11-12 Thread Paul Moore
On 12 November 2017 at 06:19, Michel Desmoulin wrote: >> 1. Go back to adding Python to PATH. Because our installers don't say >> "do you want to uninstall the old version", we should probably do a >> check for a "python" command on PATH in the installer, and if there

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

2017-11-10 Thread Paul Moore
On 10 November 2017 at 11:37, Oleg Broytman wrote: > On Fri, Nov 10, 2017 at 07:48:35AM +0100, Michel Desmoulin > wrote: >> On linux you >> can't pip install, you need --users, admin rights or a virtualenv. > >Isn't it the same on Windows? For an

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

2017-11-10 Thread Paul Moore
On 10 November 2017 at 10:01, Nick Coghlan <ncogh...@gmail.com> wrote: > On 10 November 2017 at 19:50, Paul Moore <p.f.mo...@gmail.com> wrote: >> On 10 November 2017 at 08:01, Nick Coghlan <ncogh...@gmail.com> wrote: >>> That tooling is venv: >>>

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

2017-11-10 Thread Paul Moore
On 10 November 2017 at 08:01, Nick Coghlan wrote: > You can't have it both ways - the only way we can systematically mask > the environmental differences between Windows, Linux and Mac OS X is > by providing tooling that actually masks those differences, which > means

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

2017-11-07 Thread Paul Moore
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!

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

2017-11-07 Thread Paul Moore
On 7 November 2017 at 13:06, אלעזר wrote: > On Tue, Nov 7, 2017 at 2:45 PM Nick Coghlan wrote: >> >> On 7 November 2017 at 03:52, Michel Desmoulin >> wrote: >> >> > And assume that stuff in any tutorial you make they know this

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

2017-11-07 Thread Paul Moore
On 7 November 2017 at 12:44, Nick Coghlan wrote: >> - make sure the system path is correctly set > > Recent python.org Windows installers do this automatically, but there > are unfortunately still lots of ways for things to go wrong. I believe the latest installers switch it

Re: [Python-ideas] Moving typing out of the stdlib in Python 3.7?

2017-11-05 Thread Paul Moore
On 5 November 2017 at 18:40, Antoine Pitrou wrote: > I think typing shouldn't require any extra typing (ha) on Unix either. > I don't remember what the rationale was for having to type > "python -m ensurepip" to get pip installed, but typing is just a > library, not an

Re: [Python-ideas] Moving typing out of the stdlib in Python 3.7?

2017-11-05 Thread Paul Moore
On 5 November 2017 at 14:47, Antoine Pitrou <anto...@python.org> wrote: > > Le 05/11/2017 à 14:30, Paul Moore a écrit : >> On 5 November 2017 at 10:48, Antoine Pitrou <solip...@pitrou.net> wrote: >>> On Sun, 5 Nov 2017 13:46:59 +1000 >>> Nick Coghlan &l

Re: [Python-ideas] Moving typing out of the stdlib in Python 3.7?

2017-11-05 Thread Paul Moore
On 5 November 2017 at 10:48, Antoine Pitrou wrote: > On Sun, 5 Nov 2017 13:46:59 +1000 > Nick Coghlan wrote: >> * ensurepip gains the ability to also install bundled wheel files > > Why? Why wouldn't you put the wheel directly in site-packages on >

Re: [Python-ideas] install pip packages from Python prompt

2017-10-30 Thread Paul Moore
On 30 October 2017 at 15:53, Antoine Pitrou wrote: > On Tue, 31 Oct 2017 01:44:10 +1000 > Nick Coghlan wrote: >> >> A few specific notes here: >> >> 1. As you say, this sort of already works in notebooks, since instructors >> can say to run "!pip install

Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-29 Thread Paul Moore
On 29 October 2017 at 20:44, Alex Walters wrote: > Writing scripts for non-developers, in an unmanaged environment (IT cant > push a python install to the system) on windows means running pyinstaller > et. al., on your script, if it has dependencies or not. Its not worth

Re: [Python-ideas] install pip packages from Python prompt

2017-10-29 Thread Paul Moore
On 29 October 2017 at 19:40, Stephan Houben wrote: > Hi Antoine, > > 2017-10-29 20:31 GMT+01:00 Antoine Rozo : >> >> Hi, >> >> What would be the difference with current pip module? >> pip.main(['install', 'some_package']) > > > > My understanding is

Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-29 Thread Paul Moore
On 29 October 2017 at 10:40, Stephan Houben wrote: > Perhaps slightly off-topic, but I have sometimes wondered if > pip could not be made somewhat friendlier for the absolute newbie > and the classroom context. > > Some concrete proposals. > > 1. Add a function `pip` to the

<    1   2   3   4   5   6   7   8   >