Hello,

On Wed, 2 Dec 2020 21:15:22 +1100
Steven D'Aprano <st...@pearwood.info> wrote:

[First part was answered previously.]

> > > Is monkey-patching disallowed because `mod.func1` is defined as a 
> > > constant?  
> > 
> > What "disallowed" do you mean? The example above clearly says
> > "Leads to a warning". At "run-time" (i.e. eventually, after you've
> > done the monkey-patching), it's disallowed, yes.  
> 
> What disallowed do I mean? Exactly the same disallowed you just
> agreed with.

What's allowed and what's disallowed depends on whether a program just
"loads" or "actually starts to run". While it loads, it can do all the
tricks Python can do now. When it starts to run, then the actual
"strict" restrictions are applied. That's the crucial part of the
proposal, required to understand other aspects of the proposal.

> > > Or are all functions automatically considered to be 
> > > constants?  
> > 
> > That's the case, right.  
> 
> Okay, so all functions are automatically constants.

Yes, that's the whole idea.

[]

> [...]
> > > Occasionally I find that decorator syntax is not sufficient, and
> > > I've used the explicit "define-decorate-replace" form. That won't
> > > work either.  
> > 
> > You'll get a warning, and if you're smarter than the strict mode in
> > that case, you can disable it (in the same sense that you can
> > disable any warning in Python).  
> 
> So "strict mode" isn't actually strict, it's just a built-in linter.

It's strict. And it has many (more than one for sure) uses. One of the
uses is to improve code structure (or understanding of it) of the
existing codebases.


> -- 
> Steve


-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com
_______________________________________________
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/KDHWSDFD2YNSHB76TWUJJ6TC6LMY4MOZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to