El mar, 12 oct 2021 a las 16:51, Jeremiah Vivian (<
nohackingofkrow...@gmail.com>) escribió:

> I posted a previous thread about overloading the unary `+` operator in
> strings with `ord`, and that expanded to more than just the unary `+`
> operator. So I'm saying now, there should be these implementations:
> > +string - `int(string, 10)` (or just `int(string)`)
> > -string - `int(string, 8)`
> > ~string - `int(string, 16)`
>
> Or:
> > +string - `string.lstrip()`
> > -string - `string.rstrip()`
> > ~string - `string.strip()`
>
> If anyone has better ideas, they can post it here.
>
Your other post mostly attracted sarcastic replies, so I'll be more direct:
It's highly unlikely that this will go anywhere.

To get a new operator on a builtin type, you'll have to show that:
- It's a common operation;
- There's no convenient way to do it already; and
- The meaning of the operator is reasonably clear to a reader of the code.

Recent examples of new features that met that bar are dict | in
https://www.python.org/dev/peps/pep-0584 and matrix multiply in
https://www.python.org/dev/peps/pep-0465/.

I don't think any of these proposals come close to meeting those criteria.


> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/E2NCFN5ASRHTP7HYWXL5DXDZ7LCTHA2G/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/KGAZXAOHVNPAIJQOF6FOI4P6MAPZMZM6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to