Re: [Python-ideas] Debugging: some problems and possible solutions

2018-10-03 Thread Wolfram Hinderer via Python-ideas
Am 03.10.2018 um 20:46 schrieb Anders Hovmöller: Chris' problem isn't an actual problem though. Its just a few sentences in a PEP. It might be a problem for other python implementations but I'm gonna put say 100 dollars on that it's not actua

Re: [Python-ideas] Debugging: some problems and possible solutions

2018-10-03 Thread Wolfram Hinderer via Python-ideas
should not be dismissed. Wolfram _______ 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] Revisiting Immutable Mappings

2018-10-11 Thread Chris Barker via Python-ideas
ay be driven by the choice of names and history: yes, a frozen dict sounds like a regular dict that has been altered (specifically frozen) -- but if we called them "hash_table" and "mutable_has_table", then your intuition may be different :-) As for subclassing or not, for most Pyth

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-11 Thread Chris Barker via Python-ideas
le" and > "mutable_has_table", then your intuition may be different :-) > > As for subclassing or not, for most Python code is makes no difference -- > polymorphism is not achieved through subclassing. and the "Pythonic" way to > test for type is through

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-11 Thread Chris Barker via Python-ideas
On Thu, Oct 11, 2018 at 3:35 PM, Steven D'Aprano wrote: > On Thu, Oct 11, 2018 at 12:34:13PM -0700, Chris Barker via Python-ideas > wrote: > > > I don't care what is or isn't a subclass of what -- I don't think that's > a > > Pythonic questio

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-18 Thread Chris Barker via Python-ideas
t; > One could also imagine that isinstance and issubclass taking a keyword >> argument for the logical operator. Maybe just something as simple as >> "isinstance(foo, (a, b), all=True)" >> > > Does AND even make sense for isinstance/issubclass? > > Cheers, &g

Re: [Python-ideas] Contracts in python -- a report & next steps

2018-10-24 Thread Chris Barker via Python-ideas
brary? > I'm not (currently) a fan of design by contract, and don't expect I'll end up using it, whether or not we get a nifty standard library for it That being said -- this is analogous to why PEP 484 -- Type Hints was adopted, even though the syntax changes in Python had long

Re: [Python-ideas] dict.setdefault_call(), or API variations thereupon

2018-11-02 Thread Chris Barker via Python-ideas
on use case. -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] Add "default" kwarg to list.pop()

2018-11-02 Thread Chris Barker via Python-ideas
gency 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] h

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-02 Thread Chris Barker via Python-ideas
apher 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-id

Re: [Python-ideas] dict.setdefault_call(), or API variations thereupon

2018-11-05 Thread Chris Barker via Python-ideas
e if we could tell the > interpreter "don't evaluate expensive_function(...) unless you really > need it". > > Other languages have this -- I believe it is called "Call By Need" or > "Call By Name", depending on the precise details of how it works. I ca

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-05 Thread Chris Barker via Python-ideas
necessary to avoid having to try parsing every > string value as a date time (and to specify precision: "2018" is not the > same as "2018 00:00:01") > > On Friday, November 2, 2018, Chris Barker via Python-ideas < > [email protected]> wrote: >

Re: [Python-ideas] Using sha512 instead of md5 on python.org/downloads

2018-12-08 Thread Ronald Oussoren via Python-ideas
how about Windows and Mac users? Do those platforms provide a sha256 > checksum utility? > > (Maybe we should provide both hashes.) macOS has a shasum tool that does the same thing: $ shasum -a 256 __init__.py 8db2fe0b21deec50d134895a6d5cfbb5300b23922bf2d9bb5b4b63ac40c6a22e __init__.py Ther

Re: [Python-ideas] Using sha512 instead of md5 on python.org/downloads

2018-12-09 Thread Ronald Oussoren via Python-ideas
ly assume that HTTPS downloads are reliable enough and don’t verify checksums unless I do the download in an automation pipeline. Ronald ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code o

Re: [Python-ideas] Suggested MapView object (Re: __len__() for map())

2018-12-10 Thread Chris Barker via Python-ideas
s a function and maps it onto a interable, returning a new iterable. So a map object is an iterable -- what's under the hood being used to create it is (and should remain) opaque. Back in the day, Python was "all about sequences" -- so map() took a sequence and returned a sequence

Re: [Python-ideas] Using sha512 instead of md5 on python.org/downloads

2018-12-10 Thread Chris Barker via Python-ideas
On Sun, Dec 9, 2018 at 10:32 PM Ronald Oussoren via Python-ideas < [email protected]> wrote: > BTW. I wonder how many actually verify these checksums, > Hardly anyone -- most of us verify the download by trying to use it :-) Which doesn't mean that we shouldn't

Re: [Python-ideas] Suggested MapView object (Re: __len__() for map())

2018-12-11 Thread Chris Barker via Python-ideas
topher 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 ma

[Python-ideas] Use lazy loading with hashtable in python gettext module

2018-12-18 Thread Serge Ballesta via Python-ideas
In a project of mine, I have used the gettext module from Python Standard Library. I have found that several tools could be used to generate the Machine Object (mo) file from the source Portable Object (one): pybabel ( http://babel.pocoo.org/en/latest/ ), msgfmt.py from Python tools or the

Re: [Python-ideas] Use lazy loading with hashtable in python gettext module

2018-12-18 Thread Serge Ballesta via Python-ideas
ry users choose according to their own use case. Serge _______ 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] Use lazy loading with hashtable in python gettext module

2018-12-18 Thread Serge Ballesta via Python-ideas
Le 18/12/2018 à 23:09, Barry Scott a écrit : On 18 Dec 2018, at 09:10, Serge Ballesta via Python-ideas mailto:[email protected]>> wrote: In a project of mine, I have used the gettext module from Python Standard Library. I have found that several tools could be used to genera

Re: [Python-ideas] Use lazy loading with hashtable in python gettext module

2018-12-23 Thread Serge Ballesta via Python-ideas
low to implement the new feature with minimal refactoring for the gettext module. Le 18/12/2018 à 10:10, Serge Ballesta via Python-ideas a écrit : In a project of mine, I have used the gettext module from Python Standard Library. I have found that several tools could be used to generate the Mach

Re: [Python-ideas] Possible PEP regarding the use of the continue keyword in try/except blocks

2019-01-06 Thread Chris Barker via Python-ideas
ber of ways one might want to proceed with/without an error, and the current except, finally, else options cover them all in a clearly defined way. -CHB > > ~Amber > ___ > Python-ideas mailing list > [email protected] > https:/

[Python-ideas] Single line single expression try/except syntax

2019-01-27 Thread Alex Shafer via Python-ideas
� a_list[i] += 1 ��� etc() I realize this could be accomplished with context managers, but that seems like overkill to simply throw away the exception, and would increase the overall required code length. Thanks for your input! Alex signature.asc Description: OpenPGP digital signature

Re: [Python-ideas] Add list.join() please

2019-01-29 Thread Chris Barker via Python-ideas
> or "inconsistencies between os.path.join and str.join" ? > well, if we're talking about moving forward, then the Path object is probably the "right" way to join paths anyway :-) a_path / "a_dir" / "a_filename" But to the core language issue -- I start

Re: [Python-ideas] Add list.join() please

2019-01-29 Thread Alex Shafer via Python-ideas
about composable, re-usable general > purpose components more than special cases. > > -- > Steve > _______ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.or

Re: [Python-ideas] Add list.join() please

2019-01-29 Thread Alex Shafer via Python-ideas
ify = lambda it: type(it)(map(str, it)) > > Done! Does that really need to be in the STDLIB? > > On Tue, Jan 29, 2019, 7:11 PM Alex Shafer via Python-ideas > >> 1) I'm in favor of adding a stringify method to all collections >> >> 2) strings are special and worthy

Re: [Python-ideas] Add list.join() please

2019-01-29 Thread Alex Shafer via Python-ideas
tringify() that "could be useful." Python gives us easy composition to > create each of them. It's not PHP, after all. > > On Tue, Jan 29, 2019 at 8:52 PM Alex Shafer wrote: > >> That would be strongly preferred to duplication across hundreds of use cases >>

Re: [Python-ideas] Stack traces ought to flag when a module has been changed on disk

2019-01-30 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] _____

Re: [Python-ideas] Add list.join() please

2019-01-31 Thread Chris Barker via Python-ideas
le: a_numpy_array * 5 multiplies every item in the array by 5 In pure Python, you would do something like: [ i * 5 for i in a_regular_list] You can imagine that for more complex expressions the "vectorized" approach can make for much clearer and easier to parse code. Also much fast

Re: [Python-ideas] Clearer communication

2019-02-01 Thread Alex Shafer via Python-ideas
anyone be opposed to the creation of a #python-ideas on a large IRC network? I'd hope discussions there can have the same weight, merit, community involvement, and potential for PEP-tracking ideas. I think accommodating different people's best communication modes is essential to the

Re: [Python-ideas] Vectorization [was Re: Add list.join() please]

2019-02-03 Thread Ronald Oussoren via Python-ideas
rator is a good idea in the first place). Ronald _______ 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] Vectorization [was Re: Add list.join() please]

2019-02-03 Thread Ronald Oussoren via Python-ideas
enough reason for > not using @ as an elementwise application operator (ignoring if having an > such an operator is a good idea in the first place). > > Co-opting operators is pretty common in Python. For example, the > `.__div__()` operator spelled '/' is most often

[Python-ideas] About PEP-582

2019-02-19 Thread Philip Bergen via Python-ideas
hilip Bergen* P: +1(415)200-7340 *"Without data you are just another person with an opinion" -- W. Edwards Deming* ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http:/

Re: [Python-ideas] PEP 8 update on line length

2019-02-21 Thread Chris Barker via Python-ideas
nalysis that somehow that is optimum for readability. -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...@

Re: [Python-ideas] PEP 8 update on line length

2019-02-21 Thread Philip Bergen via Python-ideas
Feb 21, 2019 at 3:20 PM wrote: > Send Python-ideas mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-ideas > or, via email, send a message with subje

Re: [Python-ideas] PEP 8 update on line length

2019-02-23 Thread Alexandre Dubois via Python-ideas
xandre Dubois --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus _______ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo

Re: [Python-ideas] PEP 8 update on line length

2019-02-27 Thread Chris Barker via Python-ideas
ite > important, especially when you consider that PEP8 only really has force > for the standard library. > Huh? in the case of the stdlib, the "team" is the python core devs -- they could decide to increase the line length if they want (though I imagine if they did, they's

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-12 Thread Sylvain MARIE via Python-ideas
Dear python enthusiasts, Writing python decorators is indeed quite a tideous process, in particular when you wish to add arguments, and in particular in two cases : all optional arguments, and one mandatory argument. Indeed in these two cases there is a need to disambiguate between no

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-12 Thread Sylvain MARIE via Python-ideas
ult) and therefore to use something like Signature.bind(). For this reason I proposed a replacement in `makefun`: https://smarie.github.io/python-makefun/#signature-preserving-function-wrappers -- Now bridging the gap. Of course a very interesting use cases for decorators is to create decorator

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-12 Thread Sylvain MARIE via Python-ideas
2019 14:53 À : Steven D'Aprano ; [email protected]; David Mertz Objet : RE: [Python-ideas] Problems (and solutions?) in writing decorators David, Steven, Thanks for your interest ! As you probably know, decorators and function wrappers are *completely different concepts*. A decorat

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-12 Thread Sylvain MARIE via Python-ideas
ations “For this to be used in this way, it is a requirement that the decorator arguments be supplied as keyword arguments. If using Python 3, the requirement to use keyword only arguments can again be enforced using the keyword only argument syntax.” * Finally, but this is just a comment:

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-12 Thread Chris Barker via Python-ideas
Just in case I'm not the only one that had a hard time finding the latest version of this PEP, here it is in the PEPS Repo: https://github.com/python/peps/blob/master/pep-0584.rst -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-14 Thread Sylvain MARIE via Python-ideas
ds Sylvain De : David Mertz Envoyé : mardi 12 mars 2019 19:15 À : Sylvain MARIE Cc : Steven D'Aprano ; python-ideas Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators [External email: Use caution with links and attachments] One of

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-19 Thread Sylvain MARIE via Python-ideas
2019 04:56 À : Sylvain MARIE Cc : David Mertz ; python-ideas Objet : Re: [Python-ideas] Problems (and solutions?) in writing decorators [External email: Use caution with links and attachments] ____ Sylvain MARIE via Python-ideas writes: > I totally und

Re: [Python-ideas] Problems (and solutions?) in writing decorators

2019-03-20 Thread Sylvain MARIE via Python-ideas
ustomed with the long history of this language, is very strange that an operator such as @ (the decorator one, not the other one) is completely not detectable by code, while there are so many hooks available in python for all other operators (+, -, etc.). Eventually that’s obviously your call, I’m

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-17 Thread Andrew Barnert via Python-ideas
> incomplete ordering, which makes the comparison operators completely >> appropriate. Adding new syntax for something that doesn't need it is >> the thing likely to cause confusion. > > > Indeed it would work the same way as set comparison does, if you interpret a &

[Python-ideas] Re: Comparison operator support (>= and <=) for type

2019-06-17 Thread Andrew Barnert via Python-ideas
the comparison operators completely >>>> appropriate. Adding new syntax for something that doesn't need it is >>>> the thing likely to cause confusion. >>> >>> >>> Indeed it would work the same way as set comparison does, if you interpr

[Python-ideas] Re: Operator as first class citizens -- like in scala -- or yet another new operator?

2019-06-19 Thread Andrew Barnert via Python-ideas
, but knew the data binding model of python > was incompatible from p. > > This got me thinking. I didnt actually need to overload assignment per-say, > data binding could stay just how it was, but if there was a magic method that > worked similar to how __get__ works for descriptor

[Python-ideas] Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-19 Thread Andrew Barnert via Python-ideas
read on; otherwise, you can skip the rest of this message. --- First, why is there even a problem? Because Python doesn't even have "variables" in the same sense that languages like C++ that allow assignment overloading do. In C++, a variable is an "lvalue", a location wi

[Python-ideas] Re: Why not accept lists or arbitrary iterables in str.endswith?

2019-06-19 Thread Andrew Barnert via Python-ideas
ging them today either, but maybe you could make a case otherwise. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-19 Thread Andrew Barnert via Python-ideas
On Jun 19, 2019, at 16:57, Chris Angelico wrote: > > On Thu, Jun 20, 2019 at 8:14 AM Andrew Barnert via Python-ideas > wrote: >> … x = y would mean this: >> >>try: >>xval = globals()['x'] >>result = xval.__iassig

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-19 Thread Andrew Barnert via Python-ideas
On Jun 19, 2019, at 17:25, Andrew Barnert wrote: > > At least with CPython, I’m 99% sure… I forgot that I have Pythonista on my phone so I can check it instead of guessing. Make that 100% sure. :) ___ Python-ideas mailing list -- python

[Python-ideas] Re: Canceling thread in python

2019-06-20 Thread Andrew Barnert via Python-ideas
ould have just signaled it instead, which is safer and easier to manage, especially from Python. Either way, there’s no way to safely clean up after it. (Deleting the threading library’s own reference to its Thread object doesn’t solve that.) And if your program regularly needs to terminate threa

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Andrew Barnert via Python-ideas
e a patch. That’s hardly something to feel bad about! > Thinking about things the right way around, I dug in to the interpreter an > hacked something up to add an assignment overload dunder method. A diff > against python 3.7 can be found here: > https://gis

[Python-ideas] Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in scala -- or yet another new operator?)

2019-06-21 Thread Andrew Barnert via Python-ideas
If you worked out a more realistic example and demonstrated that with your patch, it might feel a lot less disconcerting. I feel even less convinced by your other potential uses, but again, if one of them were actually worked out, it might be quite different.. > It's not like python python d

[Python-ideas] Re: Python-ideas] Re: `if-unless` expressions in Python

2019-06-23 Thread Andrew Barnert via Python-ideas
cs. Finally, it would be nice to see each example compared to the best way to do the same thing (presumably with iterable unpacking) in current Python, to see how much It actually improves readability. The only equivalents given by the OP are a case where you can just use an if statement (which

[Python-ideas] Re: Make $ a valid identifier and a singleton

2019-06-23 Thread Andrew Barnert via Python-ideas
a "rpartial" function, and the second by > using ellipsis ... as a placeholder, or a named constant in the > functools module. I’m pretty sure there are multiple improved-partial projects on PyPI. Maybe just picking out one and adding a link to it from the functools docs is sufficien

[Python-ideas] Re: `if-unless` expressions in Python

2019-06-23 Thread Andrew Barnert via Python-ideas
ave an assert statement as an example. I’m not quite sure >> what it’s supposed to do there (does it skip the assert? if so, how is that >> different from asserting True anyway?), and even less sure how to extend >> that idea to all statements that use an expression anywhere. Is

[Python-ideas] Re: `if-unless` expressions in Python

2019-06-24 Thread Andrew Barnert via Python-ideas
oblem as with most other syntactic locations where an expression can go, like the assignment example I gave earlier. Anyway, I think we need to make this more concrete. Python semantics aren't defined in terms of syntax rewriting rules, so trying to discuss this suggestion as if it were a synt

[Python-ideas] Re: `if-unless` expressions in Python

2019-06-24 Thread Andrew Barnert via Python-ideas
In a language like Perl, where there’s little consistency in syntax and flow control is scattered all over the place, this would be great. You can write the code in the same order as the sentence you’re thinking in your native language. In fact, Perl added postfix conditionals back in versio

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread Andrew Barnert via Python-ideas
On Jun 25, 2019, at 14:00, nate lust wrote: > > This message is related to two previous threads, but was a sufficiently > evolved to warrant a new topic. > > I am proposing that two new magic methods be added to python that will > control assignment and loading of class

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
er function that can do anything. No, + does mean add. But Python doesn’t know what it means to add two Fraction or Decimal or ndarray objects, so if you’re the one writing that class, you have to tell it. It still means add—unless you lie to your readers. And you can always lie to your readers

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
tus, or referencing f->eggs in code that doesn't even run… so let's not worry about bulletproofing it.) ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
sing that variable will trigger another call to __getself__. I assume Nate is working on an answer to that along with all the other points that have been raised. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python

[Python-ideas] Re: Proposal: Using % sign for percentage

2019-06-26 Thread Andrew Barnert via Python-ideas
ehavior, so you can write a scanf function that knows that “%.1f” has to “unprintf” into a double. But Python format specifier “.1” tells you nothing about the type—it can be passed a float, a str, an instance of some arbitrary user-defined type… so what type can tell you how to “unformat” it?

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
s closure, global, and dynamic sets, and even non-symbol sets like to generalized-variables. The fact that Python’s namespaces are object-oriented, and Python makes it very easy to replace or hook class instance namespaces, a bit harder to replace or hook global namespaces, and very hard to

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-26 Thread Andrew Barnert via Python-ideas
no matter where from) calls counter(). It was used for all kinds of things besides the debugging purpose it was originally added for. In fact, Python developers still use it with Tk, to hook UI bits where Tk forgot to add events or validators. And actually, you can already do that in Pytho

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Andrew Barnert via Python-ideas
ut doing anything in between, what if, say, x.__getself__() raises? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at ht

[Python-ideas] Re: Canceling thread in python

2019-06-27 Thread Andrew Barnert via Python-ideas
On Jun 27, 2019, at 13:36, Michael Foord wrote: > >> On Thu, 27 Jun 2019 at 20:53, Yonatan Zunger wrote: >> Generally, threads don't have a notion of non-cooperative thread >> termination. > That's precisely why thread cancellation in managed languages (lik

[Python-ideas] Re: Canceling thread in python

2019-06-27 Thread Andrew Barnert via Python-ideas
hich then gets > checked at similar times to signals. (Probably not the exact same times > since I'm sure there's plenty of code depending implicitly on that function > being a noop outside the main thread) Basically, it would be having the > Python interpreter doin

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-27 Thread Andrew Barnert via Python-ideas
keep them readable, but those are usually not the kind of benefits that other language designers steal from Python.) >> If you had code involving “x = 2” that stopped working >> when you moved it from local to a module init function to the top level ... > > would you think

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Andrew Barnert via Python-ideas
seful than a function which is like C scanf with a few differences and a few extensions (that aren’t the same extensions as, say, ObjC). Although I suppose there’s no reason you couldn’t do both. _______ Python-ideas mailing list -- [email protected] T

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Andrew Barnert via Python-ideas
ople have been trying to improve on scanf for 40 years, and the only things that have caught on look nothing like it (regex, or just not having a format string at all and doing something like C++ >> operator). ___________ Python-ideas mailing list -- py

[Python-ideas] Re: Proposal: `python-config` should be available in venv virtual environment.

2019-07-03 Thread Andrew Barnert via Python-ideas
On Jul 3, 2019, at 03:54, Stefan Droege wrote: > > Currently, when creating a virtualenv with the PEP-405 `venv` module, the > python-config executable will not be copied/symlinked to the virtualenv. > > That means for projects that link against the python interpreter, *and* whi

[Python-ideas] Getting the version number for a package or module, reliably

2019-07-06 Thread Sylvain MARIE via Python-ideas
Dear python enthusiasts, For some industrial project a few years ago we needed a reliable way to get the version number for a package or module. I found out that there was actually no method working in all edge cases, including: * Built-in modules * Unzipped wheels and eggs added to

[Python-ideas] Re: Getting the version number for a package or module, reliably

2019-07-06 Thread Sylvain MARIE via Python-ideas
suggest it here: https://github.com/smarie/python-getversion/issues ) I forgot to add something in my previous email: the original reason for developing this library was to provide a version-aware persistency layer based on json. Basically when you deserialize an object, your code would receive

[Python-ideas] Re: Shouldn't this: ' myVar: "value" ' be a syntax error ?

2019-07-09 Thread Andrew Barnert via Python-ideas
On Jul 9, 2019, at 13:09, Shay Cohen wrote: > > >>> a: 3 The reason this isn’t a syntax error is that Python allows any valid expression as an annotation. And “3” is just as valid an expression as “int”. More generally, annotations don’t actually do anything at runtime, except

[Python-ideas] Re: Suggestion: Windows launcher default to not using pre-releases by default

2019-07-09 Thread Andrew Barnert via Python-ideas
it possible for the installer to see the sys.version_info.releaselevel of the Python it’s installing? If not, I guess it would require a commit every release cycle to mark the new version as “no longer prerelease, so enable the Windows installer check

[Python-ideas] Re: Make tuple a context manager

2019-07-12 Thread Andrew Barnert via Python-ideas
on entry, or on exit? ExitStack answers all of these problems. Maybe the solution is just to make it slightly easier to use ExitStack with an iterable of context managers, and a lot easier for novices to discover it? _______ Python-ideas mailing list -- py

[Python-ideas] Re: Make tuple a context manager

2019-07-12 Thread Andrew Barnert via Python-ideas
On Friday, July 12, 2019, 07:48:52 AM PDT, Joao S. O. Bueno wrote: > Modifying the fundamental tuples for doing that is certainly overkill -  > but maybe a context-helper function in contextlib that would proper handle > all the > corner cases of some code as I've pasted

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-13 Thread Andrew Barnert via Python-ideas
> BoundExpression instance. Would it be easy to build something like this on top of a more general macro system, like MacroPy? If so, you could create a proof of concept using existing Python and get useful feedback. As it is, with just an explanation and a single example, it’s hard to

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-13 Thread Andrew Barnert via Python-ideas
unction (presumably equivalent to either lambda: g(f()) or lambda *a, **kw: g(f(*a, **kw))) that represents the pipeline that you then just call normally? I don’t see the benefit in being able to write g() instead of g here, and in fact it seems actively misleading, because it implies calling g on

[Python-ideas] Re: Make tuple a context manager

2019-07-14 Thread Andrew Barnert via Python-ideas
lose each one immediately. Which you can just write like this: for n in range(1000): with open(str(n) + '.tmp', 'w') as f: f.write(str(n)) _______ Python-ideas mailing list -- [email protected] To unsubs

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-14 Thread Andrew Barnert via Python-ideas
of “x=x”. But are there other benefits, for less trivial cases? ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at http

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-14 Thread Andrew Barnert via Python-ideas
the CPython implementation. So this might require >> at least defining that implementation behavior as the only correct one, and >> changing the docs to explain it. > > You are correct. I have checked that this is the behavior of CPython, pypy, > micropythob, iron python, an

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-14 Thread Andrew Barnert via Python-ideas
uated at the callee context It’s actually not even the callee context, but a custom one, maybe something like self.columns. But that isn’t a problem. > while x should be evaluated at the caller context. And how Python can know > what is what? I think the benefit of this proposal is that P

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-14 Thread Andrew Barnert via Python-ideas
d in, say, >> Haskell, >> which would just define a function (presumably equivalent to either lambda: >> g(f()) or >> lambda a, **kw: g(f(a, **kw))) that represents the pipeline that you then >> just >> call normally? I don’t see the benefit in being able to

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-15 Thread Andrew Barnert via Python-ideas
bly not a strength of the >> language definition but a flaw. If every implementation does the exact same >> thing (especially if it’s been that way unchanged in every implementation >> from 2.3 to 3.8), why not document that as the rule? > > Agreed! If you don't fo

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-15 Thread Andrew Barnert via Python-ideas
esumably write dt[price * taxrate < x], and get an exception if, say, both tables have price columns, but otherwise get exactly what you expected. I assume you think that’s too unclear or magical or whatever? But then I’m not sure how dt[\price * \taxrate < x] is much better. __

[Python-ideas] Re: Coding using Unicode

2019-07-15 Thread Andrew Barnert via Python-ideas
On Jul 15, 2019, at 04:43, Adrien Ricocotam wrote: > > Oh ok ! > I tried with some unicodes (🔥) but it didn't work. So it's only a subset as > described in PEPs ? > What about extending it ? I’m pretty sure that the docs explain that the subset of characters that Pyth

[Python-ideas] Re: Stdlib Module

2019-07-15 Thread Andrew Barnert via Python-ideas
e__? Would Apple’s Python distribution include their extra modules like PyObjC, and would Debian’s exclude the ones they’ve taken out of the python package and put in separate debs? Is there a distributor and/or site mechanism for customizing this? You might want to take a look at https://github.c

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-15 Thread Andrew Barnert via Python-ideas
early benchmark numbers to consider. This is far smaller > than any of the Python parsing libraries I have looked at, yet more universal > than many of them. I hope that it would convert the skeptics ;). For at least some of your use cases, I don’t think it’s a problem that it’s 70x s

[Python-ideas] Re: Stdlib Module

2019-07-15 Thread Andrew Barnert via Python-ideas
at ships with cPython” I think a better current definition might be more like “all the stuff that has chapters in docs.python.org/library”. That documentation claims to define “The Python Standard Library” in the same way the reference defines “The Python Language”. (It also says to keep it under y

[Python-ideas] Re: Stdlib Module

2019-07-15 Thread Andrew Barnert via Python-ideas
both ways, so presumably that’s something that needs to be discussed and decided on usefulness grounds rather than forced on us by an implementation technique._______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pyt

[Python-ideas] Re: Stdlib Module

2019-07-16 Thread Andrew Barnert via Python-ideas
On Jul 16, 2019, at 10:20, Abdur-Rahmaan Janhangeer wrote: > > I must make a C or pure Python demo? You can definitely implement this in pure Python. It doesn’t need C for performance reasons, it’s not going to be bootstrapped into the start sequence, it doesn’t need access to C-onl

[Python-ideas] Re: Universal parsing library in the stdlib to alleviate security issues

2019-07-16 Thread Andrew Barnert via Python-ideas
the more fun limitation to solve, right? :)___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-17 Thread Andrew Barnert via Python-ideas
rea between, or whatever. So, how does plot know which argument is y and which is a? It can’t be by the names, because the names are stringified lambda expressions. The only thing it can do is treat the first name-value pair in kwargs as y, and the second we z. In other words, it has to treat them a

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-17 Thread Andrew Barnert via Python-ideas
function? There’s nothing about having one * vs. two that tells you which one is y and which is z. And of course there’s nothing about the values, either. If there’s no way to tell based on the names, and no way to tell based on the values, what way can there be to tell, except for the posi

[Python-ideas] Re: Non-standard evaluation for Python

2019-07-17 Thread Andrew Barnert via Python-ideas
local variables lying around for real and imag, complex(=imag, =real) would be just as clear: the callee’s imag local gets the value of the caller’s imag local. But in the plot example, that isn’t what’s happening. The callee y variable gets the first argument, and z gets the second. That’s not wha

[Python-ideas] Re: Scope painting

2019-07-17 Thread Andrew Barnert via Python-ideas
On Jul 17, 2019, at 18:41, Yonatan Zunger wrote: > > > I'm in the middle of developing a fancy heap profiler for Python (for those > times when tracemalloc isn't enough), and in the process, thought of a small > change in the interpreter which could have a lot

<    1   2   3   4   5   6   7   8   9   10   >