Note that __lcontains__ (if it exists) would be called first, at least for
different types. So maybe it would be easier than you think. But I still
think it’s not needed.
On Tue, Nov 12, 2019 at 9:04 PM Andrew Barnert via Python-ideas <
python-ideas@python.org> wrote:
> On Nov 12, 2019, at
On Nov 12, 2019, at 17:00, Samuel Muldoon wrote:
>
> Currently, the `in` operator (also known as `__contains__`) always uses the
> rightmost argument's implementation.
>
> For example,
>
>>status = obj in "xylophone"
>
> Is similar to:
>
> status = "xylophone".__contains__( obj )
>
Hm... with only a little bit of cooperation of the container class (e.g.
xylophone), you could implement this yourself:
class xylophone:
def __contains__(self, item):
if hasattr(item, '__lcontains__'):
return item.__lcontains__(self)
return False
On Tue, Nov 12,
*Currently, the `in` operator (also known as `__contains__`) always uses
the rightmost argument's implementation.*
*For example,*
> * status = obj in "xylophone" *
>
*Is similar to:*
*status = "xylophone".__contains__( obj )*
*The current implementation of `__contains__` is similar
Yeah. Maybe I should replace regex ' *:=' rather than just ':='. That's
easy enough with the plugin
On Tue, Nov 12, 2019, 12:12 PM Mike Miller
wrote:
>
> On 2019-11-11 16:13, David Mertz wrote:
> > I implemented this discussed arrow operator in vim with conceal plugin.
> This is
> > an example
*/PEP 328 doesn’t seem to mention any of the names detailed below./*
I strongly advise reading PEPs as documentation once their work has
landed. At that point they are mostly historical documents and will
not be kept up to date going forward. IOW do not read any
import-related PEPs for
On Fri, Nov 8, 2019 at 11:07 AM Ricky Teachey wrote:
>
>
>> __import__ already has a 'level' argument.
>>
>
> doh! maybe "context" is better, then.
>
>
>> Not without frame inspection to know what import statements are in the
>> context manager's block.
>>
>>
> I don't doubt you know what you're
On Sat, Nov 9, 2019 at 10:57 AM Steve Barnes wrote:
>
>
>
>
> *From:* Brett Cannon
> *Sent:* 08 November 2019 18:10
> *To:* Ricky Teachey
> *Cc:* Dan Sommers <2qdxy4rzwzuui...@potatochowder.com>; python-ideas <
> python-ideas@python.org>
> *Subject:* [Python-ideas] Re: Suggest having a
On 2019-11-11 16:13, David Mertz wrote:
I implemented this discussed arrow operator in vim with conceal plugin. This is
an example given in PEP 572. It looks perfectly fine. It also does not require
ANY change to Python-the-language. It just means that I can type ':' followed
by '=' to
Hi,
> I mean, as shown in this example and a previous one I posted a screenshot
> of, I think it's cute and geeky to use a few math symbols in the same way
> in my editor. I've been doing that for a few years, and it never got
> beyond "slightly cute."
>
I would second this. I find it
10 matches
Mail list logo