Liste des Groupes | Revenir à cl misc |
On 28/08/2024 16:25, John Ames wrote: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.On Wed, 28 Aug 2024 02:48:59 -0000 (UTC)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.
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 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.
Les messages affichés proviennent d'usenet.