On 15 September 2016 at 21:11, אלעזר wrote:
> Yes the "class A[T]:" syntax requires on the ability to express variance as
> an operator, but not the other way around.
>
> It might be an argument in favor of switching to the + syntax: to make
> possible future syntax change in class definition some
Yes the "class A[T]:" syntax requires on the ability to express variance as
an operator, but not the other way around.
It might be an argument in favor of switching to the + syntax: to make
possible future syntax change in class definition somewhat easier to
swallow.
~Elazar
On Thu, Sep 15, 2016
On 15 September 2016 at 19:53, Ivan Levkivskyi wrote:
>
>
> On 15 September 2016 at 11:46, אלעזר wrote:
>>
>> And that thread is only about variance. What about the generic syntax?
>
>
> If you mean code like this:
>
> class Container[+T]:
> @abstractmethod
> def __contains__
On 15 September 2016 at 11:46, אלעזר wrote:
> And that thread is only about variance. What about the generic syntax?
>
If you mean code like this:
class Container[+T]:
@abstractmethod
def __contains__(self, x: T) -> bool: ...
then there is little chance that this will be a
And that thread is only about variance. What about the generic syntax?
On Thu, Sep 15, 2016 at 12:44 PM אלעזר wrote:
> Does that mean that if I did, it would be reconsidered?
>
> On Thu, Sep 15, 2016 at 12:43 PM Ivan Levkivskyi
> wrote:
>
>> On 15 September 2016 at 11:21, אלעזר wrote:
>>
Does that mean that if I did, it would be reconsidered?
On Thu, Sep 15, 2016 at 12:43 PM Ivan Levkivskyi
wrote:
> On 15 September 2016 at 11:21, אלעזר wrote:
>
>> This suggestion is so obvious that it's likely has been discussed, but I
>> can't find any reference (It's not what PEP-3124 talks a
On 15 September 2016 at 11:21, אלעזר wrote:
> This suggestion is so obvious that it's likely has been discussed, but I
> can't find any reference (It's not what PEP-3124 talks about).
>
>
You might want to read this tread
https://github.com/python/typing/issues/211 and another tread mentioned
the
This suggestion is so obvious that it's likely has been discussed, but I
can't find any reference (It's not what PEP-3124 talks about).
Generic class syntax, now:
_T_co = TypeVar('_T', covariant=True)
class Container(Generic[_T_co]):
@abstractmethod
def __contains__(self,