Re: Apache and suexec issue that wont let me run my python script
Op 05-06-13 11:19, Νικόλαος Κούρας schreef: > I'am a perosn that eaisly trust other people to have ethics, especially > python programmers who knows how difficult its to debug a script and have it > working. > Some people can be trusted, and actually try to help. > Some dont. > Chris is na example of the latter. At least he didnt wipe the whoile system > out. > And i do have access of my system 30 mins now. > And yes i will again root access to another person, which i beleive he can be > trsuted and give me some friendly help. You believing so, is not enough. > Tha is all i have to say and i'm not naive or fool. > As i said some people can actually be trusted. Yes you are naive and a fool. The existance of trustworthy people is not the issue. The issue is how do you protect your server from the untrustworthy ones. Chris has shown you that your method for the latter sucks, yet here you are publicly stating you will just proceed in the same way. Someone with malice in mind has only to win your trust here or elsewhere by faking he wants to help you and you seem willing to give them the root password to your server. On top of that you have made it public that this will likely work. That certainly makes you naive and a fool. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache and suexec issue that wont let me run my python script
Op 05-06-13 11:06, Νικόλαος Κούρας schreef: > Τη Τετάρτη, 5 Ιουνίου 2013 11:59:28 π.μ. UTC+3, ο χρήστης alex23 έγραψε: >> On Jun 5, 6:41 pm, Chris Angelico wrote: >> >>> This matter is far more serious than you seem to be giving it >>> consideration for. You complain that I violated your trust; you >>> violated the trust of people who are paying you money. >> >> >> I think the term I'm looking for here is: EPIC WIN :D > I didnt violate anything. Chris violated my treust. > There would have been no violation if he just look into en encoding issue and > not meddled with my customers mail and data. Yes you violated peoples trust. People trust you to act in a way to keep their data safe. Mailing your root password to someone you only know from a mailinglist/newsgroup is acting irresponsibly. That Chris has violated your trust, doesn't make your own irresponsible behaviour dissappear. Not only that, you made it public you would continue to act the same way in the future. If I had trusted you with my data, I would have felt my trust to be violated. Your actions are similar to someone who keeps a credit card for an organisation, gives the security code to a stranger and then complains the stranger moved a lot of money from one bank account to another (although all owned by you). Sure the stranger had no business doing that, but you sure were violating the trust of the organisation by acting so irresponsibly. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 13-06-13 10:08, Νικόλαος Κούρας schreef: > On 13/6/2013 10:58 πμ, Chris Angelico wrote: >> On Thu, Jun 13, 2013 at 5:42 PM, �� >> wrote: >>> On 13/6/2013 10:11 ��, Steven D'Aprano wrote: >>>> No! That creates a string from 16474 in base two: >>>> '0b10001011010' >>> >>> I disagree here. >>> 16474 is a number in base 10. Doing bin(16474) we get the binary >>> representation of number 16474 and not a string. >>> Why you say we receive a string while python presents a binary number? >> >> You can disagree all you like. Steven cited a simple point of fact, >> one which can be verified in any Python interpreter. Nikos, you are >> flat wrong here; bin(16474) creates a string. > > Indeed python embraced it in single quoting '0b10001011010' and > not as 0b10001011010 which in fact makes it a string. > > But since bin(16474) seems to create a string rather than an expected > number(at leat into my mind) then how do we get the binary > representation of the number 16474 as a number? You don't. You should remember that python (or any programming language) doesn't print numbers. It always prints string representations of numbers. It is just so that we are so used to the decimal representation that we think of that representation as being the number. Normally that is not a problem but it can cause confusion when you are working with mulitple representations. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 14-06-13 09:49, Nick the Gr33k schreef: > On 14/6/2013 10:36 πμ, Antoon Pardon wrote: >> Op 13-06-13 10:08, Νικόλαος Κούρας schreef: >>> >>> Indeed python embraced it in single quoting '0b10001011010' and >>> not as 0b10001011010 which in fact makes it a string. >>> >>> But since bin(16474) seems to create a string rather than an expected >>> number(at leat into my mind) then how do we get the binary >>> representation of the number 16474 as a number? >> >> You don't. You should remember that python (or any programming language) >> doesn't print numbers. It always prints string representations of >> numbers. It is just so that we are so used to the decimal representation >> that we think of that representation as being the number. >> >> Normally that is not a problem but it can cause confusion when you are >> working with mulitple representations. > Hold on! > Youa re basically saying here that: > > > >>> 16474 > 16474 > > is nto a number as we think but instead is string representation of a > number? Yes, or if you prefer what python prints is the decimal notation of the number. > > I dont think so, if it were a string representation of a number that > would print the following: > > >>> 16474 > '16474' No it wouldn't, You are confusing representation in the everyday meaning with representation as python jargon. > Python prints numbers: No it doesn't, numbers are abstract concepts that can be represented in various notations, these notations are strings. Those notaional strings end up being printed. As I said before we are so used in using the decimal notation that we often use the notation and the number interchangebly without a problem. But when we are working with multiple notations that can become confusing and we should be careful to seperate numbers from their representaions/notations. > but when we need a decimal integer There are no decimal integers. There is only a decimal notation of the number. Decimal, octal etc are not characteristics of the numbers themselves. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 14-06-13 10:37, Nick the Gr33k schreef: > On 14/6/2013 11:22 πμ, Antoon Pardon wrote: > >>> Python prints numbers: >> No it doesn't, numbers are abstract concepts that can be represented in >> various notations, these notations are strings. Those notaional strings >> end up being printed. As I said before we are so used in using the >> decimal notation that we often use the notation and the number >> interchangebly >> without a problem. But when we are working with multiple notations that >> can become confusing and we should be careful to seperate numbers >> from their >> representaions/notations. > > How do we separate a number then from its represenation-natation? What do you mean? Internally there is no representation linked to the number, so there is nothing to be seperated. Only when a number needs to be printed, is a representation for that number built and displayed. > What is a notation anywat? is it a way of displayment? but that would > be a represeantion then Yes a notation is a representation. However "represenation" is also a bit of python jargon that has a specific meaning. So in order to not confuse with multiple possible meanings for "representation" I chose to use "notation" >> There are no decimal integers. There is only a decimal notation of >> the number. >> Decimal, octal etc are not characteristics of the numbers themselves. > > > So everything we see like: > > 16474 > nikos > abc123 > > everything is a string and nothing is a number? not even number 1? There is a difference between "everything we see" as you write earlier and just plain "eveything" as you write later. Python works with numbers, but at the moment it has to display such a number it has to produce something that is printable. So it will build a string that can be used as a notation for that number, a numeral. And that is what will be displayed. -- Antoon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 14-06-13 11:32, Nick the Gr33k schreef: > I'mm not trolling man, i just have hard time understanding why numbers > acts as strings. They don't. No body claimed numbers acted like strings. What was explained, was that when numbers are displayed, they are converted into a notational string, which is then displayed. This to clear you of your confusion between numerals and numbers which you displayed by writing something like "the binary representation as a number" -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 14-06-13 14:36, Nick the Gr33k schreef: > On 14/6/2013 2:09 μμ, Antoon Pardon wrote: >> Op 14-06-13 11:32, Nick the Gr33k schreef: >>> I'mm not trolling man, i just have hard time understanding why numbers >>> acts as strings. >> They don't. No body claimed numbers acted like strings. What was explained, >> was that when numbers are displayed, they are converted into a notational >> string, which is then displayed. This to clear you of your confusion between >> numerals and numbers which you displayed by writing something like "the >> binary representation as a number" > Hold on. > number = an abstract sense > numeral = ? > notation = ? > represenation = ? I already explained these in previous responses. I am not going to repeat myself. IMO you are out of place here. You belong in a tutor class about basical computing concepts. There you can aquire the knowledge that is more or less expected of those who want to contribute here. I don't mind the occasional gap in knowledge but with you it seems more there is an occasional grain of knowledge in a sea of ignorance. To remedy the former a single explanation is mostly sufficient. To remedy the latter you need a tutorial course. Now there is nothing wrong in being ignorant. The question is how do you proceed from there. The answer is not by starting a project that is far above your ability and pestering the experts in the hope they will spoon feed you. -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 14-06-13 14:59, Nick the Gr33k schreef: > On 14/6/2013 1:50 μμ, Antoon Pardon wrote: >> Python works with numbers, but at the moment >> it has to display such a number it has to produce something >> that is printable. So it will build a string that can be >> used as a notation for that number, a numeral. And that >> is what will be displayed. > so a number is just a number but when this number needs to be displayed > into a monitor, then the printed form of that number we choose to call > it a numeral? > So, a numeral = a string representation of a number. Is this correct? Yes, when you print an integer, what actually happens is something along the following algorithm (python 2 code): def write_int(out, nr): ord0 = ord('0') lst = [] negative = False if nr < 0: negative = True nr = -nr while nr: digit = nr % 10 lst.append(chr(digit + ord0)) nr /= 10 if negative: lst.append('-') lst.reverse() if not lst: lst.append('0') numeral = ''.join(lst) out.write(numeral) -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
Op 14-06-13 18:09, Steven D'Aprano schreef: On Fri, 14 Jun 2013 11:14:16 +0100, Robert Kern wrote: On 2013-06-14 10:50, Nick the Gr33k wrote: [snip question] This is all iw ant to know. This is all you need to read: http://docs.python.org/2/reference/expressions.html#boolean- operations Thank you Robert for contributing a helpful response. To everyone else... I know that Nikos' posts are draining. Sometimes he brings me to the brink of despair too. But if you aren't part of the solution, you are part of the problem: writing short-tempered, insulting posts after short-tempered, insulting post doesn't teach him, it just adds to EVERYBODY'S frustration with this never-ending serious of threads. That depends on your view. Maybe there are people who view you as part of the problem because you keep giving Nikos hope other people will solve his problems without him having to do anything significant himself. Please keep the snarky comments offlist. Contribute something helpful if you like, mute the thread or killfile Nikos if you must, but adding to the volume of unproductive junk doesn't do anyone any favour. In my opinion the only really helpful thing would be to ignore nikos. He has been given plenty or links, to read through in order to better his understanding and i think it is about time people made it clear they would no longer spoon feed him. Since that is probably not going to happen and you will probably continue contributing to the annoyance of other list members by continuing "helping" nikos, I don'y see why other can't continue to the annoyance in a away that they themselves may find somewhat amusing. -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 15-06-13 21:29, Steven D'Aprano schreef: On Sat, 15 Jun 2013 11:18:03 -0700, rusi wrote: At least two people -- Alex and Antoon -- have told you that by supporting Nikos, when everyone else wants him off list, you are part of the problem. And others have publicly thanked me for giving useful answers to Nikos, because they have learned from them. That doesn't contradict that you may be part of the problem. There is something like the law of diminishing returns. So the kind of respons that is helpful at the beginnig can become part of the problem when it becomes part of a seemingly endless cycle. You replied to Antoon, and agreed with his position that we should shun Nikos, then *immediately* contradicted yourself by stating that Robert Kern's helpful answers were "the ideal". And then, just to further demonstrate that your actions are at best inconsistent and at worst hypocritical, you have since gone on to fire barbs at Nikos instead of ignoring him. So please tend to the beam in your own eye before pointing at the mote in mine. So what. We all are somewhat inconsistent and hypocritical. That doesn't make your responses unproblematic. If in the future you want to respond like Robert Kern that seems fine enough. But if you continue like you are now, I'll consider you an enabler. Others -- Fabio -- have indicated their wish to leave the list due to everything becoming Nikos-tainted. That would be disappointing, but there's nothing I can do about it. Yes you can. You can stop enabling his behaviour. Now you may think this is an unacceptable option for and that is something you will have to decide for yourself but you do have a choice. Everyone is exasperated and talking of kill-filing him. Then why don't they? "Don't feed the troll" includes trying to beat him into submission with insults and half-witty remarks. Not feeding the troll doesn't help. If people are transgressing the social norms in a community, they need to get a response that makes it clear they crossed the line. If they don't you are implicetly broadcasting the message there is no out of bound behaviour. This is not about Nikos. It's about those who are also doing their bit to make this community an ugly, hostile place. I won't mention names -- you know who you are. Those who take it upon themselves to bait and prod and poke Nikos with insults and inflammatory replies. Appointing themselves Internet Police and making ridiculous claims that Nikos ought to be reported to the police. Sending bogus complaints to the domain registrar. There is a word for this sort of behaviour: bullying. I don't care how morally justified you think you are, you are now just as big a part of the problem as Nikos. You are trying to get it both ways. On the one hand you try to argue that there are no boundaries to what is acceptable by calling people who do try to enforce such boundaries the Internet Police. On the other hand you do suggest that playing Internet Police is out of bound behaviour. You have to make a choice. Either you don't want to recognize there can be something like out of bound behaviour and then people making this community an ugly hostile place is acceptable. Or you think there is behaviour that is out of bounds and then you must consider the possiblity that Nikos behaviour is an example of that and that what you consider ugly responses are people trying to address that out of bound behaviour and that you responding to Nikos as you do for the moment is perpetuating Nokos's unacceptable behaviour. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 15-06-13 02:28, Cameron Simpson schreef: > On 14Jun2013 15:59, Nikos as SuperHost Support wrote: > | So, a numeral = a string representation of a number. Is this correct? > > No, a numeral is an individual digit from the string representation of a > number. > So: 65 requires two numerals: '6' and '5'. Wrong context. A numeral as an individual digit is when you are talking about individual characters in a font. In such a context the set of glyphs that represent a digit are the numerals. However in a context of programming, numerals in general refer to the set of strings that represent a number. -- Antoon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 16-06-13 22:04, Steven D'Aprano schreef: > On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: > >> You are trying to get it both ways. On the one hand you try to argue >> that there are no boundaries > I have never, ever argued that there are no boundaries. I have repeatedly > made it clear to Nikos when I thought he was behaving improperly. And > I've done the same to others when they've acted improperly. That doesn't mean much. People can and do contradict themselves. So the fact that you made it clear to Nikos that he behaved improperly doesn't contradict you arguing somewhere else in a way that strongly suggest there are no boudaries. But I'll take note that you assert there are boundaries. So I'll take it that there is nothing wrong with playing Internet Police and taking people to task who transgress this boundaries? One thing I would like to make clear, is that I find you making it clear he behaviour is improper, to be inadequate for the reason that it ignores the possibility that you are playing a troll game. To make an analogy. Suppose someone want to play a game of troll-chess with you. The rules of troll-chess are the following. You are allowed any kind of piece movement or you can utter the statement: TIC (That is cheating). So in troll-chess you are allowed to move your bisshops like a queen. The only thing is, that if you do a move that is illegal in ordinary chess and your opponent answers with TIC, you must take back that move and make a move that is legal ordinary chess. So you make think you are making it clear to your troll-chess opponent that he is cheating for your troll-chess opponet you are just participating in his game. Now it is possible that your opponent is not in fact playing troll chess but just doesn't know enough of the game to know what is a legal move and what is not. In my opinion that doesn't matter. If your opponent doesn't want to invest the time needed to at least have a reasonable idea of what moves are legal and so in practice is hardly distinguishable from those who's intent it is to play troll chess, the end result is the same. >> to what is acceptable by calling people who >> do try to enforce such boundaries the Internet Police. On the other hand >> you do suggest that playing Internet Police is out of bound behaviour. > Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It > is unproductive, it makes this a hostile, unpleasant place to be, it > ruins the environment for the rest of the community, it's off topic, and > it simply doesn't work to discourage trolls. > I'm sorry but again I find that you are trying to have it both ways. IMO, and I suspect I'm not alone in that judgement, the threads that Nikos starts are in general, boring, repetitive, unproductive and draining. Not only that they are having an effect on the mailing list as a whole making it an unpleasant place. To the people who come with that complain, your respons, seems to be that if those people would just ignore the nikos-threads. They don't have to experience this unpleasantnes. But now that you start to experience unpleasantness, this unproductiveness and unpleasantness is cause for you to label behaviour unacceptable. But the same remedy is available here. Just ignore threads with behaviour that you find unacceptable and you (and others) don't have to experience this hostility and unpleasantness. Those you accuse of ruining the environment, find this environment already partly ruined by nikos and those that enable him. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 17-06-13 05:46, ru...@yahoo.com schreef: > On 06/16/2013 02:04 PM, Steven D'Aprano wrote: > >> Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It >> is unproductive, it makes this a hostile, unpleasant place to be, it >> ruins the environment for the rest of the community, it's off topic, and >> it simply doesn't work to discourage trolls. > The difficulty with trying to suppress such responses is that > the flamers get just as much pleasure from having a target > to unrestrainedly spew their pent up anger and vile at, as > the troll gets from simulating that reaction. The result is > a positive feedback loop. > Well if asocial behaviour of one provokes asocial behaviour in others, you can't claim the problem is not the social behaviour of the first. > > I could be wrong but I don't think Nikos is a pure troll -- > someone motivated purely by provoking reaction and discord. > He has a real website and his problems with Python seem like > genuine problems many beginners have. He seems to have little > knowledge, not much concern for anyone else but a lot of > determination to get things working. I have certainly known > people like that in the real world. Does that matter? I don't care what Nikos's motivation is. I care about the result or effect of his behaviour and that seems to differ very little from a troll. Intent is not magic. Bad behaviour with the best of intentions still results in annoyance. The only way it which intent makes a difference is when the person with good intentions, upon learning his behaviour is bothersome, tries to adapt his behaviour. > I speculate that half of his "bad behavior" is simple "I want > now and don't care about your conventions". The rest is a > reaction to "we're the alphas, your a beta" attitude expressed > by many here and later, overt hostility directed at him. He > has changed some things -- his posting method, he's made an > effort to understand his encoding issues, etc. I don't see that much change in his style. He just admitted not reading help files (because they are too technical for him). So essentialy he is asking we give him a beginners tutorial in everything he doesn't understand without much effort of him trying to understand things on his own and without much appreciation for the time of others. > So I think Steven's approach of responding to his questions, > at least those that are coherent and don't require reading a > dozen posts over several threads to piece together, with an > actual attempt to help (not a bunch of obscure hints, links > to wikipedia, and "you're an idiot" replies) is right. A respons that is in effect reinforcing bad bahaviour. > If Nikos fails to respond with better questions, then those > that do answer will get tired of trying to help and stop > answering. In the meantime everyone else can just killfile > or otherwise ignore him rather than egging him on by > intentionally provoking him (unless of course you enjoy > the results.) In the mean time you and steve can just killfile those you think are just egging him on. > So positive reinforcement for less bad behavior, negative > reinforcement (which for trolling is NO response, not negative > responses) for more bad. Standard behavioral conditioning. It means you are still reinforcing bad behaviour. Less bad is still bad. > And if it doesn't work it will still be a much nicer and > quieter here with only Nikos' trolling than with 10x as much > garbage from the local vigilantes who are more obnoxious > than he. But not quiet enough for some people. They hope that somehow punishing Nikos for his behaviour, although it may make the environment even less nice in the short term, may help to make the environment as nice again as it was before Nikos started his quest for spoon feeders. While reinforcing bad bahaviour provides no hope at all for that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 17-06-13 07:04, Ferrous Cranus schreef: > On 17/6/2013 6:46 πμ, ru...@yahoo.com wrote: >> I could be wrong but I don't think Nikos is a pure troll -- >> someone motivated purely by provoking reaction and discord. >> He has a real website and his problems with Python seem like >> genuine problems many beginners have. He seems to have little >> knowledge, not much concern for anyone else but a lot of >> determination to get things working. I have certainly known >> people like that in the real world. > This is the best definition of me. > It is very nice to see that someone has understood my character and > intentions. It still describes you as a jerk. Someone who acts without much concerns for others, is a jerk even if he has no malice in mind. > > The only thing i'm feeling guilty is that instead of reading help files > and PEP's which seem too technical for me, i prefer the live help of an > actual expert human being. > An yes, i'm not trolling this fine newsgroup. > If it wasn't for the help of some of the nicest fellows here my site > would be up and working neither with Python 3.3.2 nor with 2.6. Yes you are trolling this newsgroup. Intent is not magic. You just admitted to have little concerns for others. So if your behaviour happens to be rude and provoke people in behaving badly, you just don't care and continue to act essentially in the same way. That is trolling even if it is not your intention. > > Many difficulties that occurred to me when trying to write some code > were addresses here making my website actually happen. > I could have made it to Joomla(that's web design) instead of Python(web > development_ but i really like Python and the reason i ask in detail is > because i don't want only provided code that will help address an issue > i have, but i want to know "how" things work. Sure, but you don't want to make any effort yourself in getting to know how things work. You expect others to spoon feed you. -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 17-06-13 09:08, Cameron Simpson schreef: > On 17Jun2013 08:49, Antoon Pardon wrote: > | Op 15-06-13 02:28, Cameron Simpson schreef: > | > On 14Jun2013 15:59, Nikos as SuperHost Support > wrote: > | > | So, a numeral = a string representation of a number. Is this correct? > | > > | > No, a numeral is an individual digit from the string representation of a > number. > | > So: 65 requires two numerals: '6' and '5'. > | > | Wrong context. A numeral as an individual digit is when you are talking > about > | individual characters in a font. In such a context the set of glyphs that > | represent a digit are the numerals. > | > | However in a context of programming, numerals in general refer to the set of > | strings that represent a number. > > No, those are just "numbers" or "numeric strings" (if you're being > overt about them being strings at all). They're "numeric strings" > because they're composed of "numerals". If you think otherwise your > vocabulary needs adjusting. A numeral is a single digit. -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
Op 17-06-13 09:08, Cameron Simpson schreef: > On 17Jun2013 08:49, Antoon Pardon wrote: > | Op 15-06-13 02:28, Cameron Simpson schreef: > | > On 14Jun2013 15:59, Nikos as SuperHost Support > wrote: > | > | So, a numeral = a string representation of a number. Is this correct? > | > > | > No, a numeral is an individual digit from the string representation of a > number. > | > So: 65 requires two numerals: '6' and '5'. > | > | Wrong context. A numeral as an individual digit is when you are talking > about > | individual characters in a font. In such a context the set of glyphs that > | represent a digit are the numerals. > | > | However in a context of programming, numerals in general refer to the set of > | strings that represent a number. > > No, those are just "numbers" or "numeric strings" (if you're being > overt about them being strings at all). They're "numeric strings" > because they're composed of "numerals". If you think otherwise your > vocabulary needs adjusting. A numeral is a single digit. Just because you are unfamiliar with a context in which "numeral" means a representation of a number, doesn't imply my vocabularly needs adjusting. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
Op 15-06-13 19:51, Steven D'Aprano schreef: On Sat, 15 Jun 2013 18:43:42 +0100, Mark Lawrence wrote: A classic example of the pot calling the kettle black. If you're going to continue making unproductive, off-topic, inflammatory posts that prolong these already excessively large threads, Nikos won't be the only one kill-filed. If you have nothing helpful to say, send it to /dev/null. So you don't mind playing the Internet Police if it is about behaviour that bothers you? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 15-06-13 21:54, ru...@yahoo.com schreef: On 06/15/2013 12:18 PM, rusi wrote: On Jun 15, 10:52 pm, Steven D'Aprano wrote: On Sat, 15 Jun 2013 10:36:00 -0700, rusi wrote: With you as our spamming-guru, Onward! Sky is the limit! If you're going to continue making unproductive, off-topic, inflammatory posts that prolong these already excessively large threads, Nikos won't be the only one kill-filed. At least two people -- Alex and Antoon -- have told you that by supporting Nikos, when everyone else wants him off list, you are part of the problem. Nikos is only secondarily the problem, Steven not at all. The primary problem is a (relatively small) number of people who respond to every post by Nikos with a barrage of insults, demands, (what they think are) witty repartee, hints intended to "make" Nikos learn something, useless (to Nikos) links, new threads to discuss the "Nikos problem", and other trash that is far more obnoxious that anything Nikos posts and just serves to egg him on. Sorry but this is IMO a false equivallence. It ignores the important distinction between action and reaction. Does this number of people post a barrage of insult to no matter who? And you may find those responses more obnoxious they propbably are the reactions of people who are utterly fed up and think that if nobody is concerned about their annoyance they don't have to b econcerned about the annoyance of others either. Steven's advice on how to deal with Nikos was probably the most sensible thing I've seen posted here on the subject. Most sensible for what purpose? As far as I can see Steven's advice will just prolong the cycle of Nikos continuing to ask for spoonfeeding, showing very litle signs of understanding and keeping to hop from one problem/bug to the next until the mailing list has finished his project at which point he will probably start something new. If nikos's project was a college project we would have told him he has to make his homework himself. But now he is earning money with it, you seem to find it acceptable his job is done for him. I suggest that if you can and want to answer Nikos' question, do so directly and with a serious attempt address what it is he seems not to get, or killfile him and shut the fuck up. I suggest that if you want this to continue being a hospitable place, you don't encourage asocial behaviour. His behaviour may not bother you so much, but that shouldn't be the norm because others are less bothered with the barrage of insults Nikos is now receiving than with Nikos vampirizing this list, because they consider those insults deserved. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 17-06-13 19:56, ru...@yahoo.com schreef: > On 06/17/2013 02:15 AM, Antoon Pardon wrote: >> Op 17-06-13 05:46, ru...@yahoo.com schreef: >>> On 06/16/2013 02:04 PM, Steven D'Aprano wrote: >>> >>>> Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It >>>> is unproductive, it makes this a hostile, unpleasant place to be, it >>>> ruins the environment for the rest of the community, it's off topic, and >>>> it simply doesn't work to discourage trolls. >>> The difficulty with trying to suppress such responses is that >>> the flamers get just as much pleasure from having a target >>> to unrestrainedly spew their pent up anger and vile at, as >>> the troll gets from simulating that reaction. The result is >>> a positive feedback loop. >>> >> Well if asocial behaviour of one provokes asocial behaviour in >> others, you can't claim the problem is not the social behaviour >> of the first. > Sure I can. If you have a photodetector that activates a > bright light when it detects a flash, you can blame the first > flash for the fact that the bright light is on all the time. > Or you can say that stray flashes are to be expected now > and then in the environment of this system and the fault > is responding to them with a bright light. But that doesn't make sense. Your photodetector working as it does, is just as expected as the happening of stray flashes. There is no reason to differentiate between these two in terms of being expected or not. > As I said (and you disagree with below), I did see some > attempts to adapt his behavior but it is not realistic to > expect immediate acquiescence to every request made here, > especially given that a lot of them were/are bullshit. I don't care whether it is realistic or not. If he can't conform his behaviour in a reasonable way, he doesn't belong here. It is not realistic to expect someone who is just learing to swim to survive a jump in the deep. So we expect those people not to jump in the deep. We don't tolerate them jumping in the deep on the expectation that others will pull them out. That is wat Nikos keeps doing here, jumping in the deep. And a lot of people feel it is time we let him (metaphorically drown). >>> I speculate that half of his "bad behavior" is simple "I want >>> now and don't care about your conventions". The rest is a >>> reaction to "we're the alphas, your a beta" attitude expressed >>> by many here and later, overt hostility directed at him. He >>> has changed some things -- his posting method, he's made an >>> effort to understand his encoding issues, etc.' >> I don't see that much change in his style. He just admitted >> not reading help files (because they are too technical for >> him). So essentialy he is asking we give him a beginners >> tutorial in everything he doesn't understand without much >> effort of him trying to understand things on his own and >> without much appreciation for the time of others. > See my reply to ChrisA. Your reply doesn't address his unwillingness to read the documentation which was IMO rather apparant. > My personal feeling is that he tends to ask on the list too > quickly, but I suspect he also does more than you're giving > him credit for. He seems to be naive (eg the password event), > open and honest so when he says he has been trying to fix > something for hours I am prone to believe him. I don't care. In the end he is still jumping in the deep expecting others to drag him out. I don't care how much he does. Just as I don't care how much energy someone has put into learning to swim. If your skills are not adequate you don't jump into the deep. > I think his > approach to fixing is to try making changes more or less at > random, in part because he doesn't understand the docs (or > doesn't look at them because they haven't made sense to him > in the past) and in part because he hasn't developed any > skill in debugging (a skill that I think most everyone here > takes for granted but which doesn't come naturally to some > people) and which also accounts for the poor formulation of > his questions. I don't care whether he has trouble developping debuging skills or not. Just as I don't care if someone has trouble learning to swim or not. If it is reasonable to expect those skill in a specific environment, you are just rude if you enter without those skill and expect others to get you out of the troubles you probably will fall victim to. >> In the mean time you and steve can
Re: Don't feed the troll...
Op 18-06-13 01:02, Steven D'Aprano schreef: > On Mon, 17 Jun 2013 09:31:53 +0200, Antoon Pardon wrote: > >> Op 16-06-13 22:04, Steven D'Aprano schreef: >>> On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote: >>> >>>> You are trying to get it both ways. On the one hand you try to argue >>>> that there are no boundaries >>> I have never, ever argued that there are no boundaries. I have >>> repeatedly made it clear to Nikos when I thought he was behaving >>> improperly. And I've done the same to others when they've acted >>> improperly. >> That doesn't mean much. People can and do contradict themselves. So the >> fact that you made it clear to Nikos that he behaved improperly doesn't >> contradict you arguing somewhere else in a way that strongly suggest >> there are no boudaries. > Except that I have never, ever argued or suggested or even hinted that > there are no boundaries. The most you might legitimately accuse me of is > failing to be sufficiently vigilant at enforcing boundaries, according to > *your* idea of what is sufficient. > > >> But I'll take note that you assert there are boundaries. So I'll take it >> that there is nothing wrong with playing Internet Police and taking >> people to task who transgress this boundaries? > There is an enormous difference between doing what I, and others, have > done, which is to *politely* and *fairly* tell Nikos when he has > transgressed, and what the flame-warriors have done, which is just fire > off invective and insults. I disagree. You have been polite to the person who is ruining it for a lot of other people. What good is it to politely and fairly tell someone he is transgressing, when he will just continue in the same way. At some point you keeping to be polite and answering his questions, becomes enabling behaviour. Your politely and fairly pointing out his transgressions just becomes a way in cooperating with his annoying behaviour. You keeping it polite and fair doens't mean much. It isn't that difficult to act as an asshole while presenting oneself as being polite and fair. And no I don't want to imply you are an asshole. I just want to make it clear I don't put much weight is being polite and fair. > Not long ago I got taken to task, politely, off-list for responding to > Ranting Rick with sarcasm. Sometimes the momentary pleasure of a flame > outweighs the knowledge that it probably isn't doing any good and may be > doing harm. I get that and don't hold it against anyone if they succumb > to temptation once in a while. (Those like Peter Otten, who have been > regulars here for *years* while still showing the patience of a saint, > never fail to astonish me. If I could be even half as good.) > > But continuing to flame after being asked not to, and defending flamers, > that crosses the line from "spirit is willing, flesh is weak" into > *willfully bad* territory. You were asked not to continue encouraging Nikos's assholery behaviour. So it seems you are in that *willfully bad* territory yourself. And no, politely and fairly telling Nikos he is transgressing doesn't cut it. If he keeps acting like an asshole and you keep helping him you are encouraging his assholery behaviour no matter how many times you politely and fairly point out his transgressions. >> One thing I would like to make clear, is that I find you making it clear >> he behaviour is improper, to be inadequate for the reason that it >> ignores the possibility that you are playing a troll game. > Oh my, that's funny. > > But seriously, don't do that. I won't put up with that sort of thing. You > rarely contribute in this community, and now here you are trying to take > the moral high ground by defending flaming and criticising those who give > actual helpful, on-topic advice. I won't be called a troll by you. Do it > again, and you're plonked. > I didn't call you a troll. I just wanted you to consider you might be participating in what is essentially a troll game. And that what you see as pointing out a transgression, is just a kind of move in the game of the troll. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 19-06-13 05:46, ru...@yahoo.com schreef: > On 06/18/2013 02:22 AM, Antoon Pardon wrote: >> Op 17-06-13 19:56, ru...@yahoo.com schreef: > I was using the photodetector/light system as a emotion-free > analog of the troll/troll-feeders positive feedback system for > which you claimed it was clearly the troll's fault for initiating > the feedback condition. My intent was to point out that cause > and effect are intertwined in feedback systems and it is equally > valid to blame those responding to the troll for the end result > as to blame the troll. And, since occasional trolls are to > be expected, one is even justified in putting the preponderance > of blame on the responders. I don't remember making such a claim. What I do remember is you among others claiming that the problem was not (so much) the troll (Nikos) but the others. I only made the remark that you can't claim the troll is not a problem if he provokes behaviour you find problematic. And your last conclusion is unsound. You forget to include the fact that once a troll appeared, people reacting badly to the troll is also to be expected. So with regards to this aspect there is no difference between the troll and the responders, both being expected and so no ground to put the preponderance of blame on the responders. >> I don't care whether he has trouble developping debuging skills >> or not. Just as I don't care if someone has trouble learning >> to swim or not. If it is reasonable to expect those skill in >> a specific environment, you are just rude if you enter without >> those skill and expect others to get you out of the troubles >> you probably will fall victim to. > *Drowning: > I can understand your feeling but being realistic (whether > you care about that or not) it happens all the time and other > aspects of society accept that. Around where I live we have > mountain rescue units to retrieve both competent people who > have had bad luck and total idiots who shouldn't be outside > without a guardian. There are places the penalize the idiots > in various ways but both the practice and the line between > acceptable and unacceptable risk are controversial. I don't > accept you drawing the line for me, especially when I have > my own line formed by my own experience. Well others don't appreciate you drawing the lines for them either. If you think others have no business drawing the line for what is acceptable on this mailinglist/newsgroup then you have no business drawing such a line yourself. > Those who are annoyed excessively by Nikos can (relatively) > easily ignore him by filtering him and his threads and > continue to participate in the group as it was before Nikos. > > However, those who aren't bothered (as much) by him and are > willing to read or participate in his threads can not easily > ignore anti-Nikos hate posts because they can't easily filter > out those while leaving the non-hate ones and without also > filtering non-Nikos threads. (Perhaps there are newsgroup > readers that allow one to killfile an individual but only in > certain threads but I doubt they are common.) I find this a very one-sided view. Those annoyed excessively by Nikos can't easily ignore him without a cost. There may be people involved in such a tread they value and like to read. They can't easily filter the valuable contributions in such a thread from the nth repeated answer to the same question either. You ask of others they should tolerate this cost Nikos brings on for them but you protest when you have to take on this kind of cost yourself. As far as I see you have just the same options as those bothered by Nikos. Make some kind of cost benefit analysis and decide on that basis whether you consider it worth your while to continue reading/contributing to a particular thread. > Now its pretty clear that (in general) such hate-posts do not > serve to drive away their target and often increase the volume > and prolong the miscreant's stay. So their main utility is to > drive away those who wish to participate in Nikos' threads. I don't know it is that clear. I have the impression it can be rather effective in cases where the whole community makes it clear trolls are not welcome. Of course if part of the community is more bothered by those making trolls feel unwelcome than by the trolls themselves, such strive will of course attract them. > While you may consider that a good thing, I consider it coercion > and an attempt to forcibly restrict my free choice. It is also > the same behavior you accuse Nikos of -- being offensive to > force others to do what you want. If you want me to go along > with your proposal then convince me with rational arguments. No I don't part
Re: Don't feed the troll...
Op 19-06-13 20:40, Ian Kelly schreef: > On Wed, Jun 19, 2013 at 4:57 AM, Antoon Pardon > wrote: >> I don't remember making such a claim. What I do remember is >> you among others claiming that the problem was not (so much) >> the troll (Nikos) but the others. > Count me among those who feel this way. Well You are entitled to your judgement, but so are those who feel differently. For now I don't see a reason to favor your judgement over others. >> And your last conclusion is unsound. You forget to include the >> fact that once a troll appeared, people reacting badly to the >> troll is also to be expected. So with regards to this aspect >> there is no difference between the troll and the responders, >> both being expected and so no ground to put the preponderance >> of blame on the responders. > No, I don't agree with that at all. Trolls are to be expected because > there will always be those out in the world who want to have a little > fun and have no regard for either the list or those who use it. There > is nothing to be done about that. On the other hand, the flamers > responding to the trolls are regular contributers to the list who > presumably do care about keeping the list courteous, respectful, > welcoming and enjoyable to participate in. Toward that end, I do not > think it is at all unreasonable to expect posters not to throw those > principles out the window just because a troll showed up. There are two problems with your reasoning. The first is that you are equivocating on "expect". "Expect" can mean you will be surprised if it doesn't happen but it can also mean you will feel indignant or disappointed or something similar when it doesn't happen. Now I won't feel surprise when a troll turns up and I also won't feel surprise when the troll attracts flamers and it is my guess this is the meaning you use when you write trolls are to be expected. I doubt you want to express indignation or disappointment with the prospect of no trolls showing up. But then you seem to switch meaning when you talk about the flamers. There it sure looks like you are expressing indignation at the prospect of community members not upholding the principles you find important. The second problem is that I find it a one sided view. If you want a courteous, respectful, welcoming and enjoyable to participate in list, shouldn't you also be careful in not encouraging trollish behaviour? Being courteous to or cooperating with someone behaving trollishly, is IMO enabling that kind of behaviour and so those doing so, seem to already throw those priciples out the window because they are cooperating with the troll who is making this list less courteous, respectful, welcoming and enjoyable to participate in for a significant number of people. There is also the aspect that you can only try to keep something if you have the feeling it is still present. If contributers start feeling this list is no longer the hospitable place it once was, they feel less inclined to do the effort themselves. If you'd like people not to throw out certain principles you'd better make sure they don't feel those principles have already been thrown out. >> Well others don't appreciate you drawing the lines for them >> either. If you think others have no business drawing the line >> for what is acceptable on this mailinglist/newsgroup then you >> have no business drawing such a line yourself. > Ultimately there is no enforcement on this list, and all of us must > draw our own lines. The question then is: will one draw the line > somewhere that is respectful of the list and promotes positive > contributions, or somewhere that will push others toward kill-filing > one and/or giving up on the list altogether? Indeed, and how is it promoting positive contributions if you answer trollish contributions about the same way as you do interesting contributions? > So their ideal solution is to flame him until he goes away, with the > result being that the threads don't exist to begin with? If it's > difficult to filter "valuable contributions" from a thread while > trying to ignore every other post, think how much harder it will be to > got those same "valuable contributions" from a thread that doesn't > exist in the first place. Those valuable contributions will then probably turn up in an other thread. One that isn't a resource hog for all contributors. >> I don't know it is that clear. I have the impression it can be >> rather effective in cases where the whole community makes it >> clear trolls are not welcome. Of course if part of the community >> is more bothered by those making trolls feel unwelcome than by >> the trolls themselves, such
Re: Idea for key parameter in all() builting, would it be feasible?
Op 19-06-13 18:14, russ.po...@gmail.com schreef: > all(map(lambda x: bool(x), xrange(10**9))) Since you already have your answer, I just like to get your attention to the fact the the lambda is superfluous here. Your expression above is equivallent to all(map(bool, xrange(10**9))) -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 21-06-13 04:40, Ian Kelly schreef: > On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon > wrote: >> There are two problems with your reasoning. The first is that you >> are equivocating on "expect". "Expect" can mean you will be surprised >> if it doesn't happen but it can also mean you will feel indignant or >> disappointed or something similar when it doesn't happen. > > Perhaps I am, but it doesn't change my argument in any way. When a > troll shows up I am not happy about it, but I am not disappointed > either, because Trolls Happen. I am disappointed when members of the > community act in ways that are detrimental to the community. Better? But that last one doesn't ring true. Enabling a troll is also acting in a way that is detrimental to the community. But I haven't seen you express disappointment in that. Those that expressed their disappointment with the enabling behaviour were more or less told they should deal with it. So tell me, why should your disappointment merrit more consideration? > >> The second problem is that I find it a one sided view. If you want >> a courteous, respectful, welcoming and enjoyable to participate in >> list, shouldn't you also be careful in not encouraging trollish >> behaviour? Being courteous to or cooperating with someone behaving >> trollishly, is IMO enabling that kind of behaviour and so those >> doing so, seem to already throw those priciples out the window because >> they are cooperating with the troll who is making this list less >> courteous, respectful, welcoming and enjoyable to participate in >> for a significant number of people. > > You'll note that I haven't engaged Nikos at all in some time. That's > because I think he's a troll. I think though that those who are > continuing to help him do so because they do not think that he is a > troll. I am not going to try to thrust my own opinion of who is or is > not a troll and who can or cannot be given help upon the list -- that > is their opinion, they are entitled to it, and maybe they see > something in the exchange that I don't. That doesn't change one bit of the fact they are enabling someone who exhibits assholery behaviour. Who since he started here has regularly changed his identity, yet these enablers keep suggesting that those who are bothered by him should just killfile him. If they were serious with that suggestion they at least could have told Nikos they were only going to reply to one specific identity. > That is different in my eyes from somebody who does identify Nikos as > a troll and then goes on to egg him on anyway, whether it be courteous > or belligerent. In my eyes that is a difference that only counts at the start of an exchange. Helping others allthough a fine goal by itself is not something that can be used to justify any means. If you learn that the person you are helping is showing assholery behaviour and how you are helping, sure looks like encouraging that assholery behaviour. When you decide to mostly ignore that, you are showing no concern for the other contributers on the list and are acting in a way that is detrimental to the community. If you want the python list to be a hospitable place, you have to be attentive for signals from other contributors that the level of hospitability is decreasing for them. If you ignore them or brush them off you then risk loosing them as cooperators to that goal. So if later you find the level of hospitability is decreasing for you, you are more likely to get ignored or brushed off too. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 19-06-13 23:13, ru...@yahoo.com schreef: On 06/19/2013 04:57 AM, Antoon Pardon wrote: Op 19-06-13 05:46, ru...@yahoo.com schreef: On 06/18/2013 02:22 AM, Antoon Pardon wrote: I don't remember making such a claim. What I do remember is you among others claiming that the problem was not (so much) the troll (Nikos) but the others. I only made the remark that you can't claim the troll is not a problem if he provokes behaviour you find problematic. And your last conclusion is unsound. You forget to include the fact that once a troll appeared, people reacting badly to the troll is also to be expected. So with regards to this aspect there is no difference between the troll and the responders, both being expected and so no ground to put the preponderance of blame on the responders. No, "blame" implies assumption of a particular point of view. From a troll's viewpoint, newsgroup participants that *don't* respond are to blame because they deprive the troll of his fun. Our viewpoint is that of newsgroup participants. We assume they have volition, else this whole thread is pointless. Since they have a choice of how to respond, then if they chose to respond in a way that produces an undesirable outcome, then it is fair "blame" them. The troll is outside the volition of the group and so his appearance is effectively an act of nature. This seems a rather artificial division. Especially because the immediate cause that led to this discussion is Nikos. As the situation is now I see very little reason to exclude Nikos from the group. He has made a substantial number of contribution and has received a substantial number of replies. So on what grounds would you put Nikos outside the volition of this group? I am not "drawing the line for them", I am drawing it for me. I think you see a non-existent conflict because you are assume there is only one line. I do not make that assumption. If you think Nikos has crossed your line, then I acknowledge your right not to help him. I even acknowledge your right to flame him and encourage others to do so. My argument is that if you exercise your right (the flamage part) the results on the newsgroup, when considered on a best outcome for the most people basis, will be less good than if you choose not to exercise your right. Possibly. But I don't consider utiltarism such a good measuring stick for these kind of situations. Too easy to neglect the concerns of individuals or small groups. The costs are different in magnitude. Roughly: 1.People willing to read and possibly respond helpfully to Nikos. 2.People annoyed by Nikos who want him gone and don't want to see anything by him or in his threads. (and if people find you convincing) 3.People annoyed by Nikos but willing to read his threads in order to send antagonistic posts. If people ignore your call to spam Nikos with antagonistic posts (and stop the considerable amount of such activity already occurring) then the costs (difference compared to a no-Nikos newsgroup) might be: Group 1: 0 Group 2: 1 (killfile Nikos and kill or skip his new threads when encountered.) If people continue to send both unhelpful and antagonistic posts to Nikos: Group 1: 5 (can't killfile posters because they post in other non-Nikos threads. Have to skip large volume of junk posts based on visual peek at contents or recognition of poster as a vigilante.) Group 2: 1 (killfile Nikos and kill or skip his new threads when encountered.) I don't accept this as the way costs should be compared? Why are you adding the costs of the flamers together? Each flamer is an individual who should only be responsible for his own contribution. As such it seems that the cost each flamer is inducing is comparable to the cost Nikos is inducing. As for those annoyed by Nikos but who > "can't easily filter the valuable contributions > in [a Nikos] thread from the nth repeated answer to the same > question" how is that different from any non-Nikos thread other than that your proposed action that makes it harder? It is different because Non-Nikos threads in general don't contain so many repeated questions as Nikos threads. Of course. We all do that subconsciously every time we read a newsgroup. But that is not what we are discussing We are discussing the effects of two different policies of different interest groups on the newsgroup. You advocate a policy of not responding helpfully and responding aggressively to those exhibiting "undesirable" behavior where "undesirable" is defined by you or some vague group consensus. I advocate a policy not responding aggressively at all and responding helpfully or not at all based on a personal evaluation of the "undesirable" behavior. So the question to answer is: how do those different policies
Re: Default Value
Op 22-06-13 03:27, Ian Kelly schreef: On Fri, Jun 21, 2013 at 7:15 PM, Steven D'Aprano wrote: On Fri, 21 Jun 2013 23:49:51 +0100, MRAB wrote: On 21/06/2013 21:44, Rick Johnson wrote: [...] Which in Python would be the "MutableArgumentWarning". *school-bell* I notice that you've omitted any mention of how you'd know that the argument was mutable. That's easy. Just call ismutable(arg). The implementation of ismutable is just an implementation detail, somebody else can work that out. A language designer of the sheer genius of Rick can hardly be expected to worry himself about such trivial details. While we're at it, I would like to petition for a function terminates(f, args) that I can use to determine whether a function will terminate before I actually call it. Are you two guys now egging on Rick Johnson? -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 23-06-13 16:29, ru...@yahoo.com schreef: > On 06/21/2013 01:32 PM, Antoon Pardon wrote: >> Op 19-06-13 23:13, ru...@yahoo.com schreef: >>> The troll is outside the volition of the group and so his >>> appearance is effectively an act of nature. >> >> This seems a rather artificial division. Especially because the >> immediate cause that led to this discussion is Nikos. As the >> situation is now I see very little reason to exclude Nikos >> from the group. He has made a substantial number of contribution >> and has received a substantial number of replies. So on what >> grounds would you put Nikos outside the volition of this group? > > "made contributions"? I think you mean "asked questions". > He has not (as far as I tell) been a participant here in > the past, has not tried to help or participated in any other > threads, seems to be interested only in getting his own > problems solved, and not shown many signs of concern with > any form of group consensus(es), not responded to requests. > Isn't all that in large part the basis of your objection > to him? "Outside the volition of this group" seems like > a reasonable description to me. What do you mean with not a participant in the past? As far as I can see his first appearance was in dec 2011. That is over a year ago. It also seems that he always find people willing to engage with him. Is how the group treats him not also an aspect in deciding whether he belongs or not? But if you want to classify Nikos as somehow incorrigible and hope for better from others, I can understand that. I just have a harder time understanding why you seem to make it some kind of priority that people in the group should still be able to communicate with this person with only a minimum of hassle. >> Possibly. But I don't consider utiltarism such a good measuring >> stick for these kind of situations. Too easy to neglect the >> concerns of individuals or small groups. > > And your alternative that doesn't "neglect concerns of individuals > or small groups" would be what? Something that neglects the concerns > of the majority? I would love to see a proposed solution that > satisfies the concerns of every individual and group here. And > of course since you maintain above that trolls themselves are > legitimate members of the newsgroup, it should also satisfy their > desires as well. But sadly, in the real world there are conflicting > desires so I don't think your alternative exists. Are you trying to have a meaningful conversation or going for debating points? I didn't claim to have a solution that will satisfy everyone. But I do think there are better ways in handling this kind of situation other than one group of people by some kind of introspection coming to a conclusion of how best to deal with it, simply trying to argue others into compliance. Especially if this solution puts none of the burden on their own shoulders but all on others. >>> So the question to answer is: how do those different policies >>> affect the cost/benefits of the different groups and which one >>> leads to the greatest good for the most? >> >> And I don't think that is the right question. It leads to people >> who are less annoyed by this kind of behaviour to ignore or brush >> of people who are more annoyed and attempts by the former to >> make the latter shoulder the full burden while not bearing any >> costs themselves and even behaving in such a way as to increase >> the annoyance of the latter group. > > Addressed in more detail below. No "brushing off" involved, > only an attempt at the most reasonable tradeoff for everybody > (which means not agreeing to the vigilantes desire to engage > in flame wars with people that annoy them.) Yes, brushing off. Your attempt seems to consist solely on some kind of intropspection in which you came to some kind of conclusion and attempts to argue people into compliance. As far as I can see you didn't try to understand the view of others but just tried to convice them of the truth of your conclusion. That looks like brushing off to me. >> I have said something that can be interpretted as the first. >> But I made it clear because Nikos had allready receiced a >> ton of help like links of which he showed very little interest >> in actually reading. My boycot was meant for until he could >> show some results of him actively trying to solve his problems >> instead of us keeping to spoon feed him. > > What you see as a "ton of help like links" I submit did > not seem that way to Nikos. Consider the "help" in one > thread: > |> This is all yo
Re: What's wrong with this code? (UnboundLocalError: local variable referenced before assignment)
Op 24-06-13 21:47, pablobarhamal...@gmail.com schreef: Hi there! I'm quite new to programming, even newer in python (this is actually the first thing I try on it), and every other topic I've seen on forums about my problem doesn't seem to help. So, the following lines are intended to draw a white square (which it does), turn it to blue when you click on it, and back to white when you click on it again (and so on). Here's what I wrote (python 3 syntax): from tkinter import * root = Tk() root.geometry("500x500") w = Canvas(root, width=500, height=500) w.pack() coords = (x1, y1, x2, y2) = (100, 100, 200, 200) rect = w.create_rectangle(coords, fill="white") isWhite = True def change(event): if event.x> x1 and event.x< x2 and event.y> y1 and event.y< y2: if isWhite: w.itemconfig(rect, fill="blue") isWhite = False else: w.itemconfig(rect, fill="white") isWhite = True w.bind("", change) root.mainloop() The problem occurs when clicking on the white square. The following error appears: "if isWhite: UnboundLocalError: local variable 'isWhite' referenced before assignment" However, the isWhite variable is clearly defined at "True" a few lines before. No it is not. In Python, when you assign to a variable within a function, that variable will be treated as a local variable. If you have a global variable with the same name, that global variable will just for the duration of the function become inaccessible. The quick solution in this case is to include a global statement. Something like def change(event) global isWhite ... -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the semantics meaning of 'object'?
Op 23-06-13 18:35, Steven D'Aprano schreef: On Sun, 23 Jun 2013 10:15:38 -0600, Ian Kelly wrote: If you're worried about efficiency, you can also explicitly name the superclass in order to call the method directly, like: A.__init__(self, arg) Please don't. This is false economy. The time you save will be trivial, the overhead of inheritance is not going to be the bottleneck in your code, and by ignoring super, you only accomplish one thing: - if you use your class in multiple inheritance, it will be buggy. Which is why I don't understand that the python standard library still contains that kind of code. At least it did in 3.2 and I saw nothing in the 3.3 release notes that would make me suspect this has changed. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: What is the semantics meaning of 'object'?
Op 26-06-13 00:27, Mark Janssen schreef: >> The main problem is getting to the top/end of the call chain. Classic >> example is with __init__, but the same problem can also happen with >> other calls. Just a crazy theory, but would it be possible to >> construct a black-holing object that, for any given method name, >> returns a dummy function that ignores its args? (Other forms of >> attribute lookup aren't going to be a problem, I think, so this can be >> just methods/functions.) Then you just subclass from that all the >> time, instead of from object itself, and you should be able to safely >> call super's methods with whatever kwargs you haven't yourself >> processed. Would that work? >> >> Caveat: I have not done much with MI in Python, so my idea may be >> complete balderdash. > Here's how it *should* be made: the most superest, most badassed > object should take care of its children. New instances should > automatically call up the super chain (and not leave it up to the > subclasses), so that the parent classes can take care of the chil'en. > When something goes wrong the parent class has to look in and see > what's wrong. Could you explain why you think it should work this way? Maybe illustrate how this is supposed to work. Let take a very simple example. We have a class that works with a stream (anything with a write method). class Streamer: def __init__(self, strm): ... Now we find that we very often use this class with a file, so we would like to make a subclass that takes a filename as parameter. This we would write somehow like the following class Filer(Streamer): def __init__(self, fn): fl = open(fn, "a+") super.__init__(fl) ... Can you explain how this example should be written en work as you view things? -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 25-06-13 17:56, ru...@yahoo.com schreef: On 06/24/2013 07:37 AM, Antoon Pardon wrote: Op 23-06-13 16:29, ru...@yahoo.com schreef: On 06/21/2013 01:32 PM, Antoon Pardon wrote: Op 19-06-13 23:13, ru...@yahoo.com schreef: [...] I put forward what I thought was a rational way of thinking about the problem that balances the competing desires. You reject it with, "too easy to neglect the concerns of individuals or small groups". I point out that I don't see any way of satisfying the concerns of "individuals or small groups" and the majority and you accuse me "going for debating points". But you didn't even go to the trouble of trying to find out what those concerns would be and how strong people feel about them. You just took your assumptions about those concerns for granted and proceeded from there. Second having concerns and showing them are two different things. It may be possible that you have a lot of concerns for the flamers, that doesn't mean you actually showed them. If you need some sort of public "show", then I will publicly state that I too have been very frustrated with many of Nikos' posts and I am greatly sympathetic to the desire to tell the SOB to go take a flying fuck. That not withstanding I believe that responding that way does not help anything and is destructive. You really should learn the difference between telling and showing. So I'll stand by my statement that you show no concern for the discomfort of this group you are contributing to. As far as I can see your only concern is make them behave according to the solution, you arrived at without any contribution from themselves. The operative part there is: as far as you can see. There seem to be two options. Either there is nothing to see or I missed it, in which case this would have been a very good opportunity to point it out. You are free to ignore that and do what you want. But remember to tell me again how *I* have no concern for others. This is not a competion in trying to make the other look less concerned than the other. I don't care whether or not you have concerns for others. I'm just pointing out that if you would like to influence the behaviour of others in a direction you'd prefer, then you'd better show concerns about what drives them to that behaviour. I don't think that just stating that some group of people are somehow to blame according to some conclusion that logically followed from assumptions you could choose, and that thus this other group has to adapt its behaviour while you can carry on as usual, is such a good way either. You persist in presenting the situation as though I am just making things up to justify a proposal that makes my own use of the group easier. You ignore the rational I gave and the experience of countless internet users over the history of the internet. Why should I care about the rational you gave. It is based on your own assumptions, on how you weight the possible outcomes against each other. Someone who doesn't care about trolls or even may enjoy observing a heated exchange may come to an entirely different conclusion on what behaviour is good for the group in case he extrapolated his own preferences on the group. And you may not have purposely made things up to justify your proposal, but how you went about it, that is probably what you actually did. Because that is what we as humans generally do in this kind of situations. You sure seem awful careful with regards to someone you view as being outside the volition of the group while a the same time seeing nothing wrong with being very blunt about some subgroup of people you seem to consider inside the volition of the group, and whith which you have a particular problem. Again this is an "no concern" argument. Additionally... It is wrong. I've not advocated "being very blunt" to those who aggravate the situation by responding to trolling with flames and more aggression. I didn't mean you advocated it. I mean that you actually have been blunt about these people. These are you words: ] The primary problem is a (relatively small) number of people ] who respond to every post by Nikos with a barrage of insults, ] demands, (what they think are) witty repartee, hints intended ] to "make" Nikos learn something, useless (to Nikos) links, ] new threads to discuss the "Nikos problem", and other trash ] that is far more obnoxious that anything Nikos posts and just ] serves to egg him on. Now as far as I am concerned you can be as blunt as you want to be. I just don't understand why you think you should be so careful to Nikos, while at the same time you saw no need for careful wording here. A disproportionate number of your arguments above are that I am not concerned about those (including you) who are deeply frustrated with Nikos' bad behavior. No
Re: Don't feed the troll...
Op 25-06-13 19:25, Ian Kelly schreef: On Mon, Jun 24, 2013 at 7:37 AM, Antoon Pardon wrote: What do you mean with not a participant in the past? As far as I can see his first appearance was in dec 2011. That is over a year ago. It also seems that he always find people willing to engage with him. Is how the group treats him not also an aspect in deciding whether he belongs or not? Although it's true that he's been around for a while, it has in my mind only been very recently that his posts have started to become a problem. Fine. All the more reason to regard him as part of the group rather than outside the group IMO. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 26-06-13 23:02, Ian Kelly schreef: On Wed, Jun 26, 2013 at 1:46 PM, Antoon Pardon wrote: But you didn't even go to the trouble of trying to find out what those concerns would be and how strong people feel about them. You just took your assumptions about those concerns for granted and proceeded from there. Jumping back in here, I for one don't give a hoot about their concerns, beyond the basic assumption that they feel the same way I do about Nikos' threads and wish that he would leave. I just want to maintain a positive and welcoming atmosphere around here. So what do you think would be a good approach towards people who are behaving in conflict with this wish of yours? Just bluntly call them worse than the troll or try to approach them in a way that is less likely to antangonize them? I expect that most of the posters here are adults and can fend for themselves regarding their own concerns, and I'm not interested in being the list mom. It is not about being the list's mom. It's about approaching people, whom you would like to influence in changing their behaviour, in a way that is more likely to gain you their good will towards you. If what you want is indeed a positive and welcoming atmosphere, I would say such an approach would be more effective in getting it. Why should I care about the rational you gave. It is based on your own assumptions, on how you weight the possible outcomes against each other. Someone who doesn't care about trolls or even may enjoy observing a heated exchange may come to an entirely different conclusion on what behaviour is good for the group in case he extrapolated his own preferences on the group. And you may not have purposely made things up to justify your proposal, but how you went about it, that is probably what you actually did. Because that is what we as humans generally do in this kind of situations. "Made things up"? This response to the situation is not just our own assumptions at work, but the collective experience of the Internet, going back decades. The collective experience of theachers is that punishment for bad performance works, despite research showing otherwise. Besides I was talking about rurpy's basic assumptions about what the costs would be for various subgroups in different scenario's. These were all based on his own interpretations. What he did was trying to imagine how costly it would feel for him, should he have be in a particular situation with a particular preference. As far as I can see he didn't ask other people what their preference was and how costly particular situations would feel to them. So yes he made those up. Now I accept he was trying to get at an honest estimation of factors involved, but human biases working as they do, there is little reason to think his result is in any way objective or useful. Now as far as I am concerned you can be as blunt as you want to be. I just don't understand why you think you should be so careful to Nikos, while at the same time you saw no need for careful wording here. Nobody is suggesting that we should make any effort to try to avoid hurting Nikos' feelings, contrary to what you seem to be implying here. I am implying nothing. I'm just pointing out the difference between how rurpy explains we should behave towards Nikos and how he behaved towards the flamers. If there is some sort of implication it is with rurpy in that difference and not with me in me pointing it out. Be as blunt as you want with him, but please recognize that troll baiting /does not work/ as a means of making the troll go away and only serves to further degrade the list. It's not clear to me what you are precisely saying here. Do you think being blunt is a form of troll baiting or not? Because my impression of those who are bothered by the flamers, was that being blunt was just a form of troll baiting and would just cause similar kind of list degradation. Do you think being blunt is a good way in keeping a welcoming and postive atmosphere in this group? Second, I *am* concerned in that I find a lot of Nikos's responses frustrating and I realize other people feel the same. Stop telling you are concerned. Start showing. How? By joining in with the flaming and being just as counter-productive? I am not so sure it would be counter-productive. A joint flaming of a troll can be an effective way to increase coherence in a group. I'm not going to try to "show" my concern because it is not important to me whether others can see it. I doubt that is a good way in keeping this group positive and welcoming. But it is your choice. Do you have mumbers on that? Otherwise those three decades of internet don't mean much. The only actual study on the topic that I'm aware of is this one: http://www.guardian.co.uk/education/2011/jun/13/internet-trolls-improbable-research Thanks for t
Re: Closures in leu of pointers?
Op 29-06-13 16:02, Michael Torrie schreef: The real problem here is that you don't understand how python variables work. And in fact, python does not have variables. It has names that bind to objects. I don't understand why members of this list keep saying this. Sure the variables in python behave differently than those in C and algol But they behave similarly as those in smalltalk and lisp and I haven't seen anyone claim that smalltalk and lisp don't have variables. We might as well say that C doesn't have variables, it has names pointing to memory locations or value containers or something like that. AFAICS there is no reason why "variable" wouldn't be appropiate for python names as opposed to C names. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Closures in leu of pointers?
Op 29-06-13 21:23, Ian Kelly schreef: On Sat, Jun 29, 2013 at 11:02 AM, Antoon Pardon wrote: Op 29-06-13 16:02, Michael Torrie schreef: The real problem here is that you don't understand how python variables work. And in fact, python does not have variables. It has names that bind to objects. I don't understand why members of this list keep saying this. Sure the variables in python behave differently than those in C and algol But they behave similarly as those in smalltalk and lisp and I haven't seen anyone claim that smalltalk and lisp don't have variables. Perhaps because that is the terminology used by the language documentation: http://docs.python.org/3/reference/executionmodel.html#naming-and-binding I don't think this reference is as strong as you think it is. Here is a paragraph somewhat lower: ] If a name is bound in a block, it is a local variable of that block, ] unless declared as nonlocal. If a name is bound at the module level, ] it is a global variable. (The variables of the module code block are ] local and global.) If a variable is used in a code block but not ] defined there, it is a free variable. So the language documentation mentions these names as being variables. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 28-06-13 19:20, Ian Kelly schreef: On Thu, Jun 27, 2013 at 12:13 PM, Antoon Pardon wrote: So what do you think would be a good approach towards people who are behaving in conflict with this wish of yours? Just bluntly call them worse than the troll or try to approach them in a way that is less likely to antangonize them? Inform them that their behavior is damaging the list atmosphere, and ask them to please knock it off. Shaming the behavior works too, but I'd prefer to go with the former. That is a bit odd. Rurpy seemed to consider it a big nono if others used methods that would coerce him to change his behaviour. But here you see shaming as an option which seems a coercive method. So if some group views the response to trollish behaviour as too willing in cooperating with bad behaviour and as such damaging to the list, this group can then inform the cooperators that their behaviour is damaging the list atmosphere and ask to please knock it off. And they can consider more coercive methods too? The collective experience of theachers is that punishment for bad performance works, despite research showing otherwise. Flaming a troll is not punishing to them. I see I didn't make my point clear. This was my response to your remark about the collective experience going back decades. The collective experience often enough doesn't carry over wisdom but myth. To illustrate that, I gave the example of teachers whose collective experience is contradicted by the research. So if the only thing you can rely on is the collective experience of the group your knowledge isn't very relyable. I also find it somewhat odd that you talk about a troll here. AFAIU the people who are most annoyed by those flaming/protesting Nikos, don't seem to consider Nikos a troll. But if Nikos is not a troll then protesting Nikos's behaviour can't be protested against on the ground that it would be troll feeding. I am implying nothing. I'm just pointing out the difference between how rurpy explains we should behave towards Nikos and how he behaved towards the flamers. If there is some sort of implication it is with rurpy in that difference and not with me in me pointing it out. Your statement "I just don't understand why you think you should be so careful to Nikos" implies that somebody thinks we should be careful to Nikos, i.e. be careful to not hurt his feelings. At least that is how I read it, and I don't think it is true. What Rurpy's motivation would be for being careful to Nikos, you have to ask him. I'm only pointing out that in contrast to the blunt statement he made about those flaming/protesting Nikos, how he explained we should behave towards Nikos can accurately be described as careful. ... Do you think being blunt is a good way in keeping a welcoming and postive atmosphere in this group? I think it's better than being openly hostile. And speaking for myself, if somebody has a problem with my own behavior then I would prefer that they be blunt about it than cover it up with a false friendliness. Sure, but there is a difference between telling people you have a problem with their behaviour and telling people their behaviour is wrong or damaging. Yet when you have trouble with particular behaviour you go for the latter instead for the former. I am not so sure it would be counter-productive. A joint flaming of a troll can be an effective way to increase coherence in a group. Well, if flaming ever becomes the prevailing culture of the list, then I'm out. Sure, I can understand that. But doesn't this contradict somewhat that this is about others damaging this group. Increasing coherence would IMO be positive for a group, but you would still not like it. So it seems more about keeping an atmosphere that you prefer. There is nothing qrong with that, but if you can keep that in mind, your approach is more likely to be fruitful. -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 30-06-13 22:14, Νίκος schreef: Στις 30/6/2013 10:58 μμ, ο/η Robert Kern έγραψε: On 2013-06-30 18:24, Νίκος wrote: Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε: Why this when the approach to Nick the Incompetant Greek has been to roll out the red carpet? Your mother is incompetent who raised a brat like you. That is not acceptable behavior on this list. Please keep the gratuitous insults offlist. Ι'm sorry but please put yourself into my shows, Why should we? You, yourself have shown no willingness to put yourself in the shoes of others. When it was pointed out your behaviour was unacceptable, you continued just the same with no consideration of how much you were antagonising the members of this group. where in multiple threads i'm still discussed and being insulted as a troll and as an idiot and incompetent and stuff like that by lots of people who instead of actually replying to my posts they deviate and have endless conversation about me. What did you expect? That you could just keep asking to be helped in obnoxious ways without people commenting on that? Enough is enough. Iam not a troll, neither incompetent. Period. No not period. You have by your behaviour made yourself a reputation of being an incompetent inconsiderate jerk. You don't lose such a repuation by simply claiming you are not. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 30-06-13 23:57, Joshua Landau schreef: On 30 June 2013 20:58, Robert Kern wrote: On 2013-06-30 18:24, Νίκος wrote: Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε: Why this when the approach to Nick the Incompetant Greek has been to roll out the red carpet? Your mother is incompetent who raised a brat like you. That is not acceptable behavior on this list. Please keep the gratuitous insults offlist. As much as you are right, this argument was started by Mark. If you reprimand anyone (other threads being ignored) it should be him. Reacting only to Nick, even though what Nick said was undue, implies that you agree with Mark's actions. I don't agree Mark started this argument. That he gave a negative appraisal of Nikos is not starting an argument in itself. Remember that Nick is as much a human as all of us, he is bound to have his feelings hurt when so many people pick on him -- whether they are justified or not. So? Should we particularly care about Nikos's feelings? Nikos is not the victim, he is the instigator. And should his feelings get hurt when it is pointed out what picture people got from him through his own behaviour, I say good. May that way he'll learn that if he doesn't want to be considered an incompetent inconsiderate jerk, he shouldn't behave like one. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 30-06-13 19:50, Ian Kelly schreef: On Sun, Jun 30, 2013 at 11:25 AM, Antoon Pardon That is a bit odd. Rurpy seemed to consider it a big nono if others used methods that would coerce him to change his behaviour. But here you see shaming as an option which seems a coercive method. Well, if it didn't work the first time, I wouldn't keep at it. I don't consider that coercive. That is a fair point. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 09:52, Νίκος schreef: > Στις 1/7/2013 9:23 πμ, ο/η Antoon Pardon έγραψε: >>> Enough is enough. Iam not a troll, neither incompetent. Period. >> >> No not period. You have by your behaviour made yourself a reputation >> of being an incompetent inconsiderate jerk. You don't lose such a >> repuation by simply claiming you are not. > > Being a newbie doesn't mean that i'm incompetent jerk. That is true. You'll notice I don't judge all newbies as incompetent jerks. Just you > > All i did was asking for help for issues i couldn't solve. > That what everybody would do if he couldn't help himself solve something. You can try to frame what you did as an innocent newbie asking questions but that is not what happened. What happened is that you started a project on which other people relied that was way over your head. That makes you more than just a newbie that makes you incompetent. When you then started to get into trouble you didn't just ask questions, you almost demanded that people would fix your problems for you, bumping a thread within a few hours if you didn't get an answer within that time. That and similar behaviour makes you a jerk. > > You on the other hand never care to reply to any of my questions(so it > was in someway justified for you to say i didn't follow your advice), > but instead you seem to be willing to judge endlessly for the help i > receive from others. I am not judging you for the you receive. I am judging you for behaving liken an asshole and trying to deny it. > > You are continuously spamming the list and my threads with arguments > of trolling or not trolling instead of being helpful. > > I as well as others are fed up seeing you post about me. Its over 2 > weeks now and you still fight of whether i'm trolling or not. And it probably becomes longer. If you don't want this to fester, you'd better stop denying that you were behaving like an incompetent inconsiderate jerk. People can forget and forgive jerky behaviour but they don't tend to when they see the other denying he was behaving like a jerk. Because they then expect more of that kind of behaviour. > So shut your piehole and start proving yourself useful in this list. > Or sod off. > Preferably do the latter. Oh we do have illusions of grandeur, don't we? You are in no position to judge who is useful on this list or not. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 09:55, Νίκος schreef: > Στις 1/7/2013 9:37 πμ, ο/η Antoon Pardon έγραψε: >>> Remember that Nick is as much a human as all of us, he is bound to >>> have his feelings hurt when so many people pick on him -- whether they >>> are justified or not. >> >> So? Should we particularly care about Nikos's feelings? Nikos is not >> the victim, he is the instigator. And should his feelings get hurt >> when it is pointed out what picture people got from him through his >> own behaviour, I say good. May that way he'll learn that if he doesn't >> want to be considered an incompetent inconsiderate jerk, he shouldn't >> behave like one. > > Well, i will also follow your advice and not care at all about your > feeling when you read the following. This makes no sense. You are not following my advice, if you were already behaving like this. > > GO FUCK YOURSELF. > No thanks, I'm getting a little old for that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 11:05, Νίκος schreef: > Στις 1/7/2013 11:54 πμ, ο/η Antoon Pardon έγραψε: >>> So shut your piehole and start proving yourself useful in this list. >>> Or sod off. >>> Preferably do the latter. >> Oh we do have illusions of grandeur, don't we? You are in no position >> to judge who is useful on this list or not. > > I'am not waste any more time explaining my self to you since you have > already made up your mind and you refuse to believe that ni was > actually trying to solve my problems first and then asked and then > tried to apply the solutions, which in my my 2 last problems i was the > one who actually solve the problem. The above is a first class illustration of why I think you are problematic. We don't want you to explain yourself, we want you to change your behaviour. Someone behaving like a jerk explaining himself is still behaving like a jerk and the explanation is just a method for avoiding changing the behaviour. It doesn't matter that you tried to solve your problem first. Accepting that you were, you were still acting like a jerk when you bumped the thread after only a few hours. > Its easier to say to you "fuck off retard". Indeed that is much easier than trying to change your behaviour in order to no longer behave like a jerk. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: File exists but Python says 'not found'.
Op 01-07-13 12:47, preri...@gmail.com schreef: > I'm running this code that reads 2 csv files (one of them is train.csv). The > code gives an error saying 'file not does not exist'. However, the file does > exists in the same location as the .py file. Can someone please help me on > this. Thanks! > > Code Output--> > > Reading dataset... > Traceback (most recent call last): > File "c:\Project_1\regression_2.py", line 163, in > main(**args) > File "c:\Project_1\regression_2.py", line 80, in main > train_data = pd.read_csv(train) > File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 401, in > parser > _f > return _read(filepath_or_buffer, kwds) > File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 209, in > _read > parser = TextFileReader(filepath_or_buffer, **kwds) > File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 509, in > __init > __ > self._make_engine(self.engine) > File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 611, in > _make_ > engine > self._engine = CParserWrapper(self.f, **self.options) > File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 893, in > __init > __ > self._reader = _parser.TextReader(src, **kwds) > File "parser.pyx", line 312, in pandas._parser.TextReader.__cinit__ > (pandas\sr > c\parser.c:2846) > File "parser.pyx", line 512, in > pandas._parser.TextReader._setup_parser_source > (pandas\src\parser.c:4893) > IOError: File train.csv does not exist My guess is that train.csv is a symbolic link that points to a file that doesn't exist. So looking at your directory you can see an entry but actualy trying to open it will fail. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: File exists but Python says 'not found'.
Op 01-07-13 12:57, preri...@gmail.com schreef: > The variable 'train' is being called like this -> > > def main(train='train.csv', test='test.csv', submit='logistic_pred.csv'): > print "Reading dataset..." > train_data = pd.read_csv(train) > test_data = pd.read_csv(test) > > Let me know if I need to post the full code. I think Robert wanted to know how you started the program. What instruction do you use to launch? In what directory are you launching your program? Is that the same directory where train.csv is present? -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 11:37, Νίκος schreef: > Στις 1/7/2013 12:32 μμ, ο/η Antoon Pardon έγραψε: >> >> The above is a first class illustration of why I think you are >> problematic. We don't want you to explain yourself, we want >> you to change your behaviour. Someone behaving like a jerk >> explaining himself is still behaving like a jerk and the >> explanation is just a method for avoiding changing the >> behaviour. > > Change what dickhead? What behavior? > The behavior which you think its problematic? You are goin to play the ignorance card now? You are going to pretend it is just me and ignore all those others who made remarks about particular behaviour of you being annoying and unacceptable. I gave a specific answer, you bumping threads are only a few hours. You could have acknowledge that indeed you have been doing that and that you understand that it is annoying to others and you could have made it clear you intended to be more patient in the future. That could have been the beginning of you gaining again some good will from members of the group. Instead you chose to be a jerk about it. Pretending that the multiple remarks you have received about this behaviour didn't happen. > Maybe you should change your perception of understanding things. Why should I. From the people with whom I discussed your behaviour, a lot disputed you were a troll, but none disputed you were behaving like an asshole. Yes even those who were willing to further help you agreed that your behaviour was problematic. > > I dont expect anyone to solve my problems, iam happy if they point me > to a direction which i can solve it myself, that what the list is about. Sure, you just play the impatient jerk, who bumps threads and asks the same question again after people have pointed you in a direction. > > Did i told you to fuck off? Well never mind. Fuck off! > I think this needs some work. You need more creativity. Try to think of something more forceful. My little niece of 10 can do better than that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 11:46, Νίκος schreef: > Στις 1/7/2013 12:31 μμ, ο/η Steve Simmons έγραψε: > >> I don't know about the other members of this list but I am becoming >> increasingly disturbed by the rudeness and especially the foul language >> that is being perpetrated on this thread. Please, if you have any >> decency at all, continue the rest of this exchange by private email and >> allow python list members to continue discussing and helping each other >> with the python language and is adjuncts. Leave us in peace to enjoy our >> favoured language and let us see no more of your filth. >> >> Sent from a Galaxy far far away > > I have kept in quite more than 2 weeks while kept reading any mail in > this list especially the endless conversation and numerous name > callings against me. > You poor thing. A horrible two weeks of people who couldn't see the pearls of consideration you had shown and who were seeing you as somekind of asshole. > You should know that i'm fed up reading this. > If i'm provoked i will respond. Yes, because if you are fed up with how others behave, it is the fault of these others in provoking you. And of course when the others are fed of with how you behave, it is again the fault of the others because the have a faulty perception of understanding things. > it is not in my intentons to troll the list or talk dirty, but also i > cannot withstand anymore people talk down to me like that, when the > only thing i doid was to ask some questions, which in turn helped us all. Indeed it is not your intention to troll, you only want to ask questions. And if it turns out that your behaviour during the asking of these questions is very annoying, we should just shoulder the burden of that annoyance since it wasn't intended. Asking you to change your behaviour? That wouldn't be fair because you never intended to annoy. > Especially i cant stand people which never to spend 5 mins to reply, > but they are devoted a couple of weeks to belittle me instead. I can't stand people who seem to think that only people who have helped them can give valid criticism. Yet here you are. It seems we'll both have to find a way in coping. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 14:43, Steven D'Aprano schreef: > Νίκος, I am not going to wade through this long, long thread to see what > problem you are trying to solve today. Nikos is not trying to solve a problem in this thread. What happened is that the original poster here got a rather short answer to his question. Mark Laurence reacted questioning why this person didn't get the same kind of treatment as "Nick the Incompetant Greek". Then Nikos came in with an insulting remark. The rest developed from their. So nobody was trying to drive Nikos away (for asking questions). -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 16:01, Walter Hurry schreef: On Mon, 01 Jul 2013 10:56:54 +0200, Antoon Pardon wrote: Op 01-07-13 09:55, Νίκος schreef: Στις 1/7/2013 9:37 πμ, ο/η Antoon Pardon έγραψε: Remember that Nick is as much a human as all of us, he is bound to have his feelings hurt when so many people pick on him -- whether they are justified or not. So? Should we particularly care about Nikos's feelings? Nikos is not the victim, he is the instigator. And should his feelings get hurt when it is pointed out what picture people got from him through his own behaviour, I say good. May that way he'll learn that if he doesn't want to be considered an incompetent inconsiderate jerk, he shouldn't behave like one. Well, i will also follow your advice and not care at all about your feeling when you read the following. This makes no sense. You are not following my advice, if you were already behaving like this. GO FUCK YOURSELF. No thanks, I'm getting a little old for that. Please...enough. Polite request: consider killfiling him and having done with it. It is irritating to see all the responses even though I killfiled him long ago. Whilst I realise, of course, that it is entirely your prerogative to choose what to do, I have no doubt that many others feel as I do. How about the following comprimise. I'll get myself a second identity. Every respons I make to Nikos will be done with the same identity. Normal python exchanges will be done with the other. You can then simply killfile my identity that engages with Nikos. Let me know what you think about this. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 18:56, Joshua Landau schreef: To put things in perspective, these are the people who have been insulting on this post: Mark Lawrence (once, probably without meaning to be insulting) Nikos Antoon Pardon I don't consider something insulting if it can be supported by argument and evidence. I stand by my statement that Nikos behaved like incompetent inconsidered jerk can be supported as such. So if this is insulting it only is in the same matter that the truth can be insulting. And here are the people who have reminded them to stop: Steve Simmons Steven D'Aprano Andrew Berg Walter Hurry rusi Joshua Landau (me) So yes, Antoon Pardon and Nikos, please stop. You are not representing the list. I haven't followed any of the other arguments, true, but you two in particular are causing a lot of trouble for the rest of us. It is not hard to avoid making your disagreements public. Well nobody is representing the list. So where does that leave us? And perhaps I am causing a lot of trouble, that doesn't mean I am wrong. Maybe it is time to question the way this list in general tries to avoid trouble. -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 17:33, Steven D'Aprano schreef: On Mon, 01 Jul 2013 15:08:18 +0200, Antoon Pardon wrote: Op 01-07-13 14:43, Steven D'Aprano schreef: Νίκος, I am not going to wade through this long, long thread to see what problem you are trying to solve today. Nikos is not trying to solve a problem in this thread. What happened is that the original poster here got a rather short answer to his question. Mark Laurence reacted questioning why this person didn't get the same kind of treatment as "Nick the Incompetant Greek". Then Nikos came in with an insulting remark. The rest developed from their. Okay, thank you for explaining the situation. Now, please stop baiting Nikos. I am not baiting Nikos. I know he mentions this two week period but all I have done in the last two weeks that involves Nikos as a subject is the "Don't feed the troll thread" and today this thread. So if he feels baited for the last two weeks, it is either by that "Don't feed the troll" thread or I have very little to do with it. -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 02-07-13 01:17, Denis McMahon schreef: > On Mon, 01 Jul 2013 20:42:48 +0200, Antoon Pardon wrote: > >> How about the following comprimise. >> Let me know what you think about this. > How about you just ignore him. Why about you just ignore me? Serious, a lot of people here seem to think that if someone is bothered by someone else, the bothered person should just ignore the botherer. That is until something starts bothering these people themselves, then suddenly all kind of arguments are let loose in the hope of influencing the person that bothered them in changing his behaviour. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Op 01-07-13 16:02, ru...@yahoo.com schreef: You claim "collective experience" is not reliable and dismiss it in favor of your own theory, flaming trolls is a better response. And your evidence for that? Nothing (that I've read so far). You can decide all for yourself on how you want to handle trolls. But consider the following possibilty. A couple of trolls that are good in getting each other riled up. The regular members who mostly have killfiled them. Then who will be burdened most by the trolls? The newcomers. The regulars may succeed in creating a coccoon with a welcoming and positive atmosphere, but they have by doing so blinded themselves to how the group looks like to outsiders and so have no idea how hostile the group may have become to newbees. Ironically your flame war with Nikos in http://mail.python.org/pipermail/python-list/2013-June/650905.html provides evidence for the validity of the collective experience you dismiss, that engaging in flame wars with trolls simply produces more flames, hostility begets hostility. I, and I think the majority of people here, find that very unpleasant. You have become (as predicted by the collective experience you dismiss) as offensive as any troll. A lot of unfairness stays in the world because people find it unpleasant to fight it and even to observe fighting it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 21:28, Joshua Landau schreef: > Well then you are wrong. But fine, I'll use your definition incorrect > as it may be (when talking to you, please don't misrepresent my other > posts). > > Nevertheless, these statements that we are talking about, that I shall > now term "pseudo-insults", are unwanted and not called for. Please > keep them off-list. This doesn't make sense. This means that someone can behave like a jerk on this list, later tries to spin his behaviour as some innocent exchange of ideas and make it near impossible for others to make it clear what bullshit he is peddling because stating clearly how much like a jerk he behaved would be insulting. This is giving those who are behaving badly a huge advantage. >> Well nobody is representing the list. So where does that leave us? > I am afraid you are wrong. The body of people of this list, as a > whole, represent this list. As a whole, as I have shown, they resent > your pseudo-insults. rusi is an exception, who only seems to resent > Nikos's, but rusi has not fallen to pseudo-insults himself (herself?). You have shown no such thing. You have shown some people who resent my speaking clearly. That doesn't mean much, those that resent something are always making more noise than those who don't care or would even prefer it that way. >> And perhaps I am causing a lot of trouble, that doesn't mean I am >> wrong. Maybe it is time to question the way this list in general >> tries to avoid trouble. > Irrelevant. Your pseudo-insults are unwanted. Please stop. Argue all > you want - I'm not going to judge who's right. But I'd rather you > appreciate that no-one wants your pseudo-insults on this list. You have no authority to speak for everyone. You can't be even sure you speak for a majority, because once some small minority starts to speak up and pretend they speak for the whole group those who think differently often enough don't speak up. But for your ease of mind I'll make it clear I have no intention of haunting Nikos or of keeping him the subject of discussion. But should I stumble on a conversation in which his past behaviour is framed as him being innocentltly asking questions, I will point of what bullshit that is. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 01-07-13 21:32, Joshua Landau schreef: > On 1 July 2013 20:18, Antoon Pardon wrote: >> Op 01-07-13 17:33, Steven D'Aprano schreef: >> >>> Okay, thank you for explaining the situation. Now, please stop >>> baiting Nikos. >> I am not baiting Nikos. I know he mentions this two week period but all >> I have done in the last two weeks that involves Nikos as a subject is >> the "Don't feed the troll thread" and today this thread. >> >> So if he feels baited for the last two weeks, it is either by that >> "Don't feed the troll" thread or I have very little to do with it. > Obviously Steven, as I do, considers your actions in this thread as > "baiting". Whether or not you agree with his definition of baiting, he > wants you to stop. No that is not obvious at all. You see, Steven has made it clear he wasn't going to wade throught this list. So it is very well possible he missed most of my actions in this thread, which makes it far from obvious that his remark was based on actions in this thread. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 02-07-13 00:12, Steven D'Aprano schreef: > On Mon, 01 Jul 2013 20:42:48 +0200, Antoon Pardon wrote: > >> How about the following comprimise. I'll get myself a second identity. >> Every respons I make to Nikos will be done with the same identity. >> Normal python exchanges will be done with the other. You can then simply >> killfile my identity that engages with Nikos. > "Please don't assault people in the street." > > "How about a compromise? I'll continue assaulting people in the street, > but I'll wear a yellow hat when I do so. Then, if you don't want to see > me assaulting people, whenever you see me wearing a yellow hat, just turn > away." If you want to make an analogy you shouldn't cherry pick part of the situation and ignore how awful it would look in the complete picture. First of all these kind of requests were made to you to. They are requests from people who have killfiled Nikos but still are confronted with him because of those who reply to him. So if I am an assaulter then so are you in the context of this analogy. And what kind of solution is the killfile in this analogy? Perhaps this: ] Chris: Fred is really behaving very annoyingly ] Nils: You should wear protective gear so you can ignore him but don't bother the rest of us about it. >> Let me know what you think about this. > Sure, no problem. > > *plonk* Fine you give me an opportunity to point out the problems in your thinking without giving yourself the opportunity to respond. I can live with that. -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 02-07-13 09:43, Ian Kelly schreef: > On Tue, Jul 2, 2013 at 12:54 AM, Antoon Pardon > wrote: >> Why about you just ignore me? >> >> Serious, a lot of people here seem to think that if someone is bothered >> by someone else, the bothered person should just ignore the botherer. >> >> That is until something starts bothering these people themselves, then >> suddenly all kind of arguments are let loose in the hope of influencing >> the person that bothered them in changing his behaviour. > So what if they do? Failure to follow one's own advice does not make > it bad advice. That is true. But it should give some appreciation on how difficult it can be to follow the advise. IMO "ignore the botherer" is bad advice in the same sense as telling people who are overweight they should just eat less and exercise more. Sure if overweight people would follow the advise they actually would loose weight, but the advise ignores how hard it can be for people to change their behaviour. People can't just decide they will behave a certain way in the future. There can be all kinds of hurdles that will tempt them to resume the original behaviour. I would like people to have that in mind when they try to tell others to just ignore the behaviour that bothers them. Maybe it would help them to be a bit more patient to those who have trouble following the advise. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 02-07-13 11:34, Joshua Landau schreef: > No it does not. I'd give you more of a counter but I actually have no > idea how you came up with that. Please answer the following question. If someone behaved incompetently, how can I clearly state that fact when "incompetently" is seen as an insult and insults don't belong on the list? >>>> Well nobody is representing the list. So where does that leave us? >>> I am afraid you are wrong. The body of people of this list, as a >>> whole, represent this list. As a whole, as I have shown, they resent >>> your pseudo-insults. rusi is an exception, who only seems to resent >>> Nikos's, but rusi has not fallen to pseudo-insults himself (herself?). >> You have shown no such thing. You have shown some people who resent >> my speaking clearly. > I'd prefer you use my less ambiguous term "pseudo-insults". If you'd > prefer, you can rename it. Using weasel-words helps nobody. > > I have no problem with you "speaking clearly" in a literal sense. I > have a problem with your pseudo-insults. If you want to use "speaking > clearly" to mean "pseudo-insult", you're going to have to point out > that you're using words how they're not literally intended. What if using pseudo-insults was the most clear way to describe the situation. Should I start looking for eufenisms? >> But for your ease of mind I'll make it clear I have no intention >> of haunting Nikos or of keeping him the subject of discussion. >> But should I stumble on a conversation in which his past behaviour >> is framed as him being innocentltly asking questions, I will point >> of what bullshit that is. > Fair enough. If that's all you did in this thread, then I wouldn't care. > > But once again you seem to have missed the point that I and others > keep reiterating: pseudo-insults have no place on this list. > > > (If you need a reminder, pseudo-insults are just what other people > term "insults". You can change the name if you see fit.) So what are the non-insulting terms for incompentent, (starting a webservice in a language you're a newby in, making changes on the life server so that any typo you make, can take your site out the air), inconsiderate (behave annoyingly in multiple ways and despite poeple pointing it out multiple times, mostly continue in the same manner, without taking their remarks into account) and jerk (trying to spin your inconsiderate behaviour as you being the victim, misrepresenting your behaviour when it is being discussed, always "explaining" your behaviour, as if an explanation would make a difference to the annoyance you caused to others...) -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 03-07-13 02:30, ru...@yahoo.com schreef: > If your going to point out something negative about someone > then do so politely. Ask yourself if you were pointing out > incompetence to your boss (or anyone else where impoliteness > could have real consequences for you) if you would say, > "you're incompetent." And so we shift from no problem speaking bluntly or clearly to wording it in a way that wouldn't antagonize your boss too much. Off course that would also mean throwing out remarks like: ] You have betrayed the trust of all your customers. Which seemed to be accepted on this list without a problem. > Please use non-emotional, neutral, factual descriptions > and only do so when it is actually relevant. IOW, please > resist your desire to "tell off" the poster -- it usually > just produces more responses in kind. This is often not workable. Limiting to factual description means that you often can't summarize a list of such factual descriptions into a conclusion. You can list 8 examples of someone betraying the trust of his customers but you can't summarize it into: "is/behaves untrustworthy to his customers," even if all signs point to this person going to continue in the same vein. It is limiting yourself into pointing out all the trees without being allowed to call it a forest. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 02-07-13 15:40, Joshua Landau schreef: > On 2 July 2013 13:01, Antoon Pardon wrote: >> Op 02-07-13 11:34, Joshua Landau schreef: >> >>> No it does not. I'd give you more of a counter but I actually have no >>> idea how you came up with that. >> Please answer the following question. If someone behaved incompetently, >> how can I clearly state that fact when "incompetently" is seen as an >> insult and insults don't belong on the list? > There is not ever a place on this list where you will need to call > someone incompetent. You can explain to someone that they do not > understand what they are doing, but when you attack the character of > the person it is no longer acceptable. This is not an attack of character. Level of skill/competence is not in general seen as a character trait. It is something one can generally increase if one is willing to work on it, and once you acquired it, you don't have to keep your guard for situations in which you might loose it. >>>> But for your ease of mind I'll make it clear I have no intention >>>> of haunting Nikos or of keeping him the subject of discussion. >>>> But should I stumble on a conversation in which his past behaviour >>>> is framed as him being innocentltly asking questions, I will point >>>> of what bullshit that is. >>> Fair enough. If that's all you did in this thread, then I wouldn't care. >>> >>> But once again you seem to have missed the point that I and others >>> keep reiterating: pseudo-insults have no place on this list. >>> >>> >>> (If you need a reminder, pseudo-insults are just what other people >>> term "insults". You can change the name if you see fit.) >> So what are the non-insulting terms for >> >> incompentent, (starting a webservice in a language you're a newby in, >> making changes on the life server so that any typo you make, can take >> your site out the air), > You just did it. But how do I describe this in one word? What conclusion am I allowed to make from all this? Can I say: He displayed a pattern of incompetence? He has been blundering about? His skill level was unimpressive? The skill level he displayed, left much to be desired? >> inconsiderate (behave annoyingly in multiple ways and despite poeple pointing >> it out multiple times, mostly continue in the same manner, without taking >> their remarks into account) and > I do not tend to consider "inconsiderate" inappropriate if said in > earnest, as it is defensive. I'd still rather you talked about actions > as inconsiderate rather than people, but baby steps. I don't understand this, since (in)consideration is in general seen as a character trait. On that basis I think you have it exactly backwards when you consider "incompetent" an attack of character yet seem to have little problem with "inconsiderate". Yet people who have a more inconsiderate character can't work on acquiring consideration, as one can on acquiring skill/competence. Sure one can work on it, but it is something you have to keep watchful for. Otherwise you can easily slip again into a pattern of being/behaving inconsiderate. >> jerk (trying to spin your inconsiderate behaviour as you being the victim, >> misrepresenting your behaviour when it is being discussed, always >> "explaining" >> your behaviour, as if an explanation would make a difference to the annoyance >> you caused to others...) > You came close. Same question as two entries above. > > > But, since Nikos has thankfully ceased, I'm saying here that unless > you have good reasons otherwise I'd rather only continue this > off-list. If you reply on-list without justification I will likely not > reply. > Since others have in the mean time responded in this thread, I didn't think it a good idea, to have this part in private. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 03-07-13 11:45, Chris Angelico schreef: > On Wed, Jul 3, 2013 at 7:21 PM, Antoon Pardon > wrote: >> Op 03-07-13 02:30, ru...@yahoo.com schreef: >>> If your going to point out something negative about someone >>> then do so politely. Ask yourself if you were pointing out >>> incompetence to your boss (or anyone else where impoliteness >>> could have real consequences for you) if you would say, >>> "you're incompetent." >> And so we shift from no problem speaking bluntly or clearly >> to wording it in a way that wouldn't antagonize your boss >> too much. >> >> Off course that would also mean throwing out remarks like: >> >> ] You have betrayed the trust of all your customers. >> >> Which seemed to be accepted on this list without a problem. > If my boss gave a random stranger from a mailing list the root > password to one of our servers, I would say to his face that he had > betrayed his (our) customers' trust. I would say it with strong > emphasis and a raised tone, too, and no small heat. The words you > quote above are perfectly factual and, in my opinion, business-like > language. > > ChrisA But the real question of course is, would your boss see it that way? Maybe your boss would, but talking about a random boss, I wouldn't bet any money on it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Python - forking an external process?
Op 03-07-13 05:47, Victor Hooi schreef: > Hi, > > I have a Python script where I want to run fork and run an external command > (or set of commands). > > For example, after doing , I then want to run ssh to a host, handover > control back to the user, and have my script terminate. > > Or I might want to run ssh to a host, less a certain textfile, then exit. > > What's the idiomatic way of doing this within Python? Is it possible to do > with Subprocess? > If I understand correctly that you want something done in python and then wish to finish python and give control to an other program. I would use an external script that would first launch the python program and then the other program. If for some reason this is a less attractive option, you can use the os.exec family. That terminates the python program will starting up an other program. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 04-07-13 01:40, Joshua Landau schreef: > On 3 July 2013 11:01, Antoon Pardon wrote: > >> This is not an attack of character. Level of skill/competence is >> not in general seen as a character trait. > I disagree. I'm not sure how to argue this, rather than point out that > by "character trait" I'm not talking about "intrinsic trait" but > rather "revolving around who you are". The alternative I posed is > talking about things revolving around specific actions that you have > taken. All right I can work with that. However I get the impression what you are talking about is then not limited to character traits but can be applied to other traits too. It is unlikely to come up in this group but I guess you would be opposed in a similar way to someone being called a weakling after it became clear he was not physically fit for a particular task. >> But how do I describe this in one word? What conclusion am I allowed >> to make from all this? > That it's worth taking a little more time doing things if it makes > sure you aren't harming the person on the other end. I agree to a certain extend. But sometimes I seem to come up (not only on usenet but in real life too) to people who seem to be oblivious to the message you are sending until you cast it into words that sting. I have been guily of such behaviour myself, not really reacting to the warnings from my partner until they were termed in a way that was hard to ignore. And sure, there is a serious risk of a hostile reaction, but getting a hostile reaction doesn't contradict that it was effective. People often do change their behaviour even if there first reaction was hostile and denial. So I'll agree to doing as little harm as possible and that there is a level of harm that shouldn't be crossed. But I won't go as far as making sure no harm is done. > >> [examples] > Bear in mind that if the way you were acting was all in my "with > trepidation" category, I would likely have not spoken up. I believe > you crossed a lot further beyond that line. I had to look up "trepidation" and the translation I got from my dictionary was not 100% helpful. Would "hesitation" or "wariness" be a good substitute. Can we go back to my first entry in this thread? I would like to know whether you think that already crossed the line or if that would fall under your "with trepidation" category and I crossed the line later. I think the relevant part is this: ] Maybe that way he'll learn that if he doesn't want to be considered ] an incompetent inconsiderate jerk, he shouldn't behave like one. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 03-07-13 19:11, ru...@yahoo.com schreef: > On 07/03/2013 03:21 AM, Antoon Pardon wrote: >> Op 03-07-13 02:30, ru...@yahoo.com schreef: >>> If your going to point out something negative about someone >>> then do so politely. Ask yourself if you were pointing out >>> incompetence to your boss (or anyone else where impoliteness >>> could have real consequences for you) if you would say, >>> "you're incompetent." >> And so we shift from no problem speaking bluntly or clearly >> to wording it in a way that wouldn't antagonize your boss >> too much. > As I pointed out, emotionally-loaded, judgmental language > *is not* clear. Well that is true, but mostly in the trivial sense that language is rarely clear even when you are talking facts. When I meet someone new and I talk about my love of spaghetti and the other inivites me to the spaghetti evening the next day, that can turn out to be a big disappointment because when I talk about spaghetti, I mean a carbonarra while I was invited to a bolognaise-evening. > And yes, I think "wouldn't antagonize your > boss" is not a bad heuristic for judging the politeness of > your response. That may be true for you personnally, but you are unsufficiently clear for anyone else to be of any help. The problem is that when you wrote this, you had a specific kind of boss in mind who would react in certain ways to certain kinds of treatment. However it would be extremely unlikely that other people would come up with the same idea of boss. And not everybody is in the same situation, some people can't afford to lose there job, others are in a less desperate situation, for some people their priority is their career, while for others it is the service to their clients. All these people are going to come up with wildly different answers. > Again I ask, what does his web site admin skills or lack > thereof have to do with python? > > If you want to decline providing Python help to someone > because you don't like some real-world behavior of the > person, fine. But when you attack him over it, and > publicly engage in a long, noisy discussion here in > which you trumpet your moral and technical superiority, > then you should not be surprised when the target takes > offense and responds in kind. > > If someone from Wikileaks posts here seeking Python help, > should we engage in a long discussion about the morality > of Wikileaks and how they aid US fugitives from justice? > > How about someone who lets slip he's just been released > from prison for child sexual abuse? > > How about someone who's writing software for bulk mailing? > > How about someone who is writing membership management > software for the American Nazi Party? Are you saying we should either help the person with his (python) problem or decline any help no matter how nefarious the goals he wants to accomplish or are you saying these examples are not serious enough so people should show some tolerance in these cases? >>> Please use non-emotional, neutral, factual descriptions >>> and only do so when it is actually relevant. IOW, please >>> resist your desire to "tell off" the poster -- it usually >>> just produces more responses in kind. >> This is often not workable. Limiting to factual description >> means that you often can't summarize a list of such factual >> descriptions into a conclusion. You can list 8 examples of >> someone betraying the trust of his customers but you can't >> summarize it into: "is/behaves untrustworthy to his customers," >> even if all signs point to this person going to continue in the >> same vein. >> >> It is limiting yourself into pointing out all the trees >> without being allowed to call it a forest. > You can summarize while being polite and non-judgmental. Somethings are not expressable in a way that is acceptable to who you are talking too, simply because they find the fact or opinion to be hurtful/insulting in itself. > You do not have state your belief on every off-topic > inflammatory subject that happens to come up. So what do you suggest? That we simply let those who bring up an off-topic inflammatory subject, go on about it whithout challenge? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: How is this evaluated
Op 04-07-13 19:20, Arturo B schreef: I'm making this exercise: (Python 3.3) Write a function translate() that will translate a text into "rövarspråket" (Swedish for "robber's language"). That is, double every consonant and place an occurrence of "o" in between. For example, translate("this is fun") should return the string "tothohisos isos fofunon". So I tried to solved it, but I couldn't, so I found many answers, but I selected this: def translate(s): consonants = 'bcdfghjklmnpqrstvwxz' return ''.join(l + 'o' + l if l in consonants else l for l in s) print(translate('hello code solver')) OUTPUT: 'hohelollolo cocodode sosololvoveror' __ So I want to question: How is the if 'h' in consonants else 'h' for 'h' in s part evaluated? (step by step please :P ) ''.join('h' + 'o' + 'h' if 'h' in consonants else 'h' for 'h' in s) Thank you guys This doesn't make much sence because you substituted a varible for a character literal, so I'll go with the original. l + 'o' + l if l in consonants else l for l in s Evaluate this expression: l + 'o' + l if l in consonants else l for each l in s (so for each letter that in s). l + 'o' + l if l in consonants else l if l is part of the consonants produce l + 'o' + l otherwise just produce l. Hope this helps. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Op 06-07-13 00:40, ru...@yahoo.com schreef: > On 07/04/2013 06:09 AM, Antoon Pardon wrote: >> Op 03-07-13 19:11, ru...@yahoo.com schreef: >>> On 07/03/2013 03:21 AM, Antoon Pardon wrote: >>>> Op 03-07-13 02:30, ru...@yahoo.com schreef: >>>>> If your going to point out something negative about someone >>>>> then do so politely. Ask yourself if you were pointing out >>>>> incompetence to your boss (or anyone else where impoliteness >>>>> could have real consequences for you) if you would say, >>>>> "you're incompetent." >>>> And so we shift from no problem speaking bluntly or clearly >>>> to wording it in a way that wouldn't antagonize your boss >>>> too much. >>> As I pointed out, emotionally-loaded, judgmental language >>> *is not* clear. >> Well that is true, but mostly in the trivial sense that >> language is rarely clear even when you are talking facts. > Its true in more than a trivial sense. > >> When I meet someone new and I talk about my love of spaghetti >> and the other inivites me to the spaghetti evening the next >> day, that can turn out to be a big disappointment because >> when I talk about spaghetti, I mean a carbonarra while I >> was invited to a bolognaise-evening. > Of course there is some degree of uncertainty. But that > uncertainty is relatively small when compared with the > range of possible food you might have been served had > your evening's companion not specified "spaghetti". > > Had he or she invited you to a really "delicious" meal > on the other hand, the uncertainty about the what > "delicious" means would far greater. Unless you know > the person, "delicious" is so subjective as to have very > little meaning since its meaning varies between people > much more than "spaghetti" does. That is not true. Subjective and unclear are not the same. And that you don't know what kind of food someone find delicious, doesn't make it unclear what kind of expectations you (try to) evoke when you promisse him a delicious meal. When you go to someone's restaurant buddies and tell them you want to cook him a delicious meal, do they have suggestions? Then those buddies will find that question clear enough to come up with useful answers. And I doubt that you can get just as useful answers by asking about objective facts. > Describing someone as "stupid", "incompetent", "a > dick", etc has a similar high degree of subjectivity > and its meaning depends more on the sayer than on any > objective attribute of the subject. I doubt that. Subjective is not the same as arbitrary. We as humans react in large degree the same to the same kind of stimuli. If someone tells me something tastes sweet, then that tells me more about what he is tasting than about him. Especially if more than one person reports the same. > If you can tell me something objective about the subject, > then that may be helpful to me in deciding how to respond > to him or her. If you just spout subjective invective, > then its just noise because I don't know enough about > you to trust your judgment. And why should you trust my objective statement? The fact that the statement is objective, doesn't mean I am qualified in making it. > (Advanced technical python > knowledge does not qualify one in judging other human > beings.) And since I'm reading the thread I have access > to the same info you do, and can form my own subjective > opinion. Judging other people is in my opinion a moral > action that is too important to delegate or to do by just > going along with the crowd. So nobody is stopping you AFAICS. > So such subjective, emotionally-loaded, judgmental responses > provide little benefit to others, amplify whatever negative > tone was created by the troll and stimulate the troll. The > only benefits are to you who gets to vent and argue, and a > (hopefully few) voyeurs and fellow vigilantes who enjoy > watching and joining in on that kind of flamage. This is just your subjective emotional evaluation. By your own words why should I trust you? Why should we see the benefits to the vigilantes and the voyeurs as little? Why should we see the tone that is created by the troll as negative? Why should we hope that the voyeurs and vigilantes are few? Doesn't this all just say more about you than about the trolls, vigilantes and voyeurs? Why should I take your judgement over that of those you call trolls, vigilantes and voyeurs? Why do you use the words "troll", "vigilante" and "voyeur", which are emotionnaly laden, instead o
Re: Help with 'self' and 'set_usage'
Op 09-07-13 19:03, L O'Shea schreef: Hi all, I'm interning and have been given the job of extending a program that has been written by someone else. I've never used Python before so it's a bit of a struggle but I've got to say I'm loving the language so far. In on of the scripts there is def set_usage(self,s): self.usage_str = s Could anyone shed some light on this? I can't find mention of this anywhere in any Python documentation or anywhere else in the code where usage_str might be defined. Can you just create variables in that object by writing self.name = "david" self.hobby = "fishing"?? Yes you can. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Stack Overflow moderator “animuson”
Op 10-07-13 11:03, Mats Peterson schreef: > Not a troll. It's just hard to convince Python users that their beloved > language would have inferior regular expression performance to Perl. All right, you have convinced me. Now what? Why should I care? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Stack Overflow moderator “animuson”
Op 10-07-13 13:56, Benedict Verheyen schreef: Op Wed, 10 Jul 2013 12:12:10 +0100, schreef Joshua Landau: Do you have any non-trivial, properly benchmarked real-world examples that this affects, remembering to use full Unicode support in Perl (as Python has it by default)? Indeed, as Joshua says, instead of going through all the effort to talk about it, why don't you show us that Python is slower in regexs than perl. That's at least relevant bandwdith. Next, if Python is slower, there might be ways to improve the performance. Last, if there is a SPU (Secret Python Underground), I want to j Heretic, it is the -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: Quickly. sys.getsizeof() at the light of what I explained. 1) As this FSR works with multiple encoding, it has to keep track of the encoding. it puts is in the overhead of str class (overhead = real overhead + encoding). In such a absurd way, that a sys.getsizeof('€') 40 needs 14 bytes more than a sys.getsizeof('z') 26 You may vary the length of the str. The problem is still here. Not bad for a coding scheme. 2) Take a look at this. Get rid of the overhead. sys.getsizeof('b'*100 + 'c') 126 sys.getsizeof('b'*100 + '€') 240 What does it mean? It means that Python has to reencode a str every time it is necessary because it works with multiple codings. So? The same effect can be seen with other datatypes. >>> nr = 32767 >>> sys.getsizeof(nr) 14 >>> nr += 1 >>> sys.getsizeof(nr) 16 This FSR is not even a copy of the utf-8. len(('b'*100 + '€').encode('utf-8')) 103 Why should it be? Why should a unicode string be a copy of its utf-8 encoding? That makes as much sense as expecting that a number would be a copy of its string reprensentation. utf-8 or any (utf) never need and never spend their time in reencoding. So? That python sometimes needs to do some kind of background processing is not a problem, whether it is garbage collection, allocating more memory, shufling around data blocks or reencoding a string, that doesn't matter. If you've got a real world example where one of those things noticeably slows your program down or makes the program behave faulty then you have something that is worthy of attention. Until then you are merely harboring a pet peeve. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: FSR and unicode compliance - was Re: RE Module Performance
Op 28-07-13 21:23, wxjmfa...@gmail.com schreef: Le dimanche 28 juillet 2013 17:52:47 UTC+2, Michael Torrie a écrit : On 07/27/2013 12:21 PM, wxjmfa...@gmail.com wrote: Good point. FSR, nice tool for those who wish to teach Unicode. It is not every day, one has such an opportunity. I had a long e-mail composed, but decided to chop it down, but still too long. so I ditched a lot of the context, which jmf also seems to do. Apologies. 1. FSR *is* UTF-32 so it is as unicode compliant as UTF-32, since UTF-32 is an official encoding. FSR only differs from UTF-32 in that the padding zeros are stripped off such that it is stored in the most compact form that can handle all the characters in string, which is always known at string creation time. Now you can argue many things, but to say FSR is not unicode compliant is quite a stretch! What unicode entities or characters cannot be stored in strings using FSR? What sequences of bytes in FSR result in invalid Unicode entities? 2. strings in Python *never change*. They are immutable. The + operator always copies strings character by character into a new string object, even if Python had used UTF-8 internally. If you're doing a lot of string concatenations, perhaps you're using the wrong data type. A byte buffer might be better for you, where you can stuff utf-8 sequences into it to your heart's content. 3. UTF-8 and UTF-16 encodings, being variable width encodings, mean that slicing a string would be very very slow, and that's unacceptable for the use cases of python strings. I'm assuming you understand big O notation, as you talk of experience in many languages over the years. FSR and UTF-32 both are O(1) for slicing and lookups. UTF-8, 16 and any variable-width encoding are always O(n). A lot slower! 4. Unicode is, well, unicode. You seem to hop all over the place from talking about code points to bytes to bits, using them all interchangeably. And now you seem to be claiming that a particular byte encoding standard is by definition unicode (UTF-8). Or at least that's how it sounds. And also claim FSR is not compliant with unicode standards, which appears to me to be completely false. Is my understanding of these things wrong? -- Compare these (a BDFL exemple, where I'using a non-ascii char) Py 3.2 (narrow build) timeit.timeit("a = 'hundred'; 'x' in a") 0.09897159682121348 timeit.timeit("a = 'hundre€'; 'x' in a") 0.09079501961732461 sys.getsizeof('d') 32 sys.getsizeof('€') 32 sys.getsizeof('dd') 34 sys.getsizeof('d€') 34 Py3.3 timeit.timeit("a = 'hundred'; 'x' in a") 0.12183182740848858 timeit.timeit("a = 'hundre€'; 'x' in a") 0.2365732969632326 sys.getsizeof('d') 26 sys.getsizeof('€') 40 sys.getsizeof('dd') 27 sys.getsizeof('d€') 42 Tell me which one seems to be more "unicode compliant"? Cant tell, you give no relevant information on which one can decide this question. The goal of Unicode is to handle every char "equaly". Not to this kind of detail, which is looking at irrelevant implementation details. Now, the problem: memory. Do not forget that à la "FSR" mechanism for a non-ascii user is *irrelevant*. As soon as one uses one single non-ascii, your ascii feature is lost. (That why we have all these dedicated coding schemes, utfs included). So? Why should that trouble me? As far as I understand whether I have an ascii string or not is totally irrelevant to the application programmer. Within the application I just process strings and let the programming environment keep track of these details in a transparant way unless you start looking at things like getsizeof, which gives you implementation details that are mostly irrelevant in deciding whether the behaviour is compliant or not. sys.getsizeof('abc' * 1000 + 'z') 3026 sys.getsizeof('abc' * 1000 + '\U00010010') 12044 A bit secret. The larger a repertoire of characters is, the more bits you needs. Secret #2. You can not escape from this. And totally unimportant for deciding complyance. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 26-07-13 15:21, wxjmfa...@gmail.com schreef: Hint: To understand Unicode (and every coding scheme), you should understand "utf". The how and the *why*. No you don't. You are mixing the information with how the information is coded. utf is like base64, a way of coding the information that is usefull for storage or transfer. But once you have decode the byte stream, you no longer need any understanding of base64 to process your information. Likewise, once you have decode the bytestream into uniocde information you don't need knowledge of utf to process unicode strings. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 28-07-13 20:19, Joshua Landau schreef: On 28 July 2013 09:45, Antoon Pardon mailto:antoon.par...@rece.vub.ac.be>> wrote: Op 27-07-13 20:21, wxjmfa...@gmail.com <mailto:wxjmfa...@gmail.com> schreef: utf-8 or any (utf) never need and never spend their time in reencoding. So? That python sometimes needs to do some kind of background processing is not a problem, whether it is garbage collection, allocating more memory, shufling around data blocks or reencoding a string, that doesn't matter. If you've got a real world example where one of those things noticeably slows your program down or makes the program behave faulty then you have something that is worthy of attention. Somewhat off topic, but befitting of the triviality of this thread, do I understand correctly that you are saying garbage collection never causes any noticeable slowdown in real-world circumstances? That's not remotely true. No that is not what I am saying. But if jmf would be complaining about garbage collection in an analog way as he is complaining about the FSR, he wouldn't be complaining about real-world circumstances but about theorectical possibilities and micro bench marks. In those circunstances the "garbage collection problem" wouldn't be worthy of attention much. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 28-07-13 21:30, wxjmfa...@gmail.com schreef: To be short, this is *never* the FSR, always something else. Suggestion. Start by solving all these "micro-benchmarks". all the memory cases. It a good start, no? There is nothing to solve. Unicode doesn't force implementations to use the same size of memory for strings of the same length. So you pointing out examples of same length strings that don't use the same size of memory doesn't point at something that must be solved. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 30-07-13 16:01, wxjmfa...@gmail.com schreef: > > I am pretty sure that once you have typed your 127504 > ascii characters, you are very happy the buffer of your > editor does not waste time in reencoding the buffer as > soon as you enter an €, the 125505th char. Sorry, I wanted > to say z instead of euro, just to show that backspacing the > last char and reentering a new char implies twice a reencoding. Using a single string as an editor buffer is a bad idea in python for the simple reason that strings are immutable. So adding characters would mean continuously copying the string buffer into a new string with the next character added. Copying 127504 characters into a new string will not make that much of a difference whether the octets are just copied to octets or are unpacked into 32 bit words. > Somebody wrote "FSR" is just an optimization. Yes, but in case > of an editor à la FSR, this optimization take place everytime you > enter a char. Your poor editor, in fact the FSR, is finally > spending its time in optimizing and finally it optimizes nothing. > (It is even worse). Even if you would do it this way, it would *not* take place every time you enter a char. Once your buffer would contain a wide character, it would just need to convert the single character that is added after each keystroke. It would not need to convert the whole buffer after each key stroke. > If you type correctly a z instead of an €, it is not necessary > to reencode the buffer. Problem, you do you know that you do > not have to reencode? simple just check it, and by just checking > it wastes time to test it you have to optimized or not and hurt > a little bit more what is supposed to be an optimization. Your scenario is totally unrealistic. First of all because of the immutable nature of python strings, second because you suggest that real time usage would result in frequent conversions which is highly unlikely. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 30-07-13 18:13, MRAB schreef: On 30/07/2013 15:38, Antoon Pardon wrote: Op 30-07-13 16:01, wxjmfa...@gmail.com schreef: I am pretty sure that once you have typed your 127504 ascii characters, you are very happy the buffer of your editor does not waste time in reencoding the buffer as soon as you enter an €, the 125505th char. Sorry, I wanted to say z instead of euro, just to show that backspacing the last char and reentering a new char implies twice a reencoding. Using a single string as an editor buffer is a bad idea in python for the simple reason that strings are immutable. Using a single string as an editor buffer is a bad idea in _any_ language because an insertion would require all the following characters to be moved. Not if you use a gap buffer. -- Antoon Pardon. -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 30-07-13 19:14, MRAB schreef: On 30/07/2013 17:39, Antoon Pardon wrote: Op 30-07-13 18:13, MRAB schreef: On 30/07/2013 15:38, Antoon Pardon wrote: Op 30-07-13 16:01, wxjmfa...@gmail.com schreef: I am pretty sure that once you have typed your 127504 ascii characters, you are very happy the buffer of your editor does not waste time in reencoding the buffer as soon as you enter an €, the 125505th char. Sorry, I wanted to say z instead of euro, just to show that backspacing the last char and reentering a new char implies twice a reencoding. Using a single string as an editor buffer is a bad idea in python for the simple reason that strings are immutable. Using a single string as an editor buffer is a bad idea in _any_ language because an insertion would require all the following characters to be moved. Not if you use a gap buffer. The disadvantage there is that when you move the cursor you must move characters around. For example, what if the cursor was at the start and you wanted to move it to the end? Also, when the gap has been filled, you need to make a new one. So? Why are you making this a point of discussion? I was not aware that the pro and cons of various editor buffer implemantations was relevant to the point I was trying to make. If you prefer an other data structure in the editor you are working on, I will not dissuade you. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 31-07-13 05:30, Michael Torrie schreef: > On 07/30/2013 12:19 PM, Antoon Pardon wrote: >> So? Why are you making this a point of discussion? I was not aware that >> the pro and cons of various editor buffer implemantations was relevant >> to the point I was trying to make. > > I for one found it very interesting. In fact this thread caused me to > wonder how one actually does create an efficient editor. Off the > original topic true, but still very interesting. > Yes, it can be interesting. But I really think if that is what you want to discuss, it deserves its own subject thread. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 30-07-13 21:09, wxjmfa...@gmail.com schreef: > Matable, immutable, copyint + xxx, bufferint, O(n) > Yes, but conceptualy the reencoding happen sometime, somewhere. Which is a far cry from your previous claim that it happened every time you enter a char. This of course make your case harder to argue. Because the impact of something that happens sometime, somewhere is vastly less than something that happens everytime you enter a char. > The internal "ucs-2" will never automagically be transformed > into "ucs-4" (eg). It will just start producing wrong results when someone starts using characters that don't fit into ucs-2. timeit.timeit("'a'*1 +'€'") > 7.087220684719967 timeit.timeit("'a'*1 +'z'") > 1.5685214234430873 timeit.timeit("z = 'a'*1; z = z +'€'") > 7.169538866162213 timeit.timeit("z = 'a'*1; z = z +'z'") > 1.5815893830557286 timeit.timeit("z = 'a'*1; z += 'z'") > 1.606955741596181 timeit.timeit("z = 'a'*1; z += '€'") > 7.160483334521416 > > > And do not forget, in a pure utf coding scheme, your > char or a char will *never* be larger than 4 bytes. > sys.getsizeof('a') > 26 sys.getsizeof('\U000101000') > 48 Nonsense. >>> sys.getsizeof('a'.encode('utf-8')) 18 -- http://mail.python.org/mailman/listinfo/python-list
Re: RE Module Performance
Op 31-07-13 10:32, wxjmfa...@gmail.com schreef: > Unicode/utf* > > > i) ("primary key") Create and use a unique set of encoded > code points. FSR does this. >>> st1 = 'a€' >>> st2 = 'aa' >>> ord(st1[0]) 97 >>> ord(st2[0]) 97 >>> > ii) ("secondary key") Depending of the wish, > memory/performance: utf-8/16/32 Whose wish? I don't know any language that allows the programmer choose the internal representation of its strings. If it is the designers choice FSR does this, if it is the programmers choice, I don't see why this is necessary for compliance. > Two advantages at the light of the above example: > iii) The "a" has never to be reencoded. FSR: check. Using a container with wider slots is not a reëncoding. If such widening is encoding then your 'choice' between utf-8/16/32 implies that it will also have to reencode when it changes from utf-8 to utf-16 or utf-32. > iv) An "a" size never exceeds 4 bytes. FSR: check. > Hard job to solve/satisfy i), ii), iii) and iv) at the same time. > Is is possible? ;-) The solution is in the problem. Mayby you should use bytes or bytearrays if that is really what you want. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: email 8bit encoding
Op 29-07-13 01:41, ru...@yahoo.com schreef: How, using Python-3.3's email module, do I "flatten" (I think that's the right term) a Message object to get utf-8 encoded body with the headers: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when the message payload was set to a python (unicode) string? I am just trying out some things for my self on python 3.2 so be sure to test this out but you could try the following. msg.set_charset('utf-8') msg['Content-Transfer-Encoding'] = '8bit' -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: How can i call array_length to get the length of array object?
On 06/24/12 10:48, Stefan Behnel wrote: > gmspro, 24.06.2012 10:01: > >> Why are some methods/functions named in this way in python? __len__ >> >> underscoreunderscoreNAMEunderscoreunderscore >> >> Is there any speciality of naming such methods? >> > Yes. Look up "special methods" in the documentation. > > You may have noticed the correspondence between len() and __len__(). That > is Python's way of allowing you to implement this kind of generic > functionality (sometimes referred to as a protocol). > > You also asked why len() is a function instead of a method. Don't you find > it much easier to use one function for everything than to look up and > sometimes even learn one method for each kind of object you are dealing > with? Python prefers simplicity here. You want the length? Use len(). > > Stefan What does this have to do with using a function vs a method? In the python 2.x series, the iterator protocol, proscribe you need to define a "next" method, which you can call directly or which is called in for statements. Now in python 3.x the method is called "__next__" and there is a next-function which will call this __next__ method. I see no difference in difficulty between item = iter.next() and item = next(iter). Neither do I see a difference in difficulty between size = len(seq) or size = seq.len(). Sure it is possible for someone feeling uncooperative to write a class in which method giving the length of the object was named something different from "len". But that is now also possible. -- http://mail.python.org/mailman/listinfo/python-list
Re: Objects in Python
On 23-08-12 01:58, Ben Finney wrote: > > You haven't discovered anything about types; what you have discovered is > that Python name bindings are not variables. > > In fact, Python doesn't have variables – not as C or Java programmers > would understand the term. What it has instead are references to objects > (with names as one kind of reference). > > The documentation unfortunately calls these references “variables” in > various places, which IMO compounds the confusion in newcomers > experienced with other languages. It's best, I think, to reject the idea > that Python has variables, and think in terms of references instead. > Why should we reject the idea that python has variables? Python variables are a lot like scheme or smalltalk variables and I never heard anyone having a problem considering these languages having variables. -- http://mail.python.org/mailman/listinfo/python-list
Re: Objects in Python
On 24-08-12 09:38, Antoon Pardon wrote: > On 23-08-12 01:58, Ben Finney wrote: > >> You haven't discovered anything about types; what you have discovered is >> that Python name bindings are not variables. >> >> In fact, Python doesn't have variables – not as C or Java programmers >> would understand the term. What it has instead are references to objects >> (with names as one kind of reference). >> >> The documentation unfortunately calls these references “variables” in >> various places, which IMO compounds the confusion in newcomers >> experienced with other languages. It's best, I think, to reject the idea >> that Python has variables, and think in terms of references instead. >> >> > Why should we reject the idea that python has variables? Python > variables are a lot like scheme or smalltalk variables and I never > heard anyone having a problem considering these languages > having variables. > Never mind. I missed the reactions already dealing with this. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: A little morning puzzle
On 19-09-12 13:17, Neal Becker wrote: > I have a list of dictionaries. They all have the same keys. I want to find > the > set of keys where all the dictionaries have the same values. Suggestions? common_items = reduce(opereator.__and__, [set(dct.iteritems()) for dct in lst]) common_keys = set([item[0] for item in common_items]) -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: while expression feature proposal
On 25-10-12 06:50, Terry Reedy wrote: > On 10/24/2012 7:19 PM, Evan Driscoll wrote: >> On 10/24/2012 05:26 PM, Cameron Simpson wrote: >>> But I'm still -0 on it, because it supplants the glaringly obvious: >>> >>>m = ... >>> >>> assignment with the far less in your face: >>> >>>possibly-long-expr as m >>> >>> and I think it would get quite heavily used, to the detriment of >>> assignment readability in general. At present the nature of most >>> effects >>> is at the left. An assignment is obvious on the left, an >>> if/with/while/etc >>> is visible at the left. >> >> In the interest of brainstorming, what about >> >> while VAR from EXPR: >> >> or something like that? I don't think I like 'from' on a couple counts, >> but there's probably some word that fits. > > The op wondered if these proposals have been made before. They have > been, and have been rejected. Some of the discussion has been on > python-ideas list. But go ahead and brainstorm and discuss. > > Keep in mind that any new syntax has to be a substantial improvement > in some sense or make something new possible. There was no new syntax > in 3.2 and very little in 3.3. If I recal correctly at one point the following was accepted: do: suite while expr: suite But it was later discarded because of lack of a champion or something like that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: bit count or bit set && Python3
On 25-10-12 16:47, Charles Hixson wrote: > In Python3 is there any good way to count the number of on bits in an > integer (after an & operation)? > Alternatively, is there any VERY light-weight implementation of a bit > set? I'd prefer to use integers, as I'm probably going to need > thousands of these, if the tests work out. But before I can test, I > need a decent bit counter. (shift, xor, &, and | are already present > for integer values, but I also need to count the number of "true" > items after the logical operation. So if a bitset is the correct > approach, I'll need it to implement those operations, or their > equivalents in terms of union and intersection.) > > Or do I need to drop into C for this? > Some time ago I implemented this. Maybe you can use it as inspiration. def CardSet(iter): bits = 0L for el in iter: bits = bits | (1L << el) return CardSetType(bits) def CSt(*args): return CardSet(args) class CardSetType: def __init__(self, bits): self.bits = bits def __str__(self): return '{' + ','.join(map(str , self)) + '}' def __repr__(self): return 'CSt(' + ','.join(map(str , self)) + ')' def __eq__(self, term): return self.bits == term.bits def __contains__(self, el): return (1L << el) & self.bits == 1L << el def __and__(self, term): return CardSetType(self.bits & term.bits) def __or__(self, term): return CardSetType(self.bits | term.bits) def __xor__(self, term): return CardSetType(self.bits ^ term.bits) def __sub__(self, term): return CardSetType(self.bits & ~term.bits) def __le__(self, term): return self.bits & term.bits == self.bits def __ge__(self, term): return self.bits | term.bits == self.bits def __len__(self): bits = self.bits full = 1L shift = 1L index = 0 mask = [] while full < bits: for i in range(index): mask[i] = (mask[i] << shift) + mask[i] mask.append(full) full = (full << shift) + full index = index + 1 shift = 2 * shift shift = 1 for i in range(index): bits = ((bits >> shift) & mask[i]) + (bits & mask[i]) shift = 2 * shift return int(bits) def incl(self, el): self.bits = self.bits | 1L << el def excl(self, el): self.bits = self.bits & ~(1L << el) def __iter__(self): return SetIterator(self.bits) class SetIterator: def __init__(self, bits): self.bits = bits self.offset = 0 def __iter__(self): return self def next(self): if self.bits == 0: raise StopIteration else: while True: shift = 0 delta = 1 full = 1L while (self.bits & full) == 0: full = (full << delta) + full shift = delta delta = delta * 2 if shift == 0: break self.offset = self.offset + shift self.bits = self.bits >> shift result = self.offset self.offset = self.offset + 1 self.bits = self.bits >> 1 return result -- http://mail.python.org/mailman/listinfo/python-list
3.2 can't extract tarfile produced by 2.7
I am converting some programs to python 3. These programs manipulate tarfiles. In order for the python3 programs to be really useful they need to be able to process the tarfiles produced by python2 that however seems to be a problem. This is testcode that produces a tarfile. #! /usr/bin/python compression = "bz2" tarmode = "w|%s" % compression rt = '.' import os import os.path import errno import tarfile as tar def process(): pj = os.path.join entries = os.listdir(rt) of = open("DUMP.tbz", "w") tf = tar.open(mode = tarmode, fileobj = of, encoding = 'ascii', format = tar.PAX_FORMAT) for entry in entries: fqpn = pj(rt, entry) try: tf.add(fqpn, entry, recursive = False) except OSError as ErrInfo: print("%s: disappeared" % fqpn) if ErrInfo.errno != errno.ENOENT: raise tf.close() of.close() if __name__ == "__main__": process() == This is testcode that checks a tarfile #!/usr/bin/python compression = "bz2" tarmode = "r|%s" % compression import os import os.path import stat import tarfile as tar def equalfile(fl1, fl2): bf1 = fl1.read(8192) bf2 = fl2.read(8192) while bf1 == bf2: if bf1 == "": return True bf1 = fl1.read(8192) bf2 = fl2.read(8192) return False def process(): gf = open("DUMP.tbz", "r") tf = tar.open(mode = tarmode, fileobj = gf, encoding = 'ascii', format = tar.PAX_FORMAT) for tarinfo in tf: entry = tarinfo.name fileinfo = os.stat(entry) if stat.S_ISREG(fileinfo.st_mode) and tarinfo.isreg(): bfl = tf.extractfile(tarinfo) ofl = open(entry) if not equalfile(bfl, ofl): print("%s: does not match backup" % entry) sync = False tf.close() gf.close() if __name__ == "__main__": process() = When I use python2.7 to produce and later check the tarfile everything works as expected. However when I use python3.2 to check the tarfile I get the following traceback. Traceback (most recent call last): File "tarchck", line 39, in process() File "tarchck", line 25, in process encoding = 'ascii', format = tar.PAX_FORMAT) File "/usr/lib/python3.2/tarfile.py", line 1771, in open t = cls(name, filemode, stream, **kwargs) File "/usr/lib/python3.2/tarfile.py", line 1667, in __init__ self.firstmember = self.next() File "/usr/lib/python3.2/tarfile.py", line 2418, in next tarinfo = self.tarinfo.fromtarfile(self) File "/usr/lib/python3.2/tarfile.py", line 1281, in fromtarfile buf = tarfile.fileobj.read(BLOCKSIZE) File "/usr/lib/python3.2/tarfile.py", line 573, in read buf = self._read(size) File "/usr/lib/python3.2/tarfile.py", line 585, in _read buf = self.__read(self.bufsize) File "/usr/lib/python3.2/tarfile.py", line 604, in __read buf = self.fileobj.read(self.bufsize) File "/usr/lib/python3.2/codecs.py", line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 10: invalid start byte I have been looking around but have no idea how I have to adapt this code in order to have it process the tarfile under python3.2. The original code didn't have the coding and format keywords on the tar.open statement and after reading the documentation I thought that would make things work, but no such luck. Further reading didn't provide anything usefull -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
socket.makefile raises ValueError when mode = 'rt'
This is using python 3.2. I am writing somekind of wrapper around the ftplib. So that you can work with it as if you are working with local files. The idea is that you start with making a connection like rmt = FTP(...) and then do something like the following rmtfl = rmt.open("rmtfilename", "rt") for ln in rmtfl: treat(ln) This is part of the code: class ftpfile: def __init__(self, cn, rfn, mode, bound = False): self.ftp = cn self.bound = bound if 'b' in mode: self.ftp.voidcmd('TYPE I') else: self.ftp.voidcmd('TYPE A') if 'r' in mode: self.cnct = self.ftp.transfercmd("RETR %s" % rfn) self.fl = self.cnct.makefile(mode) elif 'w' in mode: self.cnct = self.ftp.transfercmd("STOR %s" % rfn) self.fl = self.cnct.makefile(mode, newline = '\r\n') else: raise ValueError("%s: invalide mode" % mode) The problem is with makefile. If mode contains a "t" I get the following traceback: Traceback (most recent call last): File "ftputil.tpy", line 14, in test_textftp rmtfl1 = rmt.open('ftp1.py', 'wt') File "/local/home/apardon/src/projecten/py3lib/ftputil.py", line 76, in open return ftpfile(ftp, fn, mode, True) File "/local/home/apardon/src/projecten/py3lib/ftputil.py", line 15, in __init__ self.fl = self.cnct.makefile(mode, newline = '\r\n') File "/usr/lib/python3.2/socket.py", line 151, in makefile raise ValueError("invalid mode %r (only r, w, b allowed)") ValueError: invalid mode %r (only r, w, b allowed) But the documentation states: socket.makefile(mode='r', buffering=None, *, encoding=None, errors=None, newline=None) Return a file object associated with the socket. The exact returned type depends on the arguments given to makefile(). These arguments are interpreted the same way as by the built-in open() function. And since 't' is allowed in the mode of the built-in open() function I would consider this a bug. Unless I am missing something? -- http://mail.python.org/mailman/listinfo/python-list
Re: socket.makefile raises ValueError when mode = 'rt'
Op 01/09/13 14:54, Dave Angel schreef: > On 01/09/2013 08:22 AM, Antoon Pardon wrote: >> This is using python 3.2. ... >> But the documentation states: >> socket.makefile(mode='r', buffering=None, *, encoding=None, errors=None, >> newline=None) >> Return a file object associated with the socket. The exact returned >> type depends on the arguments given to makefile(). These arguments are >> interpreted the same way as by the built-in open() function. >> >> And since 't' is allowed in the mode of the built-in open() function I >> would consider this a bug. >> Unless I am missing something? > I believe that 't' was a new addition to mode, for Python 3.x So > perhaps the socket library hasn't kept consistent with it. > > I don't really know the socket library. Does it even support text > mode? Does that make sense? Remember that text mode means a different > thing in 3.x than it did in 2.x As far as I understand the code, it does support text. This is part of the makefile method. def makefile(self, mode="r", buffering=None, *, encoding=None, errors=None, newline=None): for c in mode: if c not in {"r", "w", "b"}: raise ValueError("invalid mode %r (only r, w, b allowed)") writing = "w" in mode reading = "r" in mode or not writing assert reading or writing binary = "b" in mode ... if binary: return buffer text = io.TextIOWrapper(buffer, encoding, errors, newline) text.mode = mode return text So it seems that if the mode is not binary an io.TextIOWrapper is returned. That indicates to me that text mode is supported. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Making a logging handler that produces context.
I have some in house code for which I am considering replacing the logging code with something that uses the logging module. The code is typically used as a cron job with everything higher than info logged to a file and everything higher than warning logged to stderr. However there is one thing the in-house log code does, that seems difficult to do with the logging module, provide some context. The in-house handlers give the possibilty to specify the number of lines of context the hander can provide. So the following code: Logger(fn = "file.log", level = info) Logger(fl = stderr, level = warning, context = 2) log(INFO, "line 1") log(INFO, "line 2") log(INFO, "line 3") log(INFO, "line 4") log(WARNING, "line 5") Will sent something like the following lines to stderr: INFO: line 3 INFO: line 4 WARNING: line 5 I tried the code below, but that produced the same as the ordinary StreamHandler. class ContextStreamHandler (StreamHandler): def __init__(self, stream=None, context = 5): self.recqueue = deque([], context) StreamHandler.__init__(self, stream) #__init__ def handle(self, record): print("CONTEXT HANDLER") rv = self.filter(record) if rv: self.acquire() try: for rec in self.recqueue: self.emit(rec) self.recqueue.clear() self.emit(record) finally: self.release else: self.recqueue.append(record) return rv #handle #ContextStreamHandler -- http://mail.python.org/mailman/listinfo/python-list
Re: Making a logging handler that produces context.
Op 14-01-13 13:38, Peter Otten schreef: > It turns out the logic of the above is correct. The problem is that the > handler has to see the INFO-level records while the filter() method has to > reject them. The following configuration seems to achieve that: I see, I thought trowing away logrecords of too low a level was also done by the filter method. But if I now understand correctly logrecords of too low a level are thrown away earlier and don't even reach the handle method. Thanks for the insight. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 02/03/2012 06:04 AM, Steven D'Aprano wrote: Ultimately, there is no right answer, because the multitude of requirements are contradictory. No matter what Python did, somebody would complain. Which makes me wonder why it was introduced at all, or at least so fast If you see the difference in speed in introducing augmented assignment vs how long it took to get conditional expression I start thinking of a bikeshed. In the first case we have something that raises semantic questions that are difficult to resolve, in the second case the semantics were clear, the big problem that delayed introduction was what syntax to use. But the second took a lot longer to become part of the language than the first, which seems very odd to me. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: sum() requires number, not simply __add__
On 02/24/2012 12:33 AM, Steven D'Aprano wrote: If your application stops working after you carelessly mess with components your application relies on, the right answer is usually: "Don't do that then." Python doesn't try to prevent people from shooting themselves in the foot. Yes it does! A simple example is None as a keyword to prevent assignments to it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Don't understand SequenceMatcher from difflib
I have the following code I wrote. == from difflib import SequenceMatcher import sys write = sys.stdout.write warn = sys.stderr.write def program(argv): ls1 = open(argv[1]).readlines() ls2 = open(argv[2]).readlines() matcher = SequenceMatcher(ls1, ls2) s1 = 0 s2 = 0 print ls1 print ls2 warn("*** %d %d \n" % (len(ls1), len(ls2))) for e1, e2, lg in matcher.get_matching_blocks(): warn("*** %d %d %d\n" % (e1, e2, lg)) for i in xrange(s1, e1): write('- ') write(ls1[i]) for i in xrange(s2, e2): write('+ ') write(ls2[i]) for i in xrange(e1, e1+lg): write(' ') write(ls1[i]) s1, s2 = e1 + lg, e2 + lg if __name__ == '__main__': program(sys.argv) === Now when I run it I get the following result: python diff.py map.0 map.1 ['\n', 'begin\n', ' a1\n', ' a2\n', ' a3\n', ' a4\n', ' a5\n', 'end\n', '\n', 'begin\n', ' c1\n', ' c2\n', ' c3\n', ' c4\n', ' c5\n', ' c6\n', ' c7\n', 'end\n', '\n', 'begin\n', ' e1\n', ' e2\n', ' e3\n', ' e4\n', ' e5\n', ' e6\n', ' e7\n', ' e8\n', ' e9\n', 'end\n'] ['\n', 'begin\n', ' a1\n', ' a2\n', ' a3\n', ' a4\n', ' a5\n', 'end\n', '\n', 'begin\n', ' c1\n', ' c2\n', ' c3\n', ' c4\n', ' c5\n', ' c6\n', ' c7\n', 'end\n', '\n', 'begin\n', ' d1\n', ' d2\n', ' d3\n', 'end\n', '\n', 'begin\n', ' e1\n', ' e2\n', ' e3\n', ' e4\n', ' e5\n', ' e6\n', ' e7\n', ' e8\n', ' e9\n', 'end\n'] *** 30 36 *** 36 0 0 - - begin - a1 - a2 - a3 - a4 ... - Traceback (most recent call last): File "diff.py", line 31, in program(sys.argv) File "diff.py", line 21, in program write(ls1[i]) IndexError: list index out of range What I don't understand is: The first list is 30 items long and the second 36. But the first match I get after calling get_matching_blocks says the match starts at item 36 of the first list. Yes I noticed it is the sepcial last match with 0 siza,e but even if that would be correct because there would be no common items, the first number of the match shouldn't be more than the length of the first list. What am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't understand SequenceMatcher from difflib
On Tue, Jun 21, 2011 at 03:02:57PM -0400, Terry Reedy wrote: > On 6/21/2011 9:43 AM, Antoon Pardon wrote: > > > matcher = SequenceMatcher(ls1, ls2) > ... > >What am I doing wrong? > > Read the doc, in particular, the really stupid signature of the class: > > "class difflib.SequenceMatcher(isjunk=None, a='', b='', autojunk=True)" > You are passing isjunk = ls1, a = ls2, and by default, b=''. So > there are no matches, len(a) = 36, len(b) = 0, and the dummy match > is (36,0,0) as you got. Yes my penny dropped an hour after I send the question. But reading the doc in itself didn't help. I head read and reread it a number of times, before I finaly posted the question. Somehow this signature reminded me of the range function where if you only provide one argument, this is considered to be the second parameter with the first parameter taking on a default value. So somehow I assumed that if you only provided two parameters, these would be shifted as in range and the first parameter would default to None. I know if you read the documentation carefully, it contradicts this, but my assumption blinded me for seeing it. > There are also several example in the doc, all like > >>> s = SequenceMatcher(None, " abcd", "abcd abcd") # or > >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd") > > So you will get better results with > matcher = SequenceMatcher(None, ls1, ls2) # or > matcher = SequenceMatcher(a=ls1, b=ls2) > > In the future, please try to simply examples before posting for help. Yes my bad here. I should have prepared the question better. Frustration got the better of me. Thanks for responding anyway. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: > The removal of cmp from the sort method of lists is probably the most > disliked change in Python 3. On the python-dev mailing list at the > moment, Guido is considering whether or not it was a mistake. > > If anyone has any use-cases for sorting with a comparison function that > either can't be written using a key function, or that perform really > badly when done so, this would be a good time to speak up. How about a list of tuples where you want them sorted first item in ascending order en second item in descending order. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Wed, Mar 23, 2011 at 02:59:09PM +0100, Stefan Behnel wrote: > Antoon Pardon, 23.03.2011 14:53: > >On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: > >>The removal of cmp from the sort method of lists is probably the most > >>disliked change in Python 3. On the python-dev mailing list at the > >>moment, Guido is considering whether or not it was a mistake. > >> > >>If anyone has any use-cases for sorting with a comparison function that > >>either can't be written using a key function, or that perform really > >>badly when done so, this would be a good time to speak up. > > > >How about a list of tuples where you want them sorted first item in ascending > >order en second item in descending order. > > You can use a stable sort in two steps for that. Which isn't helpfull if where you decide how they have to be sorted is not the place where they are actually sorted. I have a class that is a priority queue. Elements are added at random but are removed highest priority first. The priority queue can have a key or a cmp function for deciding which item is the highest priority. It can also take a list as an initializor, which will then be sorted. So this list is sorted within the class but how it is sorted is decided outside the class. So I can't do the sort in multiple steps. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Wed, Mar 23, 2011 at 10:40:11AM -0600, Ian Kelly wrote: > On Wed, Mar 23, 2011 at 9:14 AM, Antoon Pardon > wrote: > > Which isn't helpfull if where you decide how they have to be sorted is > > not the place where they are actually sorted. > > > > I have a class that is a priority queue. Elements are added at random but > > are removed highest priority first. The priority queue can have a key or > > a cmp function for deciding which item is the highest priority. It > > can also take a list as an initializor, which will then be sorted. > > > > So this list is sorted within the class but how it is sorted is decided > > outside the class. So I can't do the sort in multiple steps. > > You can't do this? > > for (key, reversed) in self.get_multiple_sort_keys(): > self.pq.sort(key=key, reversed=reversed) Sure I can do that. I can do lots of things like writing a CMP class that I will use as a key and where I can implement the logic for comparing the original objects, which I otherwise would have put in a cmp function. I thought this wasn't about how one can get by without the cmp argument. This was about cases where the cmp argument was the more beautiful or natural way to handle this case. I think I have provided such a case. If you don't agree then don't just give examples of what I can do, argue how your solution would be a less ugly or more natural way to handle this. -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Wed, Mar 23, 2011 at 05:51:07PM +0100, Stefan Behnel wrote: > >> > >>You can use a stable sort in two steps for that. > > > >Which isn't helpfull if where you decide how they have to be sorted is > >not the place where they are actually sorted. > > > >I have a class that is a priority queue. Elements are added at random but > >are removed highest priority first. The priority queue can have a key or > >a cmp function for deciding which item is the highest priority. It > >can also take a list as an initializor, which will then be sorted. > > > >So this list is sorted within the class but how it is sorted is decided > >outside the class. So I can't do the sort in multiple steps. > > That sounds more like a use case for heap sort than for Python's > builtin list sort. See the heapq module. No the heapq module is not usefull. The heapq functions don't have a cmp, or a key argument. So you can't use it with priorities that differ from the normal order of the items. For the rest is solving this particular problem beside the point. It was just an illustration of how, sorting a list can be done in a place differently from where one decides the order-relation of the items in the list. That fact makes it less obvious to use multiple steps in the place where you actually sort. -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Thu, Mar 24, 2011 at 09:06:44AM -0600, Ian Kelly wrote: > On Thu, Mar 24, 2011 at 3:23 AM, Antoon Pardon > wrote: > > Sure I can do that. I can do lots of things like writing a CMP class > > that I will use as a key and where I can implement the logic for > > comparing the original objects, which I otherwise would have put in a > > cmp function. I thought this wasn't about how one can get by without > > the cmp argument. This was about cases where the cmp argument was the > > more beautiful or natural way to handle this case. > > That's not what you wrote before. You wrote "I can't do the sort in > multiple steps." I was just responding to what you wrote. That is because I tend to assume some intelligence with those I communicate with, so that I don't need to be pedantly clear and spell everything out. However since that seems to be a problem for you I will be more detailed. The original poster didn't ask for cases in which cmp was necessary, he asked for cases in which not using cmp was cumbersome. I gave a case where not using cmp was cumbersome. a tuple where you want it sorted with first item in descending order and second item ascending. You then responded, that you could solve that by sorting in multiple steps. The problem with this response is that how items are to be compared can be decided in a different module from where they are actually sorted. So if we would accept this MO, this would mean that any module that needed to sort something according to a provided key, would need to provide for the possibility that the sorting would have to be done in multiple steps. So, in order to avoid complexity in the internal python sort, we would increase the complexity of all library code that would need to sort things in a by the user provided way and didn't want to barf in such an event. So when I wrote I couldn't do that, I implicitly meant if you want a less cumbersome solution than using cmp, because your solution would make all library code more cumbersome. > > I think I have provided such a case. If you don't agree then > > don't just give examples of what I can do, argue how your solution > > would be a less ugly or more natural way to handle this. > > Well, the alternative is to generate the cmp function from the > externally selected keys dynamically at runtime, is it not? Something > like this: > > def get_cmp(keys): > def cmp(a, b): > for (key, reversed) in keys: > if reversed: > result = cmp(key(b), key(a)) > else: > result = cmp(key(a), key(b)) > if result != 0: > return result > return result > return cmp > > I fail to see how that is any more natural than my solution, unless > you have another way of doing it. And it's certainly not going to be > any faster. First of all, there is no need for a dynamical generated cmp function in my provided case. My cmp fumction would simply look like this: def cmp(tp1, tp2): return cmp(tp2[0], tp1[0]) or cmp(tp1[1], tp2[1]) Second, there is not only the question of what is more natural, but there is also the question of how you are spreading the complexity. Your first solution would mean spreading the complexity to all library code where the user could provide the order-relation of the items that would then be sorted within the library. This alternative of your, even if too complicated than needed would mean that libary code could just use the sort method and the complicated code is limited to those specific items that need it. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list