Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: > > Antoon Pardon wrote: >> Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: >> > >> > Antoon Pardon wrote: >> >> Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: >> >> > Is this a Slippery Slope fallacious argument? >> >> > (http://c2.com/cgi/wiki?SlipperySlope) >> >> >> >> No it is not. >> >> >> >> [...] >> >> >> >> So the question I have is: Why is requiring me to give this function >> >> a name considered a good thing, when it leads to a situation that >> >> is considered bad practice in case of a number. >> >> >> >> -- >> > >> > Slippery Slope:: >> > "Argumentation that A is bad, because A might lead to B, and B >> > to C, and we all know C is very bad." >> >> But I have seen noone here argue that requiring functions to be named >> leads to requiring all variables to be named. >> > > If I misinterpret your intended meaning, then I'm terribly sorry. > However let me clarify how I understand your statements -- English is > not my native language but I'm quite sure I have good English skill. > > you said: > >> >> Why is requiring me to give this function >> >> a name considered a good thing, when it leads to a situation that >> >> is considered bad practice in case of a number. > > So in that question, one of the your assumption is that: > > "it (required function naming) ***LEADS*** to a situation that is > considered bad practice in case of a number (required number naming)"
The bad practice I was talking about was that the number was essentially given a meaningless name that didn't add any information. There is no adavantage using 'one' as a variable name over using 1 directly. If for some reason I needed a 2 in the code every time 'one' was used, I can hardy turn one = 1 into one = 2 Because people would still see things like: foo(one) In the cade and would expect this to be equivallent with foo(1) and not the equivallent of foo(2) > You have not seen anyone here > >> "argue that requiring functions to be named leads to requiring all > variables to be named" > > But obviously I have seen someone "argue that requiring functions to be > named leads to requiring **NUMBER** to be named" IMO you misinterpreted someome's word that way. > And you said that requiring number to be named is bad. Yes that is the starting point. But that is just an example of what bad practices will follow: the use of meaningless names. > Where did I misunderstand that you, with all good faith, were not > trying to say that "A leads B which is bad so "why is A considered a > good thing""? And how is it not slippery argument? This is my argument: 1) Using meaningless names is a bad coding practice. (with the number example) 2) Requiring names in particular circumstances will lead to meaninless names in those circumstances. 3) Requiring names for functions will lead to meanless names for some functions. 4) Requiring names for functions will thus lead to bad coding practice in a number of cases. > To put my response another way, I would ask: > Does Python require you to name all your number? expression? (Hint: the > answer is no) > > So where did you get the idea that requiring function to be named, as > Python does, leads to requiring number to be named? Is it in a research > anywhere? Or do majority of people here agree so (that it leads to)? I didn't get that idea. >> >> Why is requiring me to give this function >> >> a name considered a good thing, when it leads to a situation that >> >> is considered bad practice in case of a number. >> > >> > A === "requiring me to give function a name" >> > no B >> > C === "requiring me to give number a name" >> > >> > "Argumentation that requiring one to give function a name is bad, >> > because that might lead to requiring one to give number a name, and we >> > all know that that is very bad." >> >> That is not the arguement I'm making. >> >> The argument is that a particular pratice is considered bad coding, >> (with an example giving a number) and then showing that requiring >> a name for a function, almost makes such a practice inevitable (for >> certain functions used as parameters) >> > > Your example: > > def incr_cnt_by_one(obj): > obj.cnt += 1 > > treat_all(lst, incr_cnt_by_one) > > Did not in anyway show that the number one is required to be named. 1 > in that code is written literally; you didn't have to write "one = 1" > first. The function to increment obj.cnt by one is named. but the > number 1 itself is not named. You missed the point entirely. Isn't "one" a horrible name to use? It doesn't buy you anything over the use of 1 and may even cause confusion should anyone ever write something like one = 2. And isn't incr_cnt_by_one just as horrible a name to use. If I ever needed another function I couldn't just use another body with the same function name because something like def incr_cnt_by_one(obj): obj.buzy = False would probably cause just as much confusion as one = 2. But if I am required to give such simple functions a name it is almost inevitable I have to use such a horrible name. the alternative is to use bland names like "func" but what advantage does the name give you anyway? I either call all such one-liners "func" and then there is debug help in the name or I will have to be sure that every function somehow has a unique name. Having to track how far I am in the range of func1, func2 accross the code seem very cumbersome and not worth the while. Think of what may happen if you start using different packages each with there own func1, func2 range of functions. -- Antoon Pardon -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list