[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Andrew Barnert via Python-ideas
ut meaning type(lhs)(chain(…)) on some types, so why do the equivalent with @?) _______ 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 archiv

[Python-ideas] Re: Cartesian Product on `__mul__`

2019-07-25 Thread Andrew Barnert via Python-ideas
y a waste of effort. Because really, when you need N-way products, you almost always need either iterators or numpy in the first place. But if the OP has some good examples, maybe we can extrapolate from those instead of guessing what might be useful if examples existed. :) ______

[Python-ideas] Re: support toml for pyproject support

2019-07-26 Thread Andrew Barnert via Python-ideas
a specific) version in site-packages so they aren’t burdened by the release cycle. Would that not be appropriate for the way packaging needs TOML? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@python.

[Python-ideas] Re: For-expression/throwaway comprehension

2019-07-26 Thread Andrew Barnert via Python-ideas
choose whether you want clarity: def consume(it): for _ in it: pass … or performance: def consume(it): colllections.deque(it, maxlen=0) ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le

[Python-ideas] Re: Namespace context managers

2019-07-26 Thread Andrew Barnert via Python-ideas
al classes and methods but pointers to opaque Class and Selector objects, and it feels more like you’re writing an ObjC interpreter than writing ObjC code. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to

[Python-ideas] Re: for ... except, with ... except

2019-07-26 Thread Andrew Barnert via Python-ideas
ust scrap the nice context managers and use finally, or add two more layers of indentation, or, most commonly, just punt on the problem and don’t handle errors correctly. So, I think adding with to the idea makes it a lot more compelling. _______ Python

[Python-ideas] Re: For-expression/throwaway comprehension

2019-07-26 Thread Andrew Barnert via Python-ideas
s (still) by far the fastest way to do it in CPython (short of a custom C function for consume, and even that isn’t much faster), and not quite the fastest but close enough in PyPy. _______ Python-ideas mailing list -- [email protected] To

[Python-ideas] Re: Add a "partial with placeholders" function to the functools module

2019-07-27 Thread Andrew Barnert via Python-ideas
maybe the bikeshedding potential will be higher than expected, and a variety of different modules that all handle the placeholders differently will compete, and it’ll turn out that everyone loves some different design that allows both single-arg and multi-arg placeholders _____

[Python-ideas] Re: Add a "partial with placeholders" function to the functools module

2019-07-27 Thread Andrew Barnert via Python-ideas
are useful, you can file it on b.p.o. (ideally with a patch) and I’m sure someone will take a look. Meanwhile, there are going to be functions that take positional arguments, whether for semantic reasons, for performance reasons, or for pure legacy issues. As long as any of those cases exi

[Python-ideas] Re: Utilities for easier debugging

2019-07-28 Thread Andrew Barnert via Python-ideas
e realistic code in some realistic scenario, maybe by giving us some code with functions whose bodies are like `#80 lines of complicated stuff to get the value for spam` followed by `?spam`, and then a fake console dump or interactive session log showing the program being started and displaying

[Python-ideas] Re: for ... except, with ... except

2019-07-29 Thread Andrew Barnert via Python-ideas
se, not something like for…else that some experts use but most people live without. (But I don’t have a better syntax to offer. I actually like with…except, if it were just for my use, but on reflection I can see why others find it confusing. Just like for…else.) ____

[Python-ideas] Re: for ... except, with ... except

2019-07-29 Thread Rob Cliffe via Python-ideas
worthwhile goal, and at present the only way to achieve it is with somewhat verbose and clunky code. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.py

[Python-ideas] Re: for ... except, with ... except

2019-07-29 Thread Andrew Barnert via Python-ideas
d of code really is a serious problem, then the proposal doesn’t solve it; we need a proposal everyone will be able to learn and use. (And if it’s not a serious problem, then the proposal isn’t needed in the first place.) _______ Python-ideas mailing list -- py

[Python-ideas] Re: Entrypoint function for modules (AKA if __name__ == '__main__' ) with built-in argument parsing

2019-07-30 Thread Andrew Barnert via Python-ideas
nd-line utility a lot easier than using argparse. I think whenever you want anything more than argv and don’t want argparse, you should probably just use one of those libraries. ___________ Python-ideas mailing list -- [email protected] To unsubscribe

[Python-ideas] Re: Entrypoint function for modules (AKA if __name__ == '__main__' ) with built-in argument parsing

2019-07-30 Thread Andrew Barnert via Python-ideas
On Jul 30, 2019, at 20:49, Andrew Barnert via Python-ideas wrote: > > There are lots of great third-party libraries that make turning a function > into a command-line utility a lot easier than using argparse. I think > whenever you want anything more than argv and don’t want a

[Python-ideas] Re: Entrypoint function for modules (AKA if __name__ == '__main__' ) with built-in argument parsing

2019-07-30 Thread Andrew Barnert via Python-ideas
dirty scripts, but would be disastrous for many other programs.) So… never mind. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.p

[Python-ideas] Re: for ... except, with ... except

2019-07-31 Thread Rob Cliffe via Python-ideas
sure than coding) it helps to have as much information as possible at your fingertips.  Oh, I know you can always work through a trace (if one is available) to see exactly where an error occurred, but that takes time. _______ Python-ideas mailing

[Python-ideas] Re: for ... except, with ... except

2019-07-31 Thread Rob Cliffe via Python-ideas
should be implemented.  I just don't want its merits to be overlooked.) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Mess

[Python-ideas] Re: Entrypoint function for modules (AKA if __name__ == '__main__' ) with built-in argument parsing

2019-07-31 Thread Andrew Barnert via Python-ideas
p file to make it automatic), because I think a sizable number of people would want that. (In fact, even if you can get it accepted into Python, some people will want a backport that they can use with 3.7. _______________ Python-ideas mailing list -- python-ide

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Andrew Barnert via Python-ideas
the recipes (and it’s kept up-to-date, so the occasional new recipes are available to anyone who installs it, even with older versions of Python). So, just add that to your requirements file, and you can import consume from more_itertools instead of itertools._____

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Andrew Barnert via Python-ideas
On Aug 1, 2019, at 09:27, Christopher Barker wrote: > > > >> On Thu, Aug 1, 2019 at 9:19 AM Andrew Barnert via Python-ideas >> wrote: > >> > Given that in 3.x every stdlib module is supposed to be in Python with an >> > optional C accelerator, >

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Andrew Barnert via Python-ideas
tall more-itertools and use that, and mention the recipes so they can maybe read them later _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lis

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Rob Cliffe via Python-ideas
to "bother". _______ 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-idea

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Andrew Barnert via Python-ideas
n Python 2.5 rather than 3.7. The actual people being helped have never seemed reticent.) ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-idea

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-01 Thread Andrew Barnert via Python-ideas
the best recommendations to consider making. ___________ 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/a

[Python-ideas] Re: Fwd: Re: PEP: add a `no` keyword as an alias for `not`

2019-08-02 Thread Andrew Barnert via Python-ideas
sales and isopen:`, but it would do the wrong thing if `no` is special syntax that reverses the sense of the `if` rather than a normal operator that binds more tightly than `and`. _______ Python-ideas mailing list -- [email protected] To unsubscribe

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-02 Thread Andrew Barnert via Python-ideas
On Aug 1, 2019, at 22:26, Brendan Barnwell wrote: > >> On 2019-08-01 12:31, Andrew Barnert via Python-ideas wrote: >>> On Aug 1, 2019, at 10:48, Eli Berkowitz wrote: >>> > >>> >In terms of an argument for why it should be included, for most Python >

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-02 Thread Andrew Barnert via Python-ideas
. Or you could port itertools to Python plus C accelerator and then just copy-paste the recipes into the Python part. I suspect the latter would be easier to get accepted, but I have no idea whether it’s more or less work. _______ Python-ideas mailing list --

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-02 Thread Andrew Barnert via Python-ideas
of the pitch for yield from that I can’t remember.) ___________ 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: For-expression/throwaway comprehension

2019-08-02 Thread Andrew Barnert via Python-ideas
e plus grouper plus some of the less trivial recipes (or, more simply, just all of them, to avoid bikeshedding arguments on each one) is. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] h

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-02 Thread Andrew Barnert via Python-ideas
discussion, or whatever, but the easiest way to find out (unless he joins this thread) is to just file the bug and add the patch. (By the way, why not just read PEP 399 instead of asking and then relying on the interpretation of some random guy on the internet?) _______

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-03 Thread Andrew Barnert via Python-ideas
d to live without once you get used to them. Also, most of them are curses or otherwise full-screen. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailm

[Python-ideas] Re: For-expression/throwaway comprehension

2019-08-07 Thread Andrew Barnert via Python-ideas
removing all non-escape-sequence backslashes, so you can paste something with backslash-escaped spaces from bash. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.py

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-08 Thread Ronald Oussoren via Python-ideas
tion. Ronald — Twitter: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/_______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.py

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-08 Thread Andrew Barnert via Python-ideas
the original un-parsed string. _______ 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/p

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-08 Thread Andrew Barnert via Python-ideas
when the values are unchanged. _______ 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: adding support for a "raw output" in JSON serializer

2019-08-08 Thread Rob Cliffe via Python-ideas
;: Decimal('0.6441726684570313')} dson:seri = {"val": 0.6441726684570312} ``` The possibility to specify the "raw" textual output, which does not get mangled by the JSONEncoder when custom encoder is used seems to be missing. ˙`` _______

[Python-ideas] Re: Exceptions with Message Templates

2019-08-08 Thread Andrew Barnert via Python-ideas
Without explicitly listing the args in order somewhere, how do you solve that? And is there a way to list the named args of a function in order that’s less boilerplate than (but just as understandable as) a def statement? _______ Python-ideas mailing

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-08 Thread Andrew Barnert via Python-ideas
gh that you can hope someone else does), and you’ll probably get a difference response than you get by defensively claiming that you’re not asking for what you’re asking for but then repeating your need for it anyway. _______ Python-ideas mailing list -

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-08 Thread Andrew Barnert via Python-ideas
s you add in encode only affect the top-level value, not values inside arrays or objects. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-

[Python-ideas] Re: Exceptions with Message Templates

2019-08-08 Thread Andrew Barnert via Python-ideas
erty would be an easy problem. But I think with the way Python is today, it’s not. Of course I’d be happy to be proven wrong on that. :)___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-09 Thread Andrew Barnert via Python-ideas
design what happens if someone else does. ___________ 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: Proposal: Use "for x = value" to assign in scope

2019-08-09 Thread Andrew Barnert via Python-ideas
complexity for the reader to deal with, so I think you’re still better off not doing it. (As a side note, you probably want a numerical stable average like the ones in statistics or numpy, rather than one that accumulates float rounding errors indiscriminately, but that’s another issue.) ___

[Python-ideas] Re: Exceptions with Message Templates

2019-08-09 Thread Andrew Barnert via Python-ideas
attributes too?), that would be a step forward. But adding the their half of str while breaking the existing magic (and making named attributes harder rather than easier) doesn’t seem like it is. _______ Python-ideas mailing list -- python-ideas@pyth

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-09 Thread Andrew Barnert via Python-ideas
he only JSON docs you ever receive are just individual numbers, and they’re all between -0.1 and -0.2, so the only possible error that can arise is this one. And so on. But I doubt any of those is common. ___ Python-ideas mailing list -- python-ideas@p

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-09 Thread Andrew Barnert via Python-ideas
thing to parse in the world, but why duplicate the parser (and potentially create new bugs) if you already have one? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.pyth

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-09 Thread Andrew Barnert via Python-ideas
Decimal can’t solve for anyone; there’s no additional problem that Decimal can’t solve here that’s only faced by your weird app. > But an application > that cared about that would be pretty weird. So I think a > "use decimal" option would cover the vast majority of use > c

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-10 Thread Andrew Barnert via Python-ideas
eck, using the Decimal constructor is not a good check. It’s similar to the spec, but not the same, and why validate that someone’s output passes a similar specification instead of the one they’re trying to use? Especially when we already have tested (and configurable) code that exactly parses

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-10 Thread Andrew Barnert via Python-ideas
needing json to import decimal I would have said it was a great idea—but after this thread, I’m not so sure. It everyone who wants it, or wants other people to have it, is wrong about what it would do, that just screams attractive nuisance rather than useful feature. ______

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-10 Thread Andrew Barnert via Python-ideas
g that you asked what you asked, and then pretending to have a different problem in hopes that different problem might be solved by the feature you asked for, so maybe the feature will be added so you can misuse it for what you really wanted. _______ Python-id

[Python-ideas] Re: hybrid implementation for PyLongObject (performance)

2019-08-12 Thread Andrew Barnert via Python-ideas
ts for the temporary rather than a whole int object anyway. _______ 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://ma

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-12 Thread Andrew Barnert via Python-ideas
nt libraries? Or a library you don’t know? Or JSON edited by hand or by sed scripts that might not even be consistent? ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-12 Thread Andrew Barnert via Python-ideas
ry should have allowed it…) Also, because Python follows the obsolete RFC 7159 instead of 8259, there may be other issues—I don’t think there are, but I wouldn’t want to guarantee that without checking. _______ Python-ideas mailing list -- python-ideas

[Python-ideas] Re: hybrid implementation for PyLongObject (performance)

2019-08-13 Thread Andrew Barnert via Python-ideas
s is exactly the reason C offers types like intptr_t. ___________ 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 h

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-13 Thread Andrew Barnert via Python-ideas
at’s as readable as possible for a single line that meets the standards of an entry in all of JSONlines, NDJ, and LDJSON. But at the time nobody could have known about JSONlines, or that 7-bit-clean pretty-printed JSON would never be useful, etc. _____

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-13 Thread Andrew Barnert via Python-ideas
On Aug 13, 2019, at 11:21, Chris Angelico wrote: > > On Wed, Aug 14, 2019 at 3:12 AM Andrew Barnert via Python-ideas > wrote: >> >>> On Aug 13, 2019, at 01:04, Richard Musil wrote: >>> >>> Concerning the custom separators, and why the implementati

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-13 Thread Andrew Barnert via Python-ideas
On Aug 13, 2019, at 15:01, Eric V. Smith wrote: > >> On 8/13/2019 5:49 PM, Andrew Barnert via Python-ideas wrote: >> But I think the lazy-import-decimal-on-first-dump-with-use_decimal solves >> that, and solves it even better than __json__, even besides the fact that >

[Python-ideas] Re: Exception handling in objects

2019-08-14 Thread Andrew Barnert via Python-ideas
de local functions? Classes defined within the function? Exec from within the function (does it depend whose locals are passed)? What about a callable that’s not a function or class? Does it just catch exceptions raised inside the __call__ method itself? And so on. ______

[Python-ideas] Re: JSON encoder protocol (was Re: adding support for a "raw output" in JSON serializer)

2019-08-14 Thread Andrew Barnert via Python-ideas
o generate invalid JSON if they want to" is not > without precedent. Sure, and as soon as you discover another special case that millions of existing programs expect to be handled in a way that violates the RFC, that somehow nobody has noticed in the last 16 years, file a bug to handle that wit

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-14 Thread Andrew Barnert via Python-ideas
with you that we probably don’t want to add that support in the first place. But, as you say, at least some people disagree, so…) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.pytho

[Python-ideas] Re: Exception handling in objects

2019-08-14 Thread Rob Cliffe via Python-ideas
e It seems to me this idea will help library users more correctly handle their exceptions if this is problematic. This will save time and make code more reliable. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to

[Python-ideas] Re: JSON encoder protocol (was Re: adding support for a "raw output" in JSON serializer)

2019-08-14 Thread Andrew Barnert via Python-ideas
t be looked up anywhere. Avro is intentionally unversioned because it will never change, according to version 1.8 of the spec. And so on. We’re in great shape for the future. :) _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email

[Python-ideas] Re: JSON encoder protocol (was Re: adding support for a "raw output" in JSON serializer)

2019-08-14 Thread Andrew Barnert via Python-ideas
d start a separate thread. _______ 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/arch

[Python-ideas] Re: JSON encoder protocol (was Re: adding support for a "raw output" in JSON serializer)

2019-08-15 Thread Andrew Barnert via Python-ideas
expecting that one of the many JSON-based and JSON-like formats is going to become an official successor to JSON and take over its ubiquity. But that really isn’t likely (and you aren’t going to make it any more likely by arguing for it on python-ideas, and even less so by arguing for four of the

[Python-ideas] Re: JSON encoder protocol (was Re: adding support for a "raw output" in JSON serializer)

2019-08-15 Thread Andrew Barnert via Python-ideas
t. So this is only even worth discussing if the “serialize arbitrary text” feature is added. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/pyt

[Python-ideas] Re: Extend ast with types for * instead of using raw lists

2019-08-16 Thread Andrew Barnert via Python-ideas
that accepts ast_list as a subclass. (The lists_as_nodes flag becomes slightly more complicated, but still pretty simple—and besides, that’s all under-the-covers code.) ___ Python-ideas mailing list -- [email protected] To unsubscribe send an emai

[Python-ideas] Re: JSON encoder protocol

2019-08-17 Thread Andrew Barnert via Python-ideas
nything wrong with it if people really want it. ___________ 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.or

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-17 Thread Andrew Barnert via Python-ideas
et from choice?)_______ 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/lis

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-18 Thread Andrew Barnert via Python-ideas
the only thing anyone wants from it is something that doesn’t make sense, then maybe we’re better off without it? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.py

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-23 Thread Andrew Barnert via Python-ideas
e the case that their coverage is sufficient, or make some other argument that it’s guaranteed to be safe, or ignore str and write a _decimal_str similar to the existing _float_str, or find a way to validate it that isn’t too slow. _______ Python-ideas mailing

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Andrew Barnert via Python-ideas
dd that PEP and ... > honnestly not very used to github. > > In short, can you help me and advise on this? > > Thanks a lot and best regards, > Michaël Hooreman > > > _______ > Python-ideas mailing list -- [email protected]

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-23 Thread Andrew Barnert via Python-ideas
d advise on this? > > Thanks a lot and best regards, > Michaël Hooreman > > > _______ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-23 Thread Andrew Barnert via Python-ideas
On Aug 23, 2019, at 09:45, Christopher Barker wrote: > > Andrew, thanks for the background. > >> On Fri, Aug 23, 2019 at 8:25 AM Andrew Barnert via Python-ideas >> wrote: > >> Also, IIRC, it doesn’t do any post-check; it assumes calling str on any >> De

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Andrew Barnert via Python-ideas
rypoint script here. _______ 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

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Andrew Barnert via Python-ideas
thon than some >> packages to deploy with setuptools. Yes, but many of those use cases actually _can_ still benefit from setuptools, so it’s worth knowing what it can do rather than assuming it’s useless to anyone who isn’t deploying public monolithic releases to PyPI, much less getting angr

[Python-ideas] Re: Idea/PEP draft: Add support of __main__.py to argparse.ArgumentParser.prog

2019-08-24 Thread Andrew Barnert via Python-ideas
w _not_ to do that.” Especially since “Here’s how to do that” often illustrates what a huge pain it is to do that, which convinces people better than just saying “Don’t do that.” :) But in this case, you already had a solution to offer, so it’s not really the same thing. ___

[Python-ideas] Re: adding support for a "raw output" in JSON serializer

2019-08-26 Thread Andrew Barnert via Python-ideas
n the future that it can require Python 3.9. And at that point, it’s probably easier to get it into simplejson (or, if that’s not possible, to fork simplejson), get some experience with the feature in the wild, and only then propose it for stdlib inclusion. This is something most people don’t

[Python-ideas] Re: [new idea] dynamic return with using function argument

2019-08-26 Thread Andrew Barnert via Python-ideas
rd to teach and learn, and confusing to read even after you’d learned it. And returning a namedtuple (or taking a SimpleNamespace to fill, or just making it a mutating method of an object…) does seem like a much better way to solve the UX problem, as you said._______

[Python-ideas] Re: [new idea] dynamic return with using function argument

2019-08-26 Thread Andrew Barnert via Python-ideas
valid today? (And maybe you could even something similar on the def side, although fitting the “return params” in with the type of the normal return might be tricky.) On the plus side, this is ugly enough that hopefully nobody will ever ask for it. :) ______

[Python-ideas] Re: Custom string prefixes

2019-08-26 Thread Andrew Barnert via Python-ideas
other literals can work, but things like version can interact nicely with plain string literals, and r, and b if that’s appropriate, and most of all f, by just accepting a cooked string. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email

[Python-ideas] Re: Custom string prefixes

2019-08-26 Thread Andrew Barnert via Python-ideas
n, but off the top of my head: * Decimal, Fraction, np.float32, mpz, … * Path objects * Windows native Path objects, possibly with “really raw” processing to allow trailing backslashes * regex, possibly with flags, possibly with “really raw” backslashes * “Really raw” strings in general. * J

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
On Aug 26, 2019, at 23:43, Serhiy Storchaka wrote: > > 27.08.19 06:38, Andrew Barnert via Python-ideas пише: >> * JSON (register the stdlib or simplejson or ujson), > > What if the JSON suffix for? I think you’d mainly want it in combination with percent-, html-, or uu-equa

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
look more carefully at the C++ rules for that?) ___________ 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 htt

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
On Aug 27, 2019, at 08:52, Steven D'Aprano wrote: > >> On Tue, Aug 27, 2019 at 05:24:19AM -0700, Andrew Barnert via Python-ideas >> wrote: >> >> There is a possibility in between the two extremes of “useless” and >> “complete monster”: the prefix accept

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
ut I’d still do it at the REPL, and likely in real code as well. But I don’t think that choice would make my code worse (because when setup costs matter, I _wouldn’t_ make that choice), so I don’t see that as a problem. _______ Python-ideas mailing list -- pyt

[Python-ideas] Re: Add boolean attribute to datetime objects stating if they are tz-aware

2019-08-27 Thread Andrew Barnert via Python-ideas
a method? What happens if utcoffset raises NotImplementedError? (Or anything else, I suppose, but NotImplementedError is the documented behavior for the base class.) Should date get an attribute that’s always False, or is it sufficiently obvious to most people that dates are always nai

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
On Tuesday, August 27, 2019, 11:42:23 AM PDT, Serhiy Storchaka wrote: > 27.08.19 20:07, Andrew Barnert via Python-ideas пише: >> Before I get into this, let me ask you a question. What does the j suffix >> give us? You can write complex numbers without it just fine: >>

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
On Tuesday, August 27, 2019, 11:12:51 AM PDT, Chris Angelico wrote: >On Wed, Aug 28, 2019 at 3:10 AM Andrew Barnert via Python-ideas > wrote: >> Before I get into this, let me ask you a question. What does the j suffix >> give us? You can write complex numbers wi

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
eadability. Look at the plethora of suffixes C has for number and character literals. Look at how many things people still can’t do with them that they want to. Look at the way user literals work in C++. While technically you can argue that they are “syntax customization”, in practice the customiz

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
ster call or whatever per project. My program that takes 80 seconds to run starts up 2us faster because a few dozen (or at most hundred) constructed constants can be stored in the .pyc file. I don’t have to watch my speech to carefully avoid using the word “literal” imprecisely. None of those are worth anywhere n

[Python-ideas] Re: Custom string prefixes

2019-08-27 Thread Andrew Barnert via Python-ideas
This is compiled into code that looks up the suffix in a central registry and calls it with the token’s text. That’s all there is to it. Compare that adding Decimal (and Fraction, as you said last time) literals when the types aren’t even builtin. That’s more complexity, for less benefit. So why is it better? ___

[Python-ideas] Re: Custom string prefixes

2019-08-28 Thread Andrew Barnert via Python-ideas
far, even Steven’s facetious quaternion example that he proposed as too ridiculous for anyone to actually want. Is it a flaw that there may or may not be some examples that nobody has been able to think of that might work with a much more complicated feature but won’t work with this fea

[Python-ideas] Re: Custom string prefixes

2019-08-28 Thread Andrew Barnert via Python-ideas
that they’d all be unfamiliar cryptic one-letter things, is likely to arise. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-id

[Python-ideas] Re: Custom string prefixes

2019-08-28 Thread Andrew Barnert via Python-ideas
On Aug 28, 2019, at 01:05, Paul Moore wrote: > > On Wed, 28 Aug 2019 at 05:04, Andrew Barnert via Python-ideas > wrote: >> What matters here is not whether things like the OP’s czt'abc' or my 1.23f >> or 1.23d are literals to the compiler, but whether the

[Python-ideas] Re: Custom string prefixes

2019-08-28 Thread Andrew Barnert via Python-ideas
ple, it’s probably still worth looking at whether it’s feasible. _______ 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 ar

[Python-ideas] Re: Custom string prefixes

2019-08-29 Thread Andrew Barnert via Python-ideas
as a special restricted calling syntax, unless you want to actively impede your understanding of the code. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/ma

[Python-ideas] Re: Custom string prefixes

2019-08-29 Thread Andrew Barnert via Python-ideas
say, do blocks?). _______ 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@pyt

[Python-ideas] Re: Inspired by Scala, a new syntax for Union type

2019-08-29 Thread Andrew Barnert via Python-ideas
o if you want to re-suggest one of them, you probably want to find the original rejection and explain why it no longer applies._______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mai

[Python-ideas] Re: Custom string prefixes

2019-08-29 Thread Andrew Barnert via Python-ideas
r types? Because even years of Python experience hasn’t cured us of premature-optimization-itis. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/py

[Python-ideas] Re: Inspired by Scala, a new syntax for Union type

2019-08-29 Thread Andrew Barnert via Python-ideas
ibility by adding new operator methods to the type type. _______ 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 archi

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