[Python-ideas] Re: Python, Be Bold!

2020-01-06 Thread Ronald Oussoren via Python-ideas
> On 5 Jan 2020, at 22:41, Andrew Barnert via Python-ideas > wrote: > > On Jan 5, 2020, at 00:17, James Lu wrote: >> >>  >> I use macOS, and using Python is very confusing. >> >> - Apple's bundled Python 2.7. > > Apple has made a me

[Python-ideas] Re: Enhancing Zipapp

2020-01-08 Thread Andrew Barnert via Python-ideas
have any idea who to trust to get it 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://

[Python-ideas] Re: Enhancing Zipapp

2020-01-08 Thread Andrew Barnert via Python-ideas
ly in the sense that it starts running and quickly fails with an exception for most users. _______ 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: Enhancing Zipapp

2020-01-08 Thread Andrew Barnert via Python-ideas
wnloading a Mac-specific py2app app or something else that will definitely work instead of only maybe working and otherwise punting on it as a user problem that I have to figure out how to solve myself? The fact that I can copy that same zipapp to a Windows box and then figure out how to so

[Python-ideas] Re: Recommend UTF-8 mode on Windows

2020-01-10 Thread Andrew Barnert via Python-ideas
t Python’s mbcs codec should also change to (on Windows when UTF8 is enabled) use “legacy” if it exists and only otherwise use actual “mbcs”? Or that nobody should use this Windows feature on Python 3.8+? _______ Python-ideas mailing list -- python-ideas

[Python-ideas] Re: python -m quality of life improvements

2020-01-10 Thread Andrew Barnert via Python-ideas
to, or to use in place of sys.path for finding the main module? (Without knowing the intended use I don’t know which of those is appropriate, but I’m guessing one of them is.) _______ Python-ideas mailing list -- [email protected] To unsubscri

[Python-ideas] Re: python -m quality of life improvements

2020-01-11 Thread Andrew Barnert via Python-ideas
cording to some rule you can’t even tell us is supposed to make that any easier for anyone. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/

[Python-ideas] Re: python -m quality of life improvements

2020-01-12 Thread Andrew Barnert via Python-ideas
n’t use Python.! _______ 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@pyth

[Python-ideas] Re: Recommend UTF-8 mode on Windows

2020-01-13 Thread Andrew Barnert via Python-ideas
where the default codepage wasn’t Shift-JIS. ___________ 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:

[Python-ideas] Re: Improve SyntaxError for obvious issue:

2020-01-14 Thread Andrew Barnert via Python-ideas
all valid code and strictly bounded complexity on error recovery (so it may get as bad as worst-case cubic, but cubic on N<=5 so who cares) so they could usually produce error messages as good as most C compilers without the horrible mess of parsing that most C compilers need. __

[Python-ideas] Re: Suggestion for language addition

2020-01-16 Thread Rob Cliffe via Python-ideas
On 04/12/2019 23:41:19, Andrew Barnert via Python-ideas wrote: On Dec 4, 2019, at 12:14, Mike Miller wrote:  On 2019-12-04 11:05, David Mertz wrote: I've often wanted named loops. I know approaches to this have been proposed many times, and they all have their own warts. E.g. an a

[Python-ideas] Re: List - append

2020-01-19 Thread Andrew Barnert via Python-ideas
t it’s usually used only to mutate something that’s only relevant within the statement is a big part of the reason people actually like it once they see real examples. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to p

[Python-ideas] Re: List - append

2020-01-19 Thread Andrew Barnert via Python-ideas
ay when you have a mishmash of the two where it would make sense to write confusing things like `lst.sort() + lst.remove(10)` or a comprehension that mutates as it goes. Good uses of that kind of mishmash do exist, but aren’t that common. _______ Python-ideas m

[Python-ideas] Re: Resource imports (as strings/bytes)

2020-01-19 Thread Andrew Barnert via Python-ideas
what’s wrong with the function call syntax (a la setuptools)? The only reason import has to be special syntax in the first place is that it does stuff like adding bindings into the outer namespace, and your proposal (in this second version) doesn’t need that. ________

[Python-ideas] Re: List - append

2020-01-19 Thread Andrew Barnert via Python-ideas
ly do something like `bar = foo` instead of `bar = foo()` (and then don’t use `bar` in a way that would detectably cause a TypeError) that can’t be detected. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@python.

[Python-ideas] Re: Resource imports (as strings/bytes)

2020-01-19 Thread Andrew Barnert via Python-ideas
atever. You need some argument for why reading text files is so much more important than all the other things you use a module for that it needs to be builtin. The reason importing modules is special is the obvious bootstrapping problem: if you had to import a module to import modules, there

[Python-ideas] Re: Resource imports (as strings/bytes)

2020-01-19 Thread Andrew Barnert via Python-ideas
be having this argument. it's not a function tho ;) I’m sorry, but this doesn’t even make sense as a reply to what I said. I explained why import can’t be a function. But your resource import-expression (or import-not-an-expression-but-f-strings-treat-them-as-if-they-we’re) can be a function

[Python-ideas] Re: Resource imports (as strings/bytes)

2020-01-21 Thread Andrew Barnert via Python-ideas
er answer that isn’t a pain. ___ 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: List - append

2020-01-21 Thread Andrew Barnert via Python-ideas
s and methods around the most obvious way. ___________ 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:

[Python-ideas] Re: Resource imports (as strings/bytes)

2020-01-21 Thread Andrew Barnert via Python-ideas
nything that just gives you the raw bytes or text of a resource file. I’m not sure it’s useful enough to be worth building. But it might be fun enough to try even if I can’t think of a good use. :) _______ Python-ideas mailing list -- python-ideas@pyt

[Python-ideas] Re: addition of "nameof" operator

2020-01-21 Thread Andrew Barnert via Python-ideas
ste whenever I’m writing a lot of classes that need a repr, which seems to be exactly your use case, and I’ve never been bothered by doing that, much less considered that maybe it’s worth having either one as a builtin, before now. ___ Python-ideas

[Python-ideas] Re: addition of "nameof" operator

2020-01-21 Thread Andrew Barnert via Python-ideas
to figure out that it’s the “age” attribute of this via reflection (or maybe the compiler can do that). This also means you can pass around a reference to this.age and mutate this through that reference (and presumably nameof works on that reference too), which doesn’t make any sense in Python. _

[Python-ideas] Re: __repr__ helper(s) in reprlib

2020-01-21 Thread Andrew Barnert via Python-ideas
w__. If every param has an attribute with the same name, use that; otherwise, this doesn’t work. And if none of the automatic ways worked and you tried to use them anyway, you get an error. But it would be nice if this error were at class-defining time rather than at repr-calling time, so ma

[Python-ideas] Re: __repr__ helper(s) in reprlib

2020-01-21 Thread Andrew Barnert via Python-ideas
f-attributes > form is useful but too fiddly, it would be possible to add a stated > default of "figure it out by magic", and then the exact magic can be > redefined at will. I don’t think you can document something as “magic” and redefine it from version to version in Python wi

[Python-ideas] Re: docstring for dataclass fields

2020-01-22 Thread Andrew Barnert via Python-ideas
have code to generate help for a module that includes all of its attributes. That doesn’t make sense for class instances in general, but it does make sense for dataclass instances. And extending it to also include some string for each one makes sense. I wouldn’t be surprised if such things already

[Python-ideas] pickle.reduce and deconstruct

2020-01-23 Thread Andrew Barnert via Python-ideas
args.items())) return f"{func.__name__}({', '.join(args)})"     # or maybe as a class decorator    def auto_repr(cls):        def __repr__(self):            func, bound_args = inspect.deconstruct(self)        args = itertools.chain(             map(repr, bound_args.args),      

[Python-ideas] Re: Compound statement colon (Re: Re: Improve SyntaxError for obvious issue:)

2020-01-28 Thread Rob Cliffe via Python-ideas
alid meaning as something else... what's the point of the colon, otherwise? Seems like just grit on the screen. +1 Rob Cliffe _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] htt

[Python-ideas] Re: "and if" and "or if" for trailing if statements - including explicit fallthrough

2020-01-28 Thread Rob Cliffe via Python-ideas
rlook that execution is supposed to fall through. IMO it is also clearer than "or if", though we wouldn't know for sure until/unless "or if" was adopted in Python and we had had time to get used to it. Rob Cliffe _______ Python-ideas mail

[Python-ideas] Re: addition of "nameof" operator

2020-01-30 Thread Andrew Barnert via Python-ideas
n’t _want_ the name of the object, you want the name of the variable. And no object knows the name of the variable you used to access it. Even for classes and functions, the fact that class statements and def statements happen to produce a variable with the same name that’s stored in the objec

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Andrew Barnert via Python-ideas
C#, maybe it is a static typing error to use it on an attribute that can’t be statically checked? Or maybe a warning? I don’t know. Maybe that should even be left up to the type checkers as a QoI issue rather than defined by Python? ___ Python-ideas mailin

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Andrew Barnert via Python-ideas
e, you statically know whether foo.bar exists, and therefore the compiler can check that nameof is correct, but you dynamically don’t know, so the runtime cannot check that nameof is correct. It could check something significantly different, and less useful, but it can’t check the eq

[Python-ideas] Re: Proposal for an additional type system

2020-01-31 Thread Andrew Barnert via Python-ideas
ht be a reasonable proposal, but you’d need to look them all over and make the case for why one design is the right one to standardize on and why it needs to be standardized in the first place, not just suggest that we should have something underspecified. _____

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Andrew Barnert via Python-ideas
cannot tell the type, or the attributes of that type, the checker may report an error or a warning or nothing. If the type is explicitly Any, or if it’s determined to be some type intended to have dynamic attributes (like SimpleNamespace, or a bridge or proxy), the checker should not report an

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Andrew Barnert via Python-ideas
attr(spam, 'eggs'), which could be any arbitrary code”. Even if it were possible, it’s not clear what the benefit would be, and without someone making a case for a benefit, it’s not worth trying to come up with something clever in the first place. __

[Python-ideas] Re: addition of "nameof" operator

2020-01-31 Thread Andrew Barnert via Python-ideas
that breaks the point of the feature better? > IDEs are very much capable of refactoring strings. No they’re not. They have to guess at it using heuristics, which are complicated, and often get it wrong. Because it’s inherently ambiguous whether the string or substring “spam” is meant as the name

[Python-ideas] Re: !$? operators for gratuitous overloading

2020-02-02 Thread Andrew Barnert via Python-ideas
e’s nothing stopping someone from creating ambiguous operators… But I think the fact that code written with custom operators wouldn’t feel much like Python is a better argument against it than the practical difficulties. _______ Python-ideas mailing list -

[Python-ideas] Re: addition of "nameof" operator

2020-02-02 Thread Andrew Barnert via Python-ideas
data model, etc. in terms that make sense to Python programmers (as opposed to, e.g., the C spec, which is only intended to make sense to people writing C compilers)._______ Python-ideas mailing list -- [email protected] To unsubscribe send an email

[Python-ideas] Re: addition of "nameof" operator

2020-02-03 Thread Andrew Barnert via Python-ideas
ou edit. Couldn’t a Python tool just also keep track of every string and substring that has at least one match as a use or definition of an attribute? Yes. But I think it’s obvious why this is a lot more work and at least a little less useful. And that may be part of the reason Python has alway

[Python-ideas] Re: addition of "nameof" operator

2020-02-03 Thread Andrew Barnert via Python-ideas
eing proposed and how it helps, but also make the case that Python tools and Python programmers are likely to actually take advantage of it. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.

[Python-ideas] Re: !$? operators for gratuitous overloading

2020-02-03 Thread Andrew Barnert via Python-ideas
tions.Fraction, that would be pretty handy in the stdlib…) ___________ 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

[Python-ideas] Re: Perhaps allow leading zeroes in integer literals

2020-02-06 Thread Andrew Barnert via Python-ideas
e going to search, to be a problem. And they’re ubiquitously documented in C or shell terms that will give you C-style octal values, so most people who do search will be misled. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an e

[Python-ideas] Re: `raise as` to raise with current exception as cause

2020-02-07 Thread Andrew Barnert via Python-ideas
after that. (Unless you can convince them that this new feature is not only worth using, but so compelling that it’s worth being much more aggressive than usual in requiring the latest Python, which doesn’t seem all that likely.) ___________ Python-i

[Python-ideas] Re: `raise as` to raise with current exception as cause

2020-02-07 Thread Andrew Barnert via Python-ideas
problems I’m not seeing here. But it seems at least worth exploring. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.

[Python-ideas] Re: pickle.reduce and deconstruct

2020-02-07 Thread Andrew Barnert via Python-ideas
e a fun weekend project, so maybe it’s worth just diving in to see what we run into, and then just ask -ideas about the remaining open questions. If you don’t want to try it, there’s a good chance I will, but no promises as to when. ___________ Python-ideas m

[Python-ideas] Re: Pickle to/from filename or path

2020-02-07 Thread Andrew Barnert via Python-ideas
lip opener flip…), but might be worth putting in your own toolkit. _______ 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: `raise as` to raise with current exception as cause

2020-02-07 Thread Andrew Barnert via Python-ideas
of the borderline where three vs. seven characters would push it over the edge for any given developer? Maybe, but I doubt enough such cases to change things. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email t

[Python-ideas] Re: `raise as` to raise with current exception as cause

2020-02-07 Thread Andrew Barnert via Python-ideas
ut if it is, I think Shai’s idea (or mine, if I misinterpreted Shai’s) might be a decent match, and very simple. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mai

[Python-ideas] Re: statement-scoped context managers (was: Re: Pickle to/from filename or path)

2020-02-08 Thread Andrew Barnert via Python-ideas
o stop thinking of it as a syntactic transformation and instead think of the semantics directly: the with affects the innermost scope if it’s smaller than the innermost statement, even though there’s no way to rewrite it like that. But then nothing else in Python is defined as a syntactic rew

[Python-ideas] Re: Multi-threading interface idea

2020-02-08 Thread Andrew Barnert via Python-ideas
arn even the basic use of futures and executors, of course that's fine. And if you put it on PyPI, maybe others will find it useful as well. But I don't think there's any need for it in the stdlib or anything. _______ Python-ideas ma

[Python-ideas] Re: Function call in (kw)args

2020-02-09 Thread Andrew Barnert via Python-ideas
use, and maybe create that demand. ___________ 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: Function call in (kw)args

2020-02-09 Thread Andrew Barnert via Python-ideas
rapper @implicit_cast def f(x: int, y=2, *, z) -> int: return x+y+z_______ 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

[Python-ideas] Re: Function call in (kw)args

2020-02-09 Thread Andrew Barnert via Python-ideas
rget them, so you can just rely on it. The quick&dirty hack I posted was for Python 3.7, so it doesn’t support positional-only parameters because they don’t exist in 3.7, but it will handle keyword-only parameters and positional-or-keyword parameters, and default values, and decorated function

[Python-ideas] Re: New syntax for decorators that are compatible with both normal and async functions

2020-02-09 Thread Andrew Barnert via Python-ideas
fter functions, or a context to with around the original function, or a param-translator, or other common things that together cover 90% of your needs. The implementations of those handful of helpers would need to be verbose, but your code that uses them to create hundreds of different decorators wouldn

[Python-ideas] Re: pickle.reduce and deconstruct

2020-02-09 Thread Andrew Barnert via Python-ideas
ledispatch def transformator(x): return x @transformator.register def _(x: int): return str(x) spam = Spam(2, 3.0, z=[1, 2.0, 'abc']) print(transform(spam, transformer=transformator)) This should print: Spam(x='2', y=3.0, z=['1'

[Python-ideas] Re: New syntax for decorators that are compatible with both normal and async functions

2020-02-10 Thread Andrew Barnert via Python-ideas
best model for new code doesn’t mean it’s the always best model for porting all code. ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python

[Python-ideas] Re: Improving Traceback for Certain Errors by Expanding Source Displayed

2020-02-10 Thread Andrew Barnert via Python-ideas
cks to do that plus adding all kinds of useful heuristics might be nifty.) _______ 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: PEP 614: Relaxing Grammar Restrictions On Decorators

2020-02-11 Thread Andrew Barnert via Python-ideas
he PEP can dismiss the problem, just not in the way it currently 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/ M

[Python-ideas] Re: PEP 614: Relaxing Grammar Restrictions On Decorators

2020-02-11 Thread Andrew Barnert via Python-ideas
I figured out how to skip over all the docker-compose helpers…). I don’t know if anyone’s using it in real life code, but it should be fine to use as an example to show that even with such libraries there’s no ambiguity. ___________ Python-ideas mailing list --

[Python-ideas] Re: New syntax for decorators that are compatible with both normal and async functions

2020-02-11 Thread Andrew Barnert via Python-ideas
wisted and asyncio, even if the lowest level code that you rarely look at is very different. So I think it’s not really a problem for most people. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to pyth

[Python-ideas] Re: CSV Dictwriter - Handling escape characters

2020-02-12 Thread Andrew Barnert via Python-ideas
on to encode the text, you’d get the same result—either no answers, or bad answers from people who don’t know anything but are desperate for points so they just guess wildly at something that might be kind of similar to what you want. _______ Python-ideas mai

[Python-ideas] Re: PEP 572: Is it a good ideas that walrus operator can be used in assertions since it causes side effects?

2020-02-12 Thread Andrew Barnert via Python-ideas
possibly be getting 0 out of that calculation before realizing you’re actually getting None? ___________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/pytho

[Python-ideas] Re: Global thread executor

2020-02-15 Thread Andrew Barnert via Python-ideas
building a PyPI library, you can guess at all of this and see what people say, but if you add it to the stdlib you have to get it right the first time. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-15 Thread Andrew Barnert via Python-ideas
ng that makes some of these choices necessary or desirable. But otherwise, I think we’d be better off adding a SerialExecutor (that works with the existing Future type as-is) but not adding or changing anything else. _______ Python-ideas mailing list --

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-15 Thread Andrew Barnert via Python-ideas
onathan’s sense here. [4] Checking the docs, it looks like the immediate policy didn’t make into C++11 either. But anyway, the deferred policy did, and that’s serial in Jonathan’s sense._______ Python-ideas mailing list -- [email protected] To u

[Python-ideas] Re: Add Binary module.

2020-02-16 Thread Andrew Barnert via Python-ideas
-length ints. ___ 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: Exception-aware operators

2020-02-17 Thread Andrew Barnert via Python-ideas
ut you might come up with a great new feature. ___________ 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: Add Binary module.

2020-02-17 Thread Andrew Barnert via Python-ideas
d be in the stdlib. And, if it gets rejected, you still have it for your own use, and can publish it on PyPI for others. (And maybe, if it gets a lot more use than other people expected, you can propose it to be added to the stdlib again in the future. _______

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Andrew Barnert via Python-ideas
ackground thread. That’s the naming used in the third-party C++ and ObjC libs I’ve used most recently, and it may be more common than that—but it may not, in which case my reading may be idiosyncratic and not worth worrying about. _______ Python-ideas

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Andrew Barnert via Python-ideas
ve use as a word qualifies as “excessive swearing” per the CoC, surely an -ideas thread isn’t the place to have it? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.pyt

[Python-ideas] Re: Specify number of items to allocate for array.array() constructor

2020-02-21 Thread Andrew Barnert via Python-ideas
> That surprises me and I cannot explain it. Without reading the code, I can guess. The first one does two 500K allocations and a 500K memcpy; the second only does one 500K allocation but does 150K separate 4-byte copies, and the added cost of that loop and of not moving as many bytes at a

[Python-ideas] Re: SQL string prefix idea

2020-02-21 Thread Andrew Barnert via Python-ideas
ts; I think that’s the shortest—although definitely not cleanest—way to install a token-filtering import hook for Python 3.4, and only a few things have changed since then.)_______ Python-ideas mailing list -- [email protected] To unsubscribe send an em

[Python-ideas] Re: Proposal: Complex comprehensions containing statements

2020-02-21 Thread Andrew Barnert via Python-ideas
om inside a comprehension do? _______ 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.p

[Python-ideas] Re: Proposal: Complex comprehensions containing statements

2020-02-21 Thread Andrew Barnert via Python-ideas
> On Feb 21, 2020, at 15:34, Greg Ewing wrote: > > On 22/02/20 11:45 am, Andrew Barnert via Python-ideas wrote: >> there’s no reason you can’t write `[(yield None) for _ in range(3)]` to >> gather the first three values sent into your generator > > Currently thi

[Python-ideas] Re: SQL string prefix idea

2020-02-21 Thread Andrew Barnert via Python-ideas
whatever and you’re done. _______ 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: Meta: ideas for Python [-ideas]

2020-02-23 Thread Andrew Barnert via Python-ideas
5/06/hacking-python-without-hacking-python.html ___________ 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] Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
there's a good reason we haven't added a binary `~`.  It seems like I've seen discussion in the past. But I couldn't find such discussion. And as I'm currently taking some statistics courses, I'm getting R-feature-envy again... What do you think?  Aaron Hall _

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-02-23 Thread Andrew Barnert via Python-ideas
sn’t provide any of them.) Passing a char object, you’d know statically that it makes sense; passing a str object, you don’t. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.p

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
ce, `a ~= b` but I don't currently have a strong motivating use-case for 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 a

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
what we're currently doing in statsmodels right now because we lack the binary (in the sense of two-arguments) `~`. See: https://www.statsmodels.org/dev/example_formulas.html _______ Python-ideas mailing list -- [email protected] To unsubscrib

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
at PEP 465. Should I write up a PEP? ___ 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

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
.). Sympy is rather new, but I think they'd appreciate it since they have an entire subpackage for distributions: https://docs.sympy.org/latest/modules/stats.html I do envision other usages, but these are the strongest cases I have right now. ___ Python-i

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
dless. ___ 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-

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
My main goal here is to increase the flexibility of Python for various domains where I have used `object0 ~ object1` - and can't yet do so in Python. _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ide

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-23 Thread Aaron Hall via Python-ideas
countered in multiple domains, `object1 ~ object2`, possible in Python. _______ 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

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-24 Thread Aaron Hall via Python-ideas
ple think it should have context in integers where it binds strongly. Maybe Patsy is the right way to do it. Maybe this is ultimately a bad idea. But I want a record of the discussion and conclusion, and I want it to be the best reasoned one we can muster. ________

[Python-ideas] Re: Make ~ (tilde) a binary operator, e.g. __sim__(self, other)

2020-02-24 Thread Aaron Hall via Python-ideas
Thank you all for your discussion! Cheers! ACH ___ 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

[Python-ideas] Re: Means of comparing slices for intersection or containment containment and computing intersections or unions

2020-02-29 Thread Andrew Barnert via Python-ideas
hout even looking for it) in particular? ___________ 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/archiv

[Python-ideas] Re: More descriptive error message than "too many values to unpack"

2020-03-01 Thread Andrew Barnert via Python-ideas
a non-builtin type. How often do you accidentally unpack a length-6 dict where you wanted to unpack a length-2 dict? _______ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://m

[Python-ideas] Re: None should raise a new exception, NoneError

2020-03-02 Thread Andrew Barnert via Python-ideas
means, etc.—would all break. And what code would benefit? _______ 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://mai

[Python-ideas] Re: None should raise a new exception, NoneError

2020-03-02 Thread Andrew Barnert via Python-ideas
][d]?NoneError:None to be explicit.) Even in that case it’s still not the same thing. For example, if any of b, c, or d is None, the none-aware operators will still raise, but your exception-aware version will not. So, the fact that exception-aware operators could replace some but not most u

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-03-02 Thread Andrew Barnert via Python-ideas
rt, or if you want a double-linked list, etc.), as in C++, not a node. But there are cases where you’re dealing with complex objects that are internally linked up (e.g., I used to deal with a ton of C code that dealt with internally linked database/filesystem-style extents lists, and the handle is

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-03-03 Thread Andrew Barnert via Python-ideas
might turn out to be useful enough to qualify (byte I’m much less confident of—it comes up less often, and also once you start bikeshedding the interface there’s a lot more vagueness in the concept), or at least worth having a PEP to explain why it’s rejected. (But of course “if not for backwa

[Python-ideas] Re: Exception for parameter errors

2020-03-04 Thread Andrew Barnert via Python-ideas
l leaves functions that parse *args and **kw and raise TypeError manually, whether in Python or in C, but I suppose you can say that in that case it really isn’t a parameter error (the signature really is *args, **kw so everything matches). What about inspect.Signature.bind? _______

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-04 Thread Andrew Barnert via Python-ideas
dered) or np.array (where they aren’t even Boolean-values)? In particular, transitivity keeps coming up, but all of those examples are transitive (it’s never true that ahttps://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archive

[Python-ideas] Re: Exception for parameter errors

2020-03-04 Thread Andrew Barnert via Python-ideas
> What about inspect.Signature.bind? > > Do you have a specific concern? Just whether you’re proposing to change it as part of the proposal. I think you do want to, and I think it’ll be easy, but I don’t think either answer would be a deal breaker. More generally, I’m just tryin

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-04 Thread Andrew Barnert via Python-ideas
On Mar 4, 2020, at 01:56, Mark Dickinson wrote: > >> On Wed, Mar 4, 2020 at 9:22 AM Andrew Barnert via Python-ideas >> wrote: > >> Is there any commonly used or even imaginable useful type that uses them in >> weirder ways than set and float (wh

[Python-ideas] Re: New explicit methods to trim strings

2020-03-04 Thread Andrew Barnert via Python-ideas
t keyword param that accepts any iterable of strings. So when you have a set of prefixes, you don’t have to call s.lcut(tuple(prefixes)), you just pass the set as-is to s.lstrip(strings=prefixes)). ___________ Python-ideas mailing list -- [email protected]

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-04 Thread Andrew Barnert via Python-ideas
a TypeError.) Fitting this into the type algebra (& and | and -) is pretty easy. I’m not aware of anyone translating that idea to dynamic type systems, but it could be interesting. ___ Python-ideas mailing list -- [email protected] To uns

[Python-ideas] Re: New explicit methods to trim strings

2020-03-04 Thread Andrew Barnert via Python-ideas
via Python-ideas > wrote: > >  >> On Mar 30, 2019, at 12:30, MRAB wrote: >> >> I'd much prefer .lcut/.rcut to .cut_prefix/.cut_suffix, to match >> .lstrip/.rstrip. > > I agree that we should use either l/r or something to do with start/end. We

[Python-ideas] Re: Magnitude and ProtoMagnitude ABCs — primarily for argument validation

2020-03-05 Thread Andrew Barnert via Python-ideas
On Mar 5, 2020, at 05:24, Richard Damon wrote: > > On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote: >>> On Mar 4, 2020, at 19:12, Richard Damon wrote: >>> Yes, because of the NaN issue, you sort of need an 'Almost Total Order' and >>> '

<    5   6   7   8   9   10   11   12   13   14   >