[Python-Dev] Returning None from methods that mutate object state

Nick Coghlan ncoghlan at gmail.com
Sat May 17 16:18:20 CEST 2014


On 17 May 2014 19:56, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
>
> On Sat, 17 May 2014 15:14:00 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
> > During a conversation today, I realised that the convention of
> > returning None from methods that change an object's state isn't
> > captured the Programming Recommendations section of PEP 8.
>
> This is more an API design guideline than a programming recommandation,
> IMO. If we start putting those in PEP 8, it will end up bloating the
> PEP.
> (perhaps we need another PEP?)

A new entry in https://docs.python.org/3/faq/design.html may be a
reasonable option.

It's not like it comes up *that* often, and as Nathaniel pointed out, the
main advantage of writing it down somewhere is to be able to link to it in
the future.

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140518/08efce42/attachment.html>


More information about the Python-Dev mailing list