"Tim Peters" <tim.one at home.com> wrote in message news:mailman.988070435.14712.python-list at python.org... > [Paolo Invernizzi] > > I think that use before assignment is one thing, and assignment that is > > never used is another... > > But it seems to me that the Borland warning is right, as is an > > expression of inefficient code... > > Hardly: if the compiler is smart enough to detect that an assignment is > dead, it's also smart enough to refrain from generating any code for it. > That makes it a nuisance complaint. > Personally I wouldn't object to a warning that says "take this source code out, dummy, because I won't eb generating code for it anyhow". Allows me to improve the maintainability of my code, and avoids other readers spending time wondering why a brainfart is there. But I agree it's a real pain in large projects when the initialisation is there for reason (3) below... Wouldn't even mind it *not* generating the code when it issued the warning (as long as it is provably correct in doing so). > > The "use before assignment" complain of other compilers is > > justified? So why dont follow the more efficient way of coding? > > A) Under any decently optimizing compiler, it's not more efficient. > > B) To shut up bogus use-before-def warnings from dumber compilers (and > we *never* want to disable use-before-def warnings). > These would be the compilers that *do* generate code for the redundant assignment? > C) Because sometimes code is very complex, and under *modification* > it's very easy to miss a new path in the code in which a local > vrbl is suddenly not defined before use. This isn't a nuisance > in C, it's a disaster. Initializing vrbls in complex C code is > basic defensive coding practice. > Cannot disagree. > > I dont work with a lot of compiler, but me too I'm a Borland > > fan <wink>. > > Never used it, but sounds fine to me. Surely they have options to shut up > nuisance complaints, though? You can do whatever you like in *your* code, > but in the *Python* code base we try not to push compilers to their limits, > let alone readers' brains beyond them <wink>. > > half-successful-anyway-ly y'rs - tim > wondering-which-half-some-days-ly y'rs - steve
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4