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

2018-01-09 Thread Ivan Pozdeev via Python-ideas
. I just wrote, in https://mail.python.org/pipermail/python-ideas/2018-January/048579.html , that --debug is not sufficient, and that the problematic logic is in distutils, not setuptools. -- Regards, Ivan ___ Python-ideas mailing list Python-ideas

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

2018-01-09 Thread Ivan Pozdeev via Python-ideas
no name of its own. It's supported by every current web browser and standardized by WHATWG. It's so prevalent that if you ask a Web browser to decode "iso-8859-1" or "windows-1252", you will get this encoding _instead_. It is probably the second or third most commo

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 l

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

2018-01-26 Thread Stephane Wirtel via Python-ideas
es. Although I'm not a heavy pytest user (we use it exclusive at work, but I don't use it much with my own stuff), having __init__.py files can be useful, especially if you also have test data you want to access through pkg_resources, or now, importlib_resources (importlib.resources in Python

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

2018-02-27 Thread Rob Cliffe via Python-ideas
I hope nobody will mind too much if I throw in my (relatively uninformed) 2c before some of the big guns respond. First: Well done, Chris, for all the work on this.  IMHO this could be a useful Python enhancement (and reduce the newsgroup churn :-)). On 27/02/2018 22:27, Chris Angelico wrote

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

2018-02-27 Thread Rob Cliffe via Python-ideas
On 27/02/2018 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. Hm, apologies.  This is in

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

2018-02-28 Thread Rob Cliffe via Python-ideas
y to the LHS in the above example.  I realise that this is a vague statement that needs far more definition, but - hand-waving for now - do you think it would be difficult to change the implementation accordingly? Rob Cliffe _______ Python-ideas mailing l

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

2018-03-01 Thread Rob Cliffe via Python-ideas
("if", "while" etc.) remained in scope for the rest of that suite.  That seems (on balance) like a Good Thing, and a lot of the rationale for SLNBs.  But I didn't like a temporary variable applying to the LHS of as assignment.  So, with the above change to assignment st

Re: [Python-ideas] Class autoload

2018-03-03 Thread Rob Cliffe via Python-ideas
d for.     More maintainable: you only need to add or remove one line or two adjacent lines per instance, instead of two widely separated lines. (as long as you're happy to defer the imports, of course). Regards Rob Cliffe ___ Python-ideas maili

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

2018-03-15 Thread Rob Cliffe via Python-ideas
"d" ]).bar() Causing an error, not with the "d" expression you are working on but due to what you thought was the previous expression but python turns it into one. The , is seen as a delimiter by the programmer not as part of the operation (or the lack of the ,). You&#x

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

2018-03-24 Thread Rob Cliffe via Python-ideas
squares = [x**2 for x in iterable] In Python 2.x, you not only have to check whether or not you're already using "squares" for something, you also need to check whether or not you're using "x", since the iteration variable leaks. [...] For PEP 572, the most

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

2018-03-24 Thread Rob Cliffe via Python-ideas
t was presumably a reasonable one. Using SLNBs that don't leak into the surrounding local scope is ISTM a similar decision, and one that, if made, would be made for similar reasons. Rob Cliffe _______ Python-ideas mailing list Python-ideas@python

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

2018-03-26 Thread Rob Cliffe via Python-ideas
to sublocal scopes > -- just let it assign to a local variable in the containing scope. That's > the same as what Python does for for-loop variables. Note that for > comprehensions it still happens to do the right thing (assuming we interpret > the compr

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

2018-03-26 Thread Rob Cliffe via Python-ideas
On 26/03/2018 13:48, Cammil Taank wrote: Hi, I find a common idiom in Python is: x = x or 'some other value' This is highly reminiscent of the problem inplace operators solve. Would it be a good idea to consider an inplace operator for this, perhaps: x or= 'some other va

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

2018-03-27 Thread Rob Cliffe via Python-ideas
(and currently is for comprehensions and generator expressions). The standard reply here is that if you can't tell at a glance whether that's the case, your code is too complex. The Zen of Python says "Namespaces are one honking great idea -- let's do more of those!&qu

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

2018-03-27 Thread Rob Cliffe via Python-ideas
On 28/03/2018 01:19, Steven D'Aprano wrote: On Wed, Mar 28, 2018 at 12:08:24AM +0100, Rob Cliffe via Python-ideas wrote: On 27/03/2018 16:22, Guido van Rossum wrote: The standard reply here is that if you can't tell at a glance whether that's the case, your code is too comp

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

2018-03-31 Thread Rob Cliffe via Python-ideas
quot;rF" | "Rf" | "RF" New unordered 'd' and 'D' prefixes, for 'dedent', applied to multiline strings only, would multiply the number of alternatives by about 5 and would require another rewrite of all code (Python or not) that parses Python cod

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

2018-04-26 Thread Julian DeMille via Python-ideas
intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman

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

2018-04-26 Thread Julian DeMille via Python-ideas
Some library authors get pretty pissy about implicit imports at the root On Thu, Apr 26, 2018, 09:37 Paul Moore wrote: > On 26 April 2018 at 14:29, Julian DeMille via Python-ideas > wrote: > > I personally would like a feature where instead of doing `from ... import > > ...`

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

2018-04-26 Thread Julian DeMille via Python-ideas
> On 26 April 2018 at 14:29, Julian DeMille via Python-ideas > > wrote: > >> I personally would like a feature where instead of doing `from ... > import > >> ...` (which imports the specified items into the current namespace), one > >> could use something a

Re: [Python-ideas] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-05 Thread Rob Cliffe via Python-ideas
n args))('x','y','z') >>> print(x, y, z) (43, 55, 0) >>> Rob Cliffe _______ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

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

2018-05-11 Thread Rob Cliffe via Python-ideas
we should optimize for keyboard coding over voice chat coding. And when I need to refer to it, I say "this bit here" or I copy paste it. ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code

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

2018-05-13 Thread Rob Cliffe via Python-ideas
into a given statement.  Now, where do you up the parentheses? given (     a = (f(),),     b = whatever? ) Seems weird. Cheers, Cameron Simpson mailto:[email protected]>> ___ Python-ideas mailing list [email protected] <mailto:Python-ideas@pytho

Re: [Python-ideas] Crazy idea: allow keywords as names in certain positions

2018-05-13 Thread Rob Cliffe via Python-ideas
nostalgically about the old days of Fortran (sorry, FORTRAN), which doesn't (didn't?) have reserved words at all (nor significant whitespace, apart from the "start in column 7" rule). Anyway, just throwing this out. Please tear it apart! Thanks. :-) -- --Guido van Rossu

Re: [Python-ideas] Crazy idea: allow keywords as names in certain positions

2018-05-13 Thread Rob Cliffe via Python-ideas
n my unsubstantiated opinion not by very much; I suspect that most of the time an identifier is used in a module, it is used at least once in contexts where it would still be a SyntaxError if it were a keyword. Rob Cliffe ___ Python-ideas maili

Re: [Python-ideas] Crazy idea: allow keywords as names in certain positions

2018-05-13 Thread Rob Cliffe via Python-ideas
orator, immediately after '@' (the only keyword that's *syntactically* legal here is 'not', though I'm not sure it would ever be useful). Please, imagine how you would write the documentation to explain this. Then, pl

Re: [Python-ideas] Crazy idea: allow keywords as names in certain positions

2018-05-13 Thread Rob Cliffe via Python-ideas
On 14/05/2018 02:28, Greg Ewing wrote: Rob Cliffe via Python-ideas wrote:     def and(x, y):     return ... #   and(1,2)   #  Oops, SyntaxError.  Oh, I know:     globals()['and'](1,2)    # Works! If the rule I proposed for "import" were extended to "

Re: [Python-ideas] Sorry for yet another self discussion

2018-05-14 Thread Chris Barker via Python-ideas
te of self, even though it looks like it is. -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.

Re: [Python-ideas] High Precision datetime

2018-05-14 Thread Chris Barker via Python-ideas
-) -CHB > On the other hand, nanoseconds are slowly making their way to the stdlib > and to add nanoseconds to datetime we only need a fully backward compatible > implementation, not even a PEP. > > See <https://bugs.python.org/issue15443>. > ______

Re: [Python-ideas] High Precision datetime

2018-05-17 Thread Chris Barker via Python-ideas
r Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Python-ideas mai

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-17 Thread Chris Barker via Python-ideas
would still require people to change their code when a new keyword was introduced * It would be no easier / harder than adding a conventional legal character -- trailing underscore, or ??? * but now the changed code would no longer run on older versions of python. I guess it comes down to why you&#x

Re: [Python-ideas] __dir__ in which folder is this py file

2018-05-17 Thread Chris Barker via Python-ideas
Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] High Precision datetime

2018-05-17 Thread Chris Barker via Python-ideas
t mean that it DOES support leap seconds -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _

Re: [Python-ideas] Syntactic Sugar: Post-Conditions for Guard Clauses

2018-05-17 Thread Chris Barker via Python-ideas
On Thu, May 17, 2018 at 12:55 PM, Manuel Barkhau wrote: > continue if not is_valid(elem) > ... > how is this better than: if not is_valid(elem): continue ? But even if it is, that might be a consideration for a new language, but adding it to pyth

Re: [Python-ideas] High Precision datetime

2018-05-17 Thread Chris Barker via Python-ideas
now we really have gotten OT... But thanks! that was my question! -CHB Alexander covered the Python part of this, so I'll answer the possible > higher-level question: we haven't yet needed a "negative" leap > second, and it's considered unlikely (but not

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-17 Thread Rob Cliffe via Python-ideas
On 16/05/2018 10:12, Stephan Houben wrote: Hi all, One problem already alluded to with the \identifier syntax is that it only works if the old Python version is sufficiently recent to understand \. What about using parentheses to allow a keyword to be used as an identifier: (where)(x, y

Re: [Python-ideas] String and bytes bitwise operations

2018-05-18 Thread Chris Barker via Python-ideas
d OR and XOR would be the same, but bit shifting would be different. And then what do you do if the two bytes objects are not the same length? If "elementwise", then we should think carefully about that -- no where else does Python do things elementwise in the standard library -- and we

Re: [Python-ideas] Make keywords KEYwords only in places they would have syntactical meaning

2018-05-19 Thread Rob Cliffe via Python-ideas
ties, e.g. would     - - - - evaluate to     (- -) - (-) # -42 or     (-) - (- -) # +42 or     - ( - ( - ( - ))) # -21 or     - (- - -) # 0 and indeed     + + + + + could *in theory* evaluate to     + ( + ( + ( + ( + # 23 or     (++) + (++) # 46 but I'm sure we could formulate some sensible rules to always get

Re: [Python-ideas] String and bytes bitwise operations

2018-05-21 Thread Chris Barker via Python-ideas
On Sat, May 19, 2018 at 6:52 AM, Steven D'Aprano wrote: > Philosophical arguments about the nature of computer memory aside, byte > objects in Python are collections of ints. > not when you start talking about bit-wise operations :-) If a "byte" in python was an int

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

2018-05-22 Thread Julian DeMille via Python-ideas
ke it should be a good > idea, but it leads to more problems than it solves. > > -- > Greg > ___ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org

Re: [Python-ideas] Make asyncio.get_event_loop a builtin

2018-05-22 Thread Chris Barker via Python-ideas
er with seems kinda pointless -- why not import the one you want? -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.b

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

2018-05-25 Thread Rob Cliffe via Python-ideas
On 24/05/2018 16:54, Alexander Belopolsky wrote: I have read most of the PEP 572 related threads, but I don't think I've seen this idea.  As many other people mentioned, Python already allows a trick to introduce local bindings in generator expressions and list comprehensions.  T

Re: [Python-ideas] ternary without else

2018-05-25 Thread Rob Cliffe via Python-ideas
ple:     if cond: do_something Rob Cliffe ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

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

2018-05-30 Thread Rob Cliffe via Python-ideas
n could be done separately:     a = 0     a_list = [g( a:=f(a, x) ) for x in x_gen] Rob Cliffe ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] datetime.timedelta literals

2018-06-04 Thread Chris Barker via Python-ideas
terals...] -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] __

Re: [Python-ideas] datetime.timedelta literals

2018-06-04 Thread Chris Barker via Python-ideas
ds minutes hours days to the datetime module, and then we could write: 60*seconds == 1*minutes Without any changes to the language at all. -CHB > > > - Pål > > ___ > Python-ideas mailing list > [email protected] &g

Re: [Python-ideas] datetime.timedelta literals

2018-06-04 Thread Rob Cliffe via Python-ideas
On 04/06/2018 19:50, Kyle Lahnakoski wrote: Maybe the Python parser can be made to add an implied multiplication between a-number-followed-directly-by-a-variable-name. If so, then I could write: (2.5HOUR - 14MINUTE + 9300MILLISECOND).total_seconds() This strikes me as quite a nifty

Re: [Python-ideas] datetime.timedelta literals

2018-06-04 Thread Chris Barker via Python-ideas
gt; > Without any changes to the language at all. > > This strikes me as more of a personal/team style issue, so probably > fits better as local definitions in a project's "utilities" module. > probably, yes -- that's why I'm not going to push for it. But th

Re: [Python-ideas] Add dict.append and dict.extend

2018-06-05 Thread Chris Barker via Python-ideas
different, because python dicts have a way to of spelling it that's really pretty straightforward, performant and robust. However, .setdefault() is essentially a replacement for: if key in a_dict: value = a_dict(key) else: a_dict[key] = default_value value = default_value or a simi

Re: [Python-ideas] Add dict.append and dict.extend

2018-06-05 Thread Chris Barker via Python-ideas
_something_else else: my_dict[key] = val the same amount of code and I think the explicit check is clearer Also -- seems kind of odd to raise a KeyError when the key IS there?!? -CHB > > -- > Steve > ___ > Python-idea

Re: [Python-ideas] Making Path() a built in.

2018-06-05 Thread Chris Barker via Python-ideas
On Tue, Jun 5, 2018 at 4:42 PM, Steven D'Aprano wrote: > This is a quick and dirty survey of my code: > > [steve@ando python]$ grep Path *.py */*.py */*/*.py | wc -l > 21 > [steve@ando python]$ grep "enumerate(" *.py */*.py */*/*.py | wc -l > 307 > [steve@a

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-10 Thread Chris Barker via Python-ideas
On Sun, Jun 10, 2018 at 11:26 AM, Robert Vanden Eynde < [email protected]> wrote: > I agree that a big python library is more close to the standard python lib > than matlab. However, helping transition from matlab is a great concern in > the python scientific community,

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-11 Thread Chris Barker via Python-ideas
't want to use degrees with the regular one... -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@no

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-11 Thread Chris Barker via Python-ideas
ith trig functions ? -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-11 Thread Chris Barker via Python-ideas
079632679 -inf 1.57079632679 -inf 1.57079632679 -2.61194216074e+15 1.57079632679 -2.61194216074e+15 You'd want to tweak that tolerance value to be as small as possible, and do somethign to make it more symmetric, but you get the idea. The goal is that if you have an input that

Re: [Python-ideas] Operator for inserting an element into a list

2018-06-14 Thread Chris Barker via Python-ideas
nographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______ Python-ideas mailing list Python-ide

Re: [Python-ideas] Allow filtered dir built in

2018-06-14 Thread Rob Cliffe via Python-ideas
or x in dir(SomeObject) if        ] Rob Cliffe _______ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-18 Thread Chris Barker via Python-ideas
es it? Or has someone? Anyone looked? -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___

[Python-ideas] list configuration

2018-06-28 Thread Chris Barker via Python-ideas
Hey all, I've been replying to messages lately, and getting a bounce back: """ Hello [email protected], We're writing to let you know that the group you tried to contact (python-ideas) may not exist, or you may not have permission to post messages to the group. A fe

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Chris Barker via Python-ideas
27;, 'Jane'], 'SchoolC': ['Nancy']} -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Rob Cliffe via Python-ideas
Why not write a helper function?  Something like def group_by(iterable, groupfunc, itemfunc=lambda x:x, sortfunc=lambda x:x): # Python 2 & 3 compatible!     D = {}     for x in iterable:     group = groupfunc(x)     D[group] = D.get(group, []) + [itemfunc(x)]     if sortfunc is

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Chris Barker via Python-ideas
pher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______ Python-idea

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Chris Barker via Python-ideas
d = collections.defaultdict(lambda: [].append) >> for item in seq: >> d[key(item)](item) >> rv = {} >> for k, v in iteritems(d): >> rv[k] = v.__self__ >> return rv >> """ >> >> If you're willing to install Pandas (and

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Chris Barker via Python-ideas
y=list, student) for school, student in student_school_list } But I can't think of an reasonable syntax to make that work. -CHB > > -- > Greg > > _______ > Python-ideas mailing list > [email protected] > https://m

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Chris Barker via Python-ideas
On Thu, Jun 28, 2018 at 4:59 PM, Steven D'Aprano wrote: > Can I make a plea for people to not post code with source highlighting > as HTML please? It is rendered like this for some of us: > > On Thu, Jun 28, 2018 at 10:01:00AM -0700, Chris Barker via Python-ideas > wrote: &

Re: [Python-ideas] Allow a group by operation for dict comprehension

2018-06-28 Thread Chris Barker via Python-ideas
So: never mind -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] grouping / dict of lists

2018-06-30 Thread Chris Barker via Python-ideas
ion to the collections module. -CHB [*] -- before making any decisions about the best API, it would probably be a good idea to collect examples of the kind of data that people really do need to group like this. Does it come in (key, value) pairs naturally? or in one big sequence with a key fun

[Python-ideas] Fwd: grouping / dict of lists

2018-07-01 Thread Chris Barker via Python-ideas
Ivan, Did you mean this to go to the list? I hope so, as I've cc-d it this time :-) On Sun, Jul 1, 2018 at 1:20 AM, Ivan Levkivskyi wrote: > On 1 July 2018 at 06:18, Chris Barker via Python-ideas < > [email protected]> wrote: > >> I'm really

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-01 Thread Chris Barker via Python-ideas
ographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______ Python-ideas mailing list Python-ideas@p

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-01 Thread Chris Barker via Python-ideas
""" gr = Grouping(student_school_dict) assert len(gr) == 3 assert gr['SchoolA'] == ['Fred', 'Mary'] assert gr['SchoolB'] == ['Bob', 'Jane'] assert gr['SchoolC'] == ['Nancy'] def test_simple_sequence_example(): """ This was a example / use case in Michael Selik's PEP """ gr = Grouping(((c.casefold(), c) for c in 'AbBa')) assert gr == {'a': ['A', 'a'], 'b': ['b', 'B']} def test_most_common(): gr = Grouping(((c.casefold(), c) for c in 'AbBaAAbCccDe')) common = gr.most_common() assert len(common) == len(gr) common = gr.most_common(2) print(common) assert len(common) == 2 assert common == [('a', ['A', 'a', 'A', 'A']), ('b', ['b', 'B', 'b'])] ## You could also specify a custom "collection" type such as a set: def test_set_single(): gr = Grouping(collection=set) gr['key'] = 5 gr['key'] = 6 gr['key'] = 5 assert gr['key'] == set((5,6)) def test_set_all_at_once(): gr = Grouping(((c.casefold(), c) for c in 'AbBaAAbCccDe'), collection=set) print(gr) assert len(gr) == 5 assert gr['a'] == set(('a','A')) assert gr['b'] == set(('b','B')) assert gr['c'] == set(('c','C')) ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-02 Thread Chris Barker via Python-ideas
/grouper/grouper.py -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___

Re: [Python-ideas] grouping / dict of lists

2018-07-02 Thread Chris Barker via Python-ideas
Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Pyth

Re: [Python-ideas] grouping / dict of lists

2018-07-02 Thread Chris Barker via Python-ideas
ode is slightly more verbose, but it is akin to filter(iterable, >> function) vs (i for i in iterable if function(i)). >> > > Sometimes I prefer ``map`` and sometimes I prefer a list comprehension. > That is a "problem" with python: there are two ways to do things

Re: [Python-ideas] grouping / dict of lists

2018-07-03 Thread Chris Barker via Python-ideas
ax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-03 Thread Chris Barker via Python-ideas
ather than "just a function" -- and then it's really obvious where to put it :-) -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115

Re: [Python-ideas] grouping / dict of lists

2018-07-03 Thread Chris Barker via Python-ideas
bit klunky) used everywhere the key function approach can, the opposite is not true (for when the value needs to be transformed as well. But in the spirit of "Python has both map and comprehensions", I say let's use both! * The default behavior is to process a (key.value) pair. * A key

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-03 Thread Chris Barker via Python-ideas
(206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > [email protected] > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-03 Thread Chris Barker via Python-ideas
s collections anyone in particular's baby? like itertools "belongs" to Raymond? -CHB > On Tue, Jul 3, 2018 at 12:19 PM Chris Barker via Python-ideas < > [email protected]> wrote: > >> On Tue, Jul 3, 2018 at 8:24 AM, Steven D'Aprano >> wro

Re: [Python-ideas] Where should grouping() live

2018-07-03 Thread Chris Barker via Python-ideas
n use a regular loop with the functions trigrams = Grouping(key_fun=itemgetter(0, 1), value_fun=itemgetter(2)) for triple in zip(words[:], words[1:], words[2:]): trigrams.add(triple) print(trigrams) -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Divisio

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Chris Barker via Python-ideas
On Wed, Jul 4, 2018 at 3:53 AM, INADA Naoki wrote: > But if it happens, I'm -1 on functools and collections. > They are used very much. Every Python tool import them regardless how > much of their contents are used. > really? collections? what for? I'm guessing name

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-04 Thread Chris Barker via Python-ideas
[email protected] ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-04 Thread Chris Barker via Python-ideas
is "better" map(func, iterable) or (expression for item in iterable) given that map existed in Python when comprehensions were added, I tend to see the latter as more "Pythonic" but that's just me. So I'm currently lobbying for both :-) The default is iterable o

Re: [Python-ideas] Where should grouping() live (was: grouping / dict of lists)

2018-07-05 Thread Chris Barker via Python-ideas
6317 main reception [email protected] _______ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Where should grouping() live

2018-07-09 Thread Chris Barker via Python-ideas
On Fri, Jul 6, 2018 at 5:13 PM, Michael Selik wrote: > On Tue, Jul 3, 2018 at 10:11 PM Chris Barker via Python-ideas < > [email protected]> wrote: > >> * There are types of data well suited to the key function approach, and >> other data not so well suited to it.

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-09 Thread Chris Barker via Python-ideas
. > I think there's more or less consensus on that too. -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-12 Thread Chris Barker via Python-ideas
ker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______ Python-ideas mailing list

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-12 Thread Chris Barker via Python-ideas
Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Add the imath module

2018-07-12 Thread Chris Barker via Python-ideas
On Thu, Jul 12, 2018 at 11:05 AM, Steven D'Aprano wrote: > I'm not sure that we need a specific module for integer-valued maths. I > think a more important change would be to allow math functions to be > written in Python, not just C: > > - move the current math l

Re: [Python-ideas] Fwd: grouping / dict of lists

2018-07-13 Thread Chris Barker via Python-ideas
inputs = ((op_input, op) for op in ops for op_input in op.inputs) groups = Grouping(inputs, key=itemgetter(0), collection=set) otherwise, you could have a method to do it: groups.map_on_groups(set) (not sure I like that method name, but I hope you get the idea) OK, back to work. -CHB --

Re: [Python-ideas] Including the unparse module in the standard library

2018-07-16 Thread Chris Barker via Python-ideas
On Mon, Jul 16, 2018 at 12:24 PM, Brett Cannon wrote: > > Since it isn't necessary for Python to function, I would say we probably > don''t want to pull it up. Then the maintenance burden grows much more. > might make sense to put it on pypi though, if someone want to

Re: [Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

2018-07-18 Thread Ronald Oussoren via Python-ideas
eir items. Also, separating the GIL between interpreters may mean >> we'll need an allocator per interpreter. In that case the >> deallocation must happen relative to the interpreter where the object >> was allocated. >> >> -eric >> >

[Python-ideas] Re: A memory map based data persistence and startup speedup approach

2022-02-20 Thread Yichen Yan via Python-ideas
Thanks for your advice! We're looking for opinions about the overall idea and workflow, and welcome code reviews after we get our lawyers happy and can publish the code :) I'll check python-dev to see if there're some questions

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
ars. Here's one of the recent threads (there are more, just search for 'until' in the archives), that might give you some ideas for how this discussion will progress. :) https://mail.python.org/archives/list/[email protected]/thread/EDNARFL2RGOE53SLWPTD5ZLJQOYSVDCR On Tue, M

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
block) compare to a len-1 loop? Om On Tue, 01 Mar 2022 10:04:31 -0600 *[email protected] * wrote I have use cases for "do exactly once". Basically a sequence of actions which can be broken off (when something goes wrong and the whole process should be a

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
On 01/03/2022 22:25, Chris Angelico wrote: On Wed, 2 Mar 2022 at 09:24, Steven D'Aprano wrote: On Tue, Mar 01, 2022 at 04:04:31PM +, Rob Cliffe via Python-ideas wrote: I have use cases for "do exactly once". Basically a sequence of actions which can be broken off (when

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
While it is too narrow to insist that they only be used with that meaning, this use doesn't feel like a good fit. Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] ht

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
`while True` normally introduces a loop that can be executed multiple times or indefinitely. Best wishes Rob cliffe_______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
On 02/03/2022 01:02, Chris Angelico wrote: On Wed, 2 Mar 2022 at 10:32, Rob Cliffe via Python-ideas wrote: On 01/03/2022 22:25, Chris Angelico wrote: On Wed, 2 Mar 2022 at 09:24, Steven D'Aprano wrote: On Tue, Mar 01, 2022 at 04:04:31PM +, Rob Cliffe via Python-ideas wrote: I

[Python-ideas] Re: repeat until

2022-03-01 Thread Rob Cliffe via Python-ideas
On 02/03/2022 02:01, Chris Angelico wrote: On Wed, 2 Mar 2022 at 12:33, Rob Cliffe via Python-ideas wrote: On 02/03/2022 01:02, Chris Angelico wrote: On Wed, 2 Mar 2022 at 10:32, Rob Cliffe via Python-ideas wrote: On 01/03/2022 22:25, Chris Angelico wrote: On Wed, 2 Mar 2022 at 09:24

[Python-ideas] shutil.copyfileobj to return number of bytes copied

2022-03-02 Thread Davis, Matthew via Python-ideas
tt Matthew Davis Data Analytics Senior Lead Telstra Energy – Decision Science & AI E: [email protected]<mailto:[email protected]> | M: 0415762868 _______ Python-ideas mailing list -- [email protected]

<    10   11   12   13   14   15   16   17   >