other, related idea: instead of "??" use a double-token operator "! or":
value = ham! or spam! or eggs
optdict = dict(encoding=encoding! or sys.getdefaultencoding(),
css=options.css)
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
inside a with block, therefore,
> doesn't make sense and can only lead to obscure bugs.
>
Instead of disallowing code, this is a case for allowing with expressions:
def read_multiple(*filenames):
for filename in filenames:
yield (f.read() with open(filename) as
h the
addition of the returning that you have to track.
Jumping to functions is procedural programming. There is no reasonfor it to
be "considered harmful" any more than calling funcions; indeed even less
so.
Elazar
On Wed, Aug 15, 2018, 17:42 Eric Fahlgren wrote:
> How
You might also be interested in pep-563
<https://www.python.org/dev/peps/pep-0563/>. although it is not intended
for design by contract, it can help (syntactically).
Elazar
On Wed, Aug 15, 2018 at 11:07 PM Marko Ristin-Kaufmann <
[email protected]> wrote:
> Hi,
>
"=>" will make this possible:
def x => x
def x: int => x
def x: int -> int => x
It will also give one less meaning to the colon.
Elazar
On Tue, Aug 21, 2018 at 6:28 PM MRAB wrote:
> On 2018-08-22 01:25, Jonathan Fine wrote:
> > Hi Abe
> >
>
ramming languages (probably
trolling, as several people before me have pointed out).
Elazar
> Rhodri James schrieb am Fr., 21. Sep. 2018 um
> 15:46 Uhr:
>
>> On 20/09/18 19:56, Brett Cannon wrote:
>> > Based on the WG's recommendation and after discussing it with
ser code need pnly be aware of the specification, not the
implementation.
So method that _are_ overridden retain their contracts.
This is precisely like with types, since types are contracts (and vice
versa, in a way).
Elazar
___
Python-ideas mailing lis
Related:
https://github.com/python/mypy/issues/2103
- Elazar
On Fri, Oct 19, 2018 at 2:15 PM Anders Hovmöller
wrote:
>
>
> > On 19 Oct 2018, at 12:15, Steven D'Aprano wrote:
> >
> > On Fri, Oct 19, 2018 at 09:18:02AM +0200, Thomas Güttler wrote:
> >
>
irection of avoiding exceptions altogether, not
adding more intricate control flow directives. This proposal is basically
about introducing goto to the language.
Elazar
בתאריך יום ב׳, 7 בינו׳ 2019, 5:07, מאת Richard Damon <
[email protected]>:
> On 1/6/19 9:54 PM, simon.bordey
de that does
declare it, which can really help when reaaoning about the code, or
debugging it, as it makes many potential sources of bugs less likely.
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytho
ntiable, and all of those
> thing will be true for it.
>
> Mathematicians abstract things this way all the time. Groups,
> fields, vector spaces, etc. are all very abstract concepts,
> defined only as a set of objects having certain properties.
> If that's not duck typing, I
You have AssertionError for that.
Elazar
בתאריך יום ה׳, 11 באפר׳ 2019, 1:10, מאת Stefano Borini <
[email protected]>:
> I occasionally found situations where I want to raise an exception for
> errors that can only arise because the developer made a mistake, for
> ex
important - failure will be caught relatively
soon. And I believe that the ability to remove the check at runtime is
important, since isinstance calls have non-negligible impact on performance
in mypy.
(but other contributors here can correct me on this).
Elazar
בתאריך יום ג׳, 28 בנוב׳ 2017, 09:12
;
> > - assert is a statement *solely* so that the compiler can optimise it
> > out. If it's not optional,
> >it doesn't need to be a statement any more
> Another benefit of a statement vs function is only evaluating the
> error-related arguments when there'
condition ? first : second
>
> for the ternary if operator.
>
This suggests something like "ifNone" keyword :
x = a ifNone b ifNone c
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
ing
when used in a conditinal statement or a comprehension.
x = a if x else y else b # wait. what?
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
nary operation?
If any of these is allowed, it might confuse people.
It also break the ability to extract subexpression to variables.
(I kinda like this idea, but it doesn't look like a small, simple change to
the language, whereas ?? does).
Elazar
___
+ "string that the compiler puts together")
>
>
>
Or allow unary plus:
long_string = (
+ "some part of the string "
+ "with more words, actually is the same "
+ "string that the compiler puts together"
)
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
t classes to behave like comprehensions - i.e. code that is
not delayed will see the class' scope as an enclosing scope (since it is
not namespaced yet so there's no other way to refer to it) and delayed code
(e.g. lambdas or defs) will not.
Elazar
__
This pitfall sounds like a good reason to have such a function in the
standard library.
Elazar
בתאריך יום א׳, 15 באפר׳ 2018, 13:13, מאת Serhiy Storchaka <
[email protected]>:
> 15.04.18 12:49, Alexey Shrub пише:
> > В Воскресенье, 15 апр. 2018 в 12:40 , Serhiy Storchaka
> &
I think this method is easy to miss, since people look at the docs for
bytes (e.g. using dir(bytes)). It might be worthwhile to either add a
`bytes.to_int(...)` method (better, IMHO), or to point to int.from_bytes on
the relevant part of the docs.
Elazar
On Tue, May 1, 2018 at 5:09 PM Ken Hilton
The title is misleading - this has nothing to do with the conditional
operator, except small syntactic similarity.
Elazar
בתאריך יום ו׳, 25 במאי 2018, 05:40, מאת Jacco van Dorp <
[email protected]>:
> 2018-05-25 14:26 GMT+02:00 Kirill Balunov :
> > If it is an expressi
People working with sum types might expect the instances of the nested
class to be instances of the enclosing class. So if the nested class is a
namedtuple, you get a sum type. The only problem is that there's no way to
express this subtype relationship in code.
Elazar
בתאריך יום ד׳, 27
ted) ideas here:
https://github.com/python/mypy/issues/2464
Not the best link out there but it explains:
https://antonioleiva.com/sealed-classes-kotlin/
Elazar
On Wed, Jun 27, 2018 at 12:49 PM Ryan Gonzalez wrote:
> I *think* he's referring to something like this:
>
> class A(
d similar doubts about adding
> the matrix-multiplication operator @.)
>
It is just as specific as the `is` operator, and for the same reason.
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pyt
I know it is not generally considered a bad addition in any of
these languages, all of which put emphasis on readability.
Elazar
___
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
26 matches
Mail list logo