[Python-ideas] Suggestion: Clear screen command for the REPL

אלעזר elazarg at gmail.com
Tue Sep 20 03:57:28 EDT 2016


On Tue, Sep 20, 2016 at 4:56 AM Steven D'Aprano <steve at pearwood.info> wrote:

> On Mon, Sep 19, 2016 at 01:35:53PM -0700, João Matos wrote:
> > Hello,
> >
> > I don't see why creating a clear command would interfere with
> dict.clear()
> > which is a function/method.
>
> For the same reason that you can't have a method called foo.while or
> foo.if or foo.raise. If clear is a "command" (a statement) it would need
> to be a keyword, like while, if and raise.
>
>
> This is since in Python there are no contextual keywords (like "override"
and "final" in C++). I remember encountering error in a Django project
where accessing u.pass was a syntax error, but there *was* a field "pass"
in u and they had to resort to getattr(u, "pass").
What is the reasoning behind that decision?

Elazar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160920/27a14223/attachment.html>


More information about the Python-ideas mailing list