Re: Python (was Re: I did not inhale)

Liste des GroupesRevenir à cu programmer 
Sujet : Re: Python (was Re: I did not inhale)
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.misc
Date : 28. Aug 2024, 17:23:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vaniu4$3hi39$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
User-Agent : Mozilla Thunderbird
On 28/08/2024 17:41, Bart wrote:
On 28/08/2024 16:25, John Ames wrote:
On Wed, 28 Aug 2024 02:48:59 -0000 (UTC)
Sebastian <sebastian@here.com.invalid> wrote:
>
At my company, somebody tried to delete a method like method2() above,
but forgot the last few lines (represented by call6()). This does
not introduce a SyntaxError. Instead, call6() is now part of method1()
because it's at the same level of indentation. In most programming
languages, the beginning of method2() would be preceded by some
delimiter marking the end of method1(), which would prevent an
accidental merger of this type.
>
(Waiting for the Python advocates to fire back with "well, don't do
that, then!" and completely miss the point that it's exactly the topic
of contention here that Python's scope-by-layout approach that makes it
easy to do that...)
>
 Or they will say that whoever deleted method2 could also have deleted that 'end' line if one was used. Whilst also forgetting to delete method2's own 'end' line.
 Or maybe they deleted method2 plus both the preceding and succeeding lines so that method1 merges into method3.
 Generally, they might point all the ways that such oversights and all kinds of other typos can result in still-valid code in any language. But fragile syntax like Python's just makes it so easier to do that.
 
Having overly-large functions in any language is a risky way to code. Deleting large chunks of a function is risky in any language.  Failing to have check in place (like automated tests) that catch the error fairly quickly is also risky in any language.
But it is fair to say, I think, that Python's space-sensitive syntax combined with limited static checking (even with tools like pylint) mean you are more likely to be able to make a mistake that is not spotted until later in testing, compared to languages with explicit block delimiters.
And it is made worse by Python common practice of defining all methods of a class inline in the class, leading to long stretches of code that is all indented at least one tabstop.  It is possible to add methods to a class later on - optionally after giving a placeholder, but it is not common practice (as far as I have seen) :
class A :
     def __init__(self) :
         self.x = 10
     def foo(self) :
         "Increment x"
         self.x = self.x + 1
         return self.x
     def foobar(self) :
         "Complicated action"
          raise NotImplementedError
def A_foobar(self) :
     self.x = self.x * 10
     return self.x
A.foobar = A_foobar
(I'm sure a decorator could be used to make this slightly neater.)

Date Sujet#  Auteur
13 Apr 24 * Re: I did not inhale253Stefan Ram
13 Apr 24 `* Re: I did not inhale252Stefan Ram
15 Aug 24  `* Re: I did not inhale251Kalevi Kolttonen
16 Aug 24   `* Re: Python (was Re: I did not inhale)250Lawrence D'Oliveiro
16 Aug 24    +* Re: Python (was Re: I did not inhale)246Kaz Kylheku
16 Aug 24    i`* Re: Python (was Re: I did not inhale)245Kalevi Kolttonen
16 Aug 24    i +* Re: Python (was Re: I did not inhale)2John Ames
17 Aug 24    i i`- Re: Python (was Re: I did not inhale)1D
17 Aug 24    i +* Re: Python (was Re: I did not inhale)66Muttley
17 Aug 24    i i+* Re: Python (was Re: I did not inhale)63Dmitry A. Kazakov
17 Aug 24    i ii+* Re: Python (was Re: I did not inhale)60Lawrence D'Oliveiro
18 Aug 24    i iii`* Re: Python (was Re: I did not inhale)59Dmitry A. Kazakov
18 Aug 24    i iii +* Re: Python (was Re: I did not inhale)15Muttley
18 Aug 24    i iii i`* Re: Python (was Re: I did not inhale)14Dmitry A. Kazakov
18 Aug 24    i iii i `* Re: Python (was Re: I did not inhale)13Muttley
18 Aug 24    i iii i  +* Re: Python (was Re: I did not inhale)11Dmitry A. Kazakov
18 Aug 24    i iii i  i+* Re: Python (was Re: I did not inhale)2Kaz Kylheku
18 Aug 24    i iii i  ii`- Re: Python (was Re: I did not inhale)1Dmitry A. Kazakov
19 Aug 24    i iii i  i+- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
19 Aug 24    i iii i  i+- Re: Python (was Re: I did not inhale)1Muttley
25 Aug 24    i iii i  i`* Re: Python (was Re: I did not inhale)6Sebastian
25 Aug 24    i iii i  i `* Re: Python (was Re: I did not inhale)5Dmitry A. Kazakov
25 Aug 24    i iii i  i  +* Re: Python (was Re: I did not inhale)2vallor
25 Aug 24    i iii i  i  i`- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
25 Aug 24    i iii i  i  +- Re: Python (was Re: I did not inhale)1James Kuyper
25 Aug 24    i iii i  i  `- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
18 Aug 24    i iii i  `- Re: Python (was Re: I did not inhale)1Richard Kettlewell
18 Aug 24    i iii +* Re: Python (was Re: I did not inhale)2Kenny McCormack
18 Aug 24    i iii i`- Re: Python (was Re: I did not inhale)1Muttley
18 Aug 24    i iii +* Re: Python (was Re: I did not inhale)5Kaz Kylheku
18 Aug 24    i iii i`* Re: Python (was Re: I did not inhale)4Dmitry A. Kazakov
19 Aug 24    i iii i `* Re: Python (was Re: I did not inhale)3Kaz Kylheku
19 Aug 24    i iii i  `* Re: Python (was Re: I did not inhale)2Dmitry A. Kazakov
19 Aug 24    i iii i   `- Re: Python (was Re: I did not inhale)1Kaz Kylheku
19 Aug 24    i iii `* Re: Python (was Re: I did not inhale)36Lawrence D'Oliveiro
19 Aug 24    i iii  `* Re: Python (was Re: I did not inhale)35Dmitry A. Kazakov
19 Aug 24    i iii   +* Re: Python (was Re: I did not inhale)24David Brown
19 Aug 24    i iii   i`* Re: Python (was Re: I did not inhale)23Dmitry A. Kazakov
19 Aug 24    i iii   i +* Re: Python (was Re: I did not inhale)4Muttley
19 Aug 24    i iii   i i`* Re: Python (was Re: I did not inhale)3Dmitry A. Kazakov
19 Aug 24    i iii   i i +- Re: Python (was Re: I did not inhale)1Muttley
30 Sep 24    i iii   i i `- Re: Python (was Re: I did not inhale)1Bozo User
19 Aug 24    i iii   i +* Re: Python (was Re: I did not inhale)14David Brown
20 Aug 24    i iii   i i`* Re: Python (was Re: I did not inhale)13Dmitry A. Kazakov
20 Aug 24    i iii   i i +* Re: Python (was Re: I did not inhale)3Lawrence D'Oliveiro
20 Aug 24    i iii   i i i`* Re: Python (was Re: I did not inhale)2Dmitry A. Kazakov
21 Aug 24    i iii   i i i `- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
20 Aug 24    i iii   i i +* Re: Python (was Re: I did not inhale)7David Brown
20 Aug 24    i iii   i i i`* Re: Python (was Re: I did not inhale)6Dmitry A. Kazakov
20 Aug 24    i iii   i i i +* Re: Python (was Re: I did not inhale)2David Brown
20 Aug 24    i iii   i i i i`- Re: Python (was Re: I did not inhale)1Dmitry A. Kazakov
21 Aug 24    i iii   i i i `* Re: Python (was Re: I did not inhale)3Lawrence D'Oliveiro
21 Aug 24    i iii   i i i  `* Re: Python (was Re: I did not inhale)2Dmitry A. Kazakov
22 Aug 24    i iii   i i i   `- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
20 Aug 24    i iii   i i `* Re: Python (was Re: I did not inhale)2James Kuyper
21 Aug 24    i iii   i i  `- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
19 Aug 24    i iii   i `* Re: Python (was Re: I did not inhale)4Keith Thompson
19 Aug 24    i iii   i  `* Re: Python (was Re: I did not inhale)3John Ames
20 Aug 24    i iii   i   +- Re: Python (was Re: I did not inhale)1Muttley
20 Aug 24    i iii   i   `- Re: Python (was Re: I did not inhale)1Stefan Ram
19 Aug 24    i iii   +* Re: Python (was Re: I did not inhale)8Lawrence D'Oliveiro
19 Aug 24    i iii   i`* Re: Python (was Re: I did not inhale)7Dmitry A. Kazakov
19 Aug 24    i iii   i +* Re: Python (was Re: I did not inhale)2Keith Thompson
19 Aug 24    i iii   i i`- Re: Python (was Re: I did not inhale)1Dmitry A. Kazakov
20 Aug 24    i iii   i `* Re: Python (was Re: I did not inhale)4Lawrence D'Oliveiro
20 Aug 24    i iii   i  `* Re: Python (was Re: I did not inhale)3Dmitry A. Kazakov
20 Aug 24    i iii   i   +- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
20 Aug 24    i iii   i   `- Re: Python (was Re: I did not inhale)1D
21 Aug 24    i iii   `* Re: Python (was Re: I did not inhale)2vallor
21 Aug 24    i iii    `- Re: Python (was Re: I did not inhale)1Lawrence D'Oliveiro
18 Aug 24    i ii+- Re: Python (was Re: I did not inhale)1Muttley
18 Aug 24    i ii`- Re: Python (was Re: I did not inhale)1Eric Pozharski
18 Aug 24    i i`* Re: Python (was Re: I did not inhale)2David Brown
18 Aug 24    i i `- Re: Python (was Re: I did not inhale)1Muttley
18 Aug 24    i `* Re: Python (was Re: I did not inhale)176David Brown
18 Aug 24    i  +* Re: Python (was Re: I did not inhale)4Keith Thompson
19 Aug 24    i  i+- Re: Python (was Re: I did not inhale)1David Brown
20 Aug 24    i  i`* Re: Python (was Re: I did not inhale)2James Kuyper
20 Aug 24    i  i `- Re: Python (was Re: I did not inhale)1Keith Thompson
20 Aug 24    i  `* Re: Python (was Re: I did not inhale)171Kalevi Kolttonen
20 Aug 24    i   +* Re: Python (was Re: I did not inhale)3Muttley
20 Aug 24    i   i+- Re: Python (was Re: I did not inhale)1Lew Pitcher
20 Aug 24    i   i`- Re: Python (was Re: I did not inhale)1Kalevi Kolttonen
20 Aug 24    i   +* Re: Python (was Re: I did not inhale)164David Brown
20 Aug 24    i   i`* Re: Python (was Re: I did not inhale)163Kalevi Kolttonen
21 Aug 24    i   i +* Re: Python (was Re: I did not inhale)155David Brown
21 Aug 24    i   i i+* Re: Python (was Re: I did not inhale)136Muttley
21 Aug 24    i   i ii`* Re: Python (was Re: I did not inhale)135David Brown
21 Aug 24    i   i ii `* Re: Python (was Re: I did not inhale)134Muttley
21 Aug 24    i   i ii  `* Re: Python (was Re: I did not inhale)133David Brown
21 Aug 24    i   i ii   `* Re: Python (was Re: I did not inhale)132Muttley
21 Aug 24    i   i ii    `* Re: Python (was Re: I did not inhale)131David Brown
22 Aug 24    i   i ii     `* Re: Python (was Re: I did not inhale)130Muttley
22 Aug 24    i   i ii      +* Re: Python (was Re: I did not inhale)6D
22 Aug 24    i   i ii      i+* Re: Python (was Re: I did not inhale)4Muttley
22 Aug 24    i   i ii      ii`* Re: Python (was Re: I did not inhale)3D
22 Aug 24    i   i ii      ii `* Re: Python (was Re: I did not inhale)2Lew Pitcher
22 Aug 24    i   i ii      ii  `- Re: Python (was Re: I did not inhale)1Muttley
22 Aug 24    i   i ii      i`- Re: Python (was Re: I did not inhale)1David Brown
22 Aug 24    i   i ii      `* Re: Python (was Re: I did not inhale)123David Brown
22 Aug 24    i   i ii       +* Re: Python (was Re: I did not inhale)114Muttley
22 Aug 24    i   i ii       `* Re: Python (was Re: I did not inhale)8Lawrence D'Oliveiro
21 Aug 24    i   i i`* Re: Python (was Re: I did not inhale)18Lawrence D'Oliveiro
21 Aug 24    i   i `* Re: Python (was Re: I did not inhale)7Muttley
21 Aug 24    i   `* Re: Python (was Re: I did not inhale)3Lawrence D'Oliveiro
16 Aug 24    `* Re: Python (was Re: I did not inhale)3Kalevi Kolttonen

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal