Re: [Python-ideas] Trigonometry in degrees

2018-06-07 Thread Robert Vanden Eynde
(...) make it clear and explicit. That's why I strongly discourage people defining their own "sin" function that'd take degrees, therefore I look for a new function name (sindeg). Le ven. 8 juin 2018 à 00:17, Hugh Fisher a écrit : > > Date: Thu, 7 Jun 2018 12:33:29 +

[Python-ideas] Trigonometry in degrees

2018-06-07 Thread Robert Vanden Eynde
I suggest adding degrees version of the trigonometric functions in the math module. - Useful in Teaching and replacing calculators by python, importing something is seen by the young students much more easy than to define a function. - Special values could be treated, aka when the angle is a mu

Re: [Python-ideas] datetime.timedelta literals

2018-06-05 Thread Robert Vanden Eynde
second, minute, hour (singular) timedelta objects in the module are a good idea, one could do 5 * minute to get a timedelta or one could do value / minute to get a float. a = datetime.now() b = datetime(2018, 2, 3) + 5 * minute print((a - b).total_seconds()) print((a - b) / minute) Le mar. 5 ju

Re: [Python-ideas] datetime.timedelta literals

2018-06-02 Thread Robert Vanden Eynde
What about 2.5*h - 14*min + 9300*ms * 2 where: h = timedelta(hours=1) min = timedelta (minutes=1) ms = timedelta (milliseconds=1) By the way "min" isn't a keyword, it's a standard function so it can be used as a variable name. However why be limited to time units ? One would want in certain ap

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Robert Vanden Eynde
ke such a thing, for .. in being the iteration. Le jeu. 24 mai 2018 à 18:22, Alexander Belopolsky < alexander.belopol...@gmail.com> a écrit : > > > On Thu, May 24, 2018 at 12:04 PM Robert Vanden Eynde > wrote: > > > This idea was mentioned (by me) at a time yes, but was

Re: [Python-ideas] Reuse "for" to express "given"

2018-05-24 Thread Robert Vanden Eynde
This idea was mentioned (by me) at a time yes, but wasn't written in the document. I think one of the thing was that it would make the grammar non LL1 because when seeing the token "for" in a list comprehension it wouldn't know in advance if it's the loop or the assignment. And also, it might con

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-05 Thread Robert Vanden Eynde
I agree it would be useful to have new keywords without being reserved, and we could even go with mechanism like infix operators created by user. It would allow things like [given for x in range(5) given given = x+1] or even [given for given in range(given) given given = given + 1] haha, but as ot

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

2018-04-29 Thread Robert Vanden Eynde
I really liked the syntax that mimicked lambda even if I find it verbose : a = local x=1, y=2: x + y + 3 Even if I still prefer the postfix syntax : a = x + 3 where x = 2 About scheme "let" vs "let*", the paralel in Python is : a, b, c = 5, a+1, 2 # let syntax a = 5; b = a+1; c = 2 # let* synt

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

2018-04-26 Thread Robert Vanden Eynde
I just ran into a similar problem, how to relatively import without binding the submodule. Let's say you have this : myapp/ urls.py views/ base.py When you're in urls.py and you want to relatively access Functions from base.py, you must use the from syntax. from .views import bas

Re: [Python-ideas] Dart like multi line strings identation

2018-03-31 Thread Robert Vanden Eynde
So yes, currently you just do : import textwrap print(textwrap.dedent(""" I am A Line """)) So you'd want a string litteral ? print(d""" I am A Line """) Le sam. 31 mars 2018 à 17:06, Ryan Gonzalez a écrit : > I have to admit, regardless of how practical this is, it would sur

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

2018-03-14 Thread Robert Vanden Eynde
+1 on general idea of discouraging it. > [...] mistakes like: > > fruits = { > "apple", > "orange" > "banana", > "melon", > } +1 > (and even making the static analysers, like pyflakes or pylint, to > show that as a warning) +1 > I agree that implicit concatenation is a bad feat

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

2018-03-14 Thread Robert Vanden Eynde
Le mer. 14 mars 2018 à 18:04, Carl Meyer a écrit : > On 3/14/18 8:03 AM, Guido van Rossum wrote: > > I use the feature regularly for long error messages, and when combined > > with .format() or % it's not so easy to replace it with a + (it would > > require adding parentheses). > > > > So I am ag

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

2018-03-14 Thread Robert Vanden Eynde
Le mer. 14 mars 2018 à 17:29, Paul Moore a écrit : > Ironically, many of the places I see implicit concatenation used are > where people need to work around linters complaining about line > lengths. I understand the benefits of projects that mandate code > passing lint checks, but I foresee seque

[Python-ideas] Adding shallow argument in filecmp.dircmp

2018-03-14 Thread Robert Vanden Eynde
In module filecmp, the normal functions cmp and cmpfiles do have a shallow attribute. But the dircmp class doesn't provide one, could we add it in the constructor ? In the implementation, it would only change the call to cmpfiles in def phase3 ? It could be useful for performance (same reason, th

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

2018-03-14 Thread Robert Vanden Eynde
Indeed, linters are the place to go, but I think there is no "official" linter (am I wrong ?), are pyflakes and pylint independant projects ? 2018-03-14 16:03 GMT+01:00 Guido van Rossum : > I use the feature regularly for long error messages, and when combined with > .format() or % it's not so eas

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

2018-03-14 Thread Robert Vanden Eynde
+1 on general idea of discouraging it. > [...] mistakes like: > > fruits = { > "apple", > "orange" > "banana", > "melon", > } +1 > (and even making the static analysers, like pyflakes or pylint, to > show that as a warning) +1 > I agree that implicit concatenation is a bad feat

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

2018-03-04 Thread Robert Vanden Eynde
> I know Guido is on record as not wanting to allow both "for name in > sequence" and "for name = expr" due to that being a very subtle distinction > between iteration and simple assignment (especially given that Julia uses > them as alternate spellings for the same thing), but I'm wondering if it

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

2018-03-04 Thread Robert Vanden Eynde
> What the heck, if it was good enough for PL/1... It would still be parsable indeed. A keyword available in a context would then be something new in the language. > Choice of syntax is important, though. It's all very well > to come up with an "insert syntax here" proposal that has > some big o

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

2018-03-04 Thread Robert Vanden Eynde
> Robert Vanden Eynde wrote: >> >> But I think that the implementation of print(y with y = x + 1) would >> be more close to next(y for y in [ x+1 ]) > > > WHy on earth should it be? Expanding that gives you a generator > containing a loop that only executes once t

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

2018-03-03 Thread Robert Vanden Eynde
Le 3 mars 2018 08:45, "Nick Coghlan" a écrit : 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, surrounded by parentheses for > disambiguation. Bindings are vis

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

2018-03-02 Thread Robert Vanden Eynde
The syntax you propose is already in the Alternate syntax and there is an implementation at https://github.com/thektulu/cpython/tree/where-expr Already discussed, but no conclusion, for me I see two different proposals, the "[y for x in range(5) with y = x+1]" in comprehensions list, and the case

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

2018-03-02 Thread Robert Vanden Eynde
Le 2 mars 2018 22:21, "Robert Vanden Eynde" a écrit : Le 2 mars 2018 22:13, "Chris Angelico" a écrit : On Sat, Mar 3, 2018 at 7:47 AM, Robert Vanden Eynde wrote: >> And please, don't top-post. Again, if your mail client encourages top >> posting, ei

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

2018-03-02 Thread Robert Vanden Eynde
Le 2 mars 2018 22:13, "Chris Angelico" a écrit : On Sat, Mar 3, 2018 at 7:47 AM, Robert Vanden Eynde wrote: >> And please, don't top-post. Again, if your mail client encourages top >> posting, either override it, or get a better one. > > @Chris @Rohdri (@Jonat

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

2018-03-02 Thread Robert Vanden Eynde
Le 2 mars 2018 22:03, "Ethan Furman" a écrit : On 03/02/2018 12:47 PM, Robert Vanden Eynde wrote: @Chris @Rohdri (@Jonathan below) > > For morons like me who didn't know what "top-posting" was, I went on > Wikipedia > (https://en.m.wikipedia.org/wiki/Posting

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

2018-03-02 Thread Robert Vanden Eynde
Le 2 mars 2018 21:02, "Chris Angelico" a écrit : On Sat, Mar 3, 2018 at 6:55 AM, Robert Vanden Eynde wrote: > @Rhodri, this is what Everybody does because you hit the "reply to all" > button, but, we don't receive two copies on the mail, I don't know why (

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

2018-03-02 Thread Robert Vanden Eynde
> 2018-03-02 7:03 GMT-08:00 Robert Vanden Eynde : > Guys, please don't email to me *and* the mailing list. Getting two copies of your deathless prose makes me less likely to pay attention to you, not more. -- Rhodri James *-* Kynesim Ltd

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

2018-03-02 Thread Robert Vanden Eynde
g same idea ? Cheers, Robert Le 28 févr. 2018 22:53, "Chris Angelico" a écrit : On Thu, Mar 1, 2018 at 8:38 AM, Robert Vanden Eynde wrote: > Le 28 févr. 2018 11:43, "Chris Angelico" a écrit : >> If you aren't using the variable multiple times, there's

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

2018-03-02 Thread Robert Vanden Eynde
+1 on extracting the big win for "if" and "while" (the regex case is wonderul). It would be see as an "extended if/while" rather than a general statement assignation. +1 on list comprehensions, even if I prefer the [(y, x/y) with y = f(x) for x in range(5)] or [(y, x/y) for x in range(5) with y =

Re: [Python-ideas] Medium for discussion potential changes to python (was: PEP 572: Statement-Local Name Bindings)

2018-02-28 Thread Robert Vanden Eynde
22:54 GMT+01:00 Alex Walters : > That should probably be its own thread > > > > *From:* Python-ideas [mailto:python-ideas-bounces+tritium-list=sdamon.com@ > python.org] *On Behalf Of *Robert Vanden Eynde > *Sent:* Wednesday, February 28, 2018 4:48 PM > *Cc:* python-ideas &

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

2018-02-28 Thread Robert Vanden Eynde
ts. Also, it's more interactive than email on a global list, people can talk to each other in parallel, if I want to answer about a mail that was 10 mail ago, it gets quickly messy. We could all discuss on a gist or some "Issues" thread on GitHub. 2018-02-28 22:38 GMT+01:00 Robert Vande

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

2018-02-28 Thread Robert Vanden Eynde
Le 28 févr. 2018 11:43, "Chris Angelico" a écrit : > It's still right-to-left, which is as bad as middle-outward once you > combine it with normal left-to-right evaluation. Python has very > little of this [..] I agree [] >> 2) talking about the implementation of thektulu in the "where =" p

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

2018-02-28 Thread Robert Vanden Eynde
True, but it's also extremely wordy. Your two proposed syntaxes, if I have this correct, are: 1) '(' 'with' EXPR 'as' NAME ':' EXPR ')' 2) '(' EXPR 'with' EXPR 'as' NAME ')' Of the two, I prefer the first, as the second has the same problem as the if/else expression: execution is middle-first. It

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

2018-02-27 Thread Robert Vanden Eynde
Hello Chris and Rob, did you compare your proposal tothe subject called "[Python-ideas] Temporary variables in comprehensions" on this month list ? If you don't want to go through all the mails, I tried to summarize the ideas in this mail : https://mail.python.org/pipermail/python-ideas/2018- Feb

Re: [Python-ideas] Temporary variables in comprehensions

2018-02-15 Thread Robert Vanden Eynde
re" syntax with the "where" keyword. [y+2 for x in range(5) where y = x+1] Also usable in any expression : print(y+2 where y = x+1) *Conclusion* Here is all the talk/work/argument I've already found about this syntax. Apparently it's been a while (2010) since such an id

<    1   2