On 2021-05-28 at 12:22:22 +1000,
Chris Angelico <ros...@gmail.com> wrote:

> [...] calculate something once and reuse the value, because you know
> that it won't change (or don't care if it changes) [...]

> (Some day I'll learn how to do this in real life. Why can't I buy just
> one egg, and then reuse the same egg for every meal?)

Those are mutable eggs.  Try immutable eggs instead.

Or obtain a hen, aka an egg factory (and a rooster, too, but that's off
topic, even for Python Ideas).

ObPython:

    >>> egg = Egg()
    >>> egg.scramble()
    >>> egg.fry()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    EggStateError: cannot fry a scrambled egg

Mutability is the root of all evil.
_______________________________________________
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/7TTGNMQIHZKENGIYASYFBZI3KNJWY6CB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to