Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Guido sees the light: PEP 8 updated Date: Mon, 18 Apr 2016 12:17:25 +0300 Organization: A noiseless patient Spider Lines: 31 Message-ID: <874mazs2ca.fsf@elektro.pacujo.net> References: <5711c1b3$0$1596$c3e8da3$5496439d@news.astraweb.com> <87shym6kpo.fsf@elektro.pacujo.net> <87h9f26ioa.fsf@elektro.pacujo.net> <1460809922.1918014.580580553.0AE05EE4@webmail.messagingengine.com> <878u0d7az5.fsf@elektro.pacujo.net> <8ff10001-1c49-4490-b873-018507243ea3@googlegroups.com> <877ffw5wjo.fsf@elektro.pacujo.net> <57143eee$0$1612$c3e8da3$5496439d@news.astraweb.com> <87ega3s5sv.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="23574"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ghmbUhrU+7i0KocKiaBqT" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:I48WCtQVQ/MsfdbwjaH5XJ1ehX8= sha1:4Cwg3WkhGyyFDOgfGlFeGohz0kk= Xref: csiph.com comp.lang.python:107259 Gregory Ewing : > Marko Rauhamaa wrote: >> Steven D'Aprano : >> >>>def Do_The_Thing(): >>> def internal_subpart_start(): ... >>> def internal_subpart_middle(): ... >>> def internal_subpart_end(): ... >>> ... >> >> That really should be done more. C weaned us from the routine Pascal >> mechanism, but there's no reason not to exploit it again in Python. > > Two things Python has that Pascal didn't are modules and classes. They > take care of a lot of the grouping that you had to rely on nested > functions for in Pascal. I don't think Pascal did it for grouping or readability but for conceptual correctness. When I moved from Pascal to C, I felt the absence of local functions; it was a slight unease about abstraction leakage. > I do find myself nesting functions like that in Python, but only very > occasionally. Same for me. Essentially, I use local functions to register callbacks. Decades of C has done that to us. Marko