[Python-ideas] Ternary operators in list comprehensions

2017-10-05 Thread Jason H
>>> a = [1,2,3] >>> [ x for x in a if x & 1] [1, 3] >>> [ x for x in a if x & 1 else 'even'] File "", line 1 [ x for x in a if x & 1 else 'even'] ^ SyntaxError: invalid syntax I expected [1, 'even', 3] I would expect that the if expression would be able to

Re: [Python-ideas] Fwd: A PEP to define basical metric which allows to guarantee minimal code quality

2017-09-21 Thread Jason H
One of my hesitations on this topic is that it could create a false sense of security. And I mean security in both the 'comfortable with the code base' sense leading to insufficient testing, as well as 'we have a top-notch quality level, there are no vulnerabilities'. The one thing that I keep c

Re: [Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality

2017-09-20 Thread Jason H
> > How do we handle different organizational requirements? > > > By keeping linting out of the code ( and certainly out of "official" > python), and in the organization's development process where it > belongs. > > > @pylint([34]) > > @pep([8,20]) > > def f(a): > > return math.sqrt(a) > > Yeac

Re: [Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality

2017-09-20 Thread Jason H
> Quality is something that an organisation and its people need to achieve by > building appropriate processes and improvement methods into their work flow. > Trying to be prescriptive will run into trouble for the wider world I suspect. > > Many of the maintainability metrics may help a team. >

Re: [Python-ideas] Make map() better

2017-09-15 Thread Jason H
> Sent: Friday, September 15, 2017 at 12:24 PM > From: "Steven D'Aprano" > To: python-ideas@python.org > Subject: Re: [Python-ideas] Make map() better > > Jason, > > I'm sorry if you feel that everyone is piling on you to poo-poo your > ideas, but we've heard it all before. To you it might see

Re: [Python-ideas] Make map() better

2017-09-15 Thread Jason H
I'm going to respond to a few replies with this one. > > Because join apply on a string, and strings are defined by the str class, > > not by a specific protocol (unlike iterables). > > Join actually used to only be available as a function (string.join in > Python 2.x). However, nobody could eve

Re: [Python-ideas] Make map() better

2017-09-14 Thread Jason H
>> Why is it ','.join(iterable), why isn't there join(',', iterable)   > Because join apply on a string, and strings are defined by the str class, not > by a specific protocol (unlike iterables). Why? I can iterate over a string. [c for c in 'abc'] It certainly behaves like one... I'd say this

Re: [Python-ideas] Make map() better

2017-09-13 Thread Jason H
> Sent: Wednesday, September 13, 2017 at 3:57 PM > From: "Stefan Behnel" > To: python-ideas@python.org > Subject: Re: [Python-ideas] Make map() better > > Jason H schrieb am 13.09.2017 um 17:54: > > I'm rather surprised that there isn't a Iterabl

Re: [Python-ideas] Make map() better

2017-09-13 Thread Jason H
> Sent: Wednesday, September 13, 2017 at 11:23 AM > From: "Edward Minnix" > To: "Jason H" > Cc: Python-Ideas > Subject: Re: [Python-ideas] Make map() better > > While I agree that the method calling syntax is nicer, I disagree with > flippi

[Python-ideas] Make map() better

2017-09-13 Thread Jason H
The format of map seems off. Coming from JS, all the functions come second. I think this approach is superior. Currently: map(lambda x: chr(ord('a')+x), range(26)) # ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'

Re: [Python-ideas] Give nonlocal the same creating power as global

2017-09-11 Thread Jason H
> Sent: Monday, September 11, 2017 at 10:03 AM > From: "João Matos" > To: python-ideas@python.org > Subject: [Python-ideas] Give nonlocal the same creating power as global > > Hello, > > I would like to suggest that nonlocal should be given the same creating > power as global. > If I do > glob

Re: [Python-ideas] if as

2017-09-07 Thread Jason H
> Sent: Thursday, September 07, 2017 at 6:43 AM > From: "Denis Krienbühl" > To: python-ideas@python.org > Subject: [Python-ideas] if as > > Hi! > > I’ve been having this idea for a few years and I thought I finally see if > what others think of it. I have no experience in language design and

Re: [Python-ideas] PEP draft: context variables

2017-09-05 Thread Jason H
I am a relative nobody in Python, however a few weeks ago, I suggested more harmonization with JavaScript. Admittedly I've been doing more JS lately, so I might have JS-colored glasses on, but it looks like you're trying to add lexical scoping to Python, and there's a whole lot of manual scope w

Re: [Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Jason H
:57 AM > From: "Jason H" > To: python-ideas@python.org > Subject: [Python-ideas] Towards harmony with JavaScript? > > Before I done my firesuit, I'd like to say that I much prefer python and I > rail on JS whenever I can. However these days it is quite common to

[Python-ideas] Towards harmony with JavaScript?

2017-08-11 Thread Jason H
Before I done my firesuit, I'd like to say that I much prefer python and I rail on JS whenever I can. However these days it is quite common to be doing work in both Python and Javascript. Harmonizing the two would help JS developers pick up the language as well as people like me that are stuck w

[Python-ideas] Idea : for smarter assignment?

2017-07-21 Thread Jason H
I experimented with Python in college and I've been for close to 20 years now. (Coming and going as needed) I love the language. But there is one annoyance that I continually run into. There are basically two assignment operators, based on context, = and : a = 1 { a: 1 } They cannot be used