Re: Errin when executing a cgi script that sets a cookie in the browser
On Wednesday, June 5, 2013 1:54:45 PM UTC-6, Νικόλαος Κούρας wrote: >... > print( cookie, "Content-type: text/html; charset=utf-8\n", message ) >... If you look in the Apache error log file, you will see something like, [Wed Jun 05 16:39:14 2013] [error] [client 192.168.0.1] malformed header from script. Bad header= \xce\x91\xce\xa0\xce\x9f \xce\x94\xce\xa9 \xce\x9a\xce\x91\xce\x99 \xce\xa3\xce\xa4\xce\x9f \xce\x95\xce: koukos.py which is saying that the 'message' text is being interpreted as being part of the headers. You are missing a blank line between the header lines and the page text. That is, I think you want, print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) (ie, note the two \n's after the "utf-8" test.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Errin when executing a cgi script that sets a cookie in the browser
On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 6:56 AM, wrote: > > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, Νικόλαος Κούρας wrote: > >>... > >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) > >>... > > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) > > (ie, note the two \n's after the "utf-8" test.) > > But that won't solve it either. The default separator for print is a > space, so this will indent his Content-type line by one space. Ah, quite right. Something like print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) then. -- http://mail.python.org/mailman/listinfo/python-list
Re: Errin when executing a cgi script that sets a cookie in the browser
On 06/05/2013 04:21 PM, Chris Angelico wrote: > On Thu, Jun 6, 2013 at 7:18 AM, wrote: >> On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: ..[...] >> Ah, quite right. Something like >> >> print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) >> >> then. > > Or change the sep, or concatenate with + instead of using , between > them. Or put them on separate lines. Anything like that would work. Of course. > And it's really easy to try things out interactively to see what > they'll do... Sure, once one makes the connection between "Server Error" and missing "\n" which is where Νικόλαος was stuck I'm guessing. -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache and suexec issue that wont let me run my python script
On 06/05/2013 05:19 PM, Dennis Lee Bieber wrote: > On Wed, 5 Jun 2013 10:29:44 -0700 (PDT), Íéêüëáïò Êïýñáò > declaimed the following in > gmane.comp.python.general: >> >> In the US there is a law called the DMCA which I think would make what >> you did illegal, even though i have you a password, because i >> clearly gave you access to help me fix a problem, not to do what you >> did. Of course US law doesn't help in this case since you i live in Greece >> and you live in Australia... >> > I doubt it... DMCA mainly concerns itself with the breaking of > copyright restrictions applied to media -- for example, e-books that are > keyed to single user's account. The "CA" part is "copyright act" > (without googling, I think the "DM" is "digital millenium"); the key is > "copyright". No copyrights were violated in this teaching... >From vague memory (and without enough interest in the subject to research it), I recall hearing several news stories over the years where people where convicted (or at least charged with) violating the DMCA (or perhaps equally draconian followup U.S. laws) even though they clearly penetrated the system to point out security flaws. > But what you did was the equivalent of handing out the key to > strangers (on the Barnes&Noble Nook, the "key" is the combination of an > email address and a credit card number -- if you are willing to hand > your email and CC# to a perfect stranger they can legitimately open the > e-book file you gave them). > > In short, you "said": I give you total control over my server; do > anything you want with it though I'd like for you to clean up my mess. No he didn't -- as I read his posts he was clearly offering access for the purpose of having someone help him fix his problems. That I give you my car keys (even if you're a stranger) does not mean I am giving you permission to do whatever you want with my car. Nor does the fact that I think you shouldn't pick up hitchikers permit me to teach you a lesson by getting picked up by you and then robbing you. But a bunch of legally ignorant programmers (including myself) speculating about the subject here is about as informative as a group of 6-graders thoughts on Einstein's theory of relativity. -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache and suexec issue that wont let me run my python script
On 06/05/2013 08:02 PM, Tim Chase wrote: > On 2013-06-05 17:57, ru...@yahoo.com wrote: >> stories over the years where people where convicted (or >> at least charged with) violating the DMCA (or perhaps >> equally draconian followup U.S. laws) even though they >> clearly penetrated the system to point out security flaws. > > I suspect you read "CFAA" (Computer Fraud & Abuse Act) and thought > "DMCA" (Digital Millennium Copyright Act), as there have been a > number of prosecutions under the CFAA (including the whole Aaron > Swartz ordeal) for nebulous "exceeding authorization"/ Yes, thanks for correcting that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Errin when executing a cgi script that sets a cookie in the browser
On 06/06/2013 04:53 AM, Νικόλαος Κούρας wrote:> I have re-enabled 'suexec' and set cgi as default phphandler and then trying: > > print( cookie ) > print( '''Content-type: text/html; charset=utf-8\n''' ) > print( message ) > > - > ni...@superhost.gr [~/www/data/apps]# [Thu Jun 06 13:51:28 2013] [error] > [client 79.103.41.173] suexec failure: could not open log file > [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] fopen: Permission > denied > [Thu Jun 06 13:51:28 2013] [error] [client 79.103.41.173] Premature end of > script headers: koukos.py > > Even if dissable/enable suexec still this output error. This is only a guess but... The permissions on koukos.py have to be exactly right. Obviously if they are too restrictive Apache won't be able to read or execute it. But they can't be to open either -- in particular the file must have execute permission and must not have write permission for either group or others (write for user only). If the permissions are too open, Apache will try to write an error message to suexec.log. I suspect that your permissions (or file owner) is wrong on your suexec.log file (or containing directory) and that is the cause of the "could not open log file " message. So I think you have too problems: wrong permissions on koukos.py and wrong owner or permissions on suexec.log. For reference this is working here: -rw-r--r-- 1 apache apache 314 Jun 6 12:19 /var/log/httpd/suexec.log -rwxr-xr-x 1 me me 1113 Jun 5 14:40 koukos.py You'll need to adjust things for your particular Apache environment. As I said, this is only a guess. Hope it helps. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On 06/15/2013 03:42 AM, subhabangal...@gmail.com wrote:> Dear Group, > > I am trying to search the following pattern in Python. > > I have following strings: > > (i)"In the ocean" > (ii)"On the ocean" > (iii) "By the ocean" > (iv) "In this group" > (v) "In this group" > (vi) "By the new group" >. > > I want to extract from the first word to the last word, > where first word and last word are varying. > > I am looking to extract out: > (i) the > (ii) the > (iii) the > (iv) this > (v) this > (vi) the new > . > > The problem may be handled by converting the string to list and then > index of list. > > But I am thinking if I can use regular expression in Python. Since nobody here seems to want to answer your question (or seems even able to read it), I'll try. Is something like this what you want? import re texts = [ '(i)"In the ocean"', '(ii)"On the ocean"', '(iii) "By the ocean"', '(iv) "In this group"', '(v) "In this group"', '(vi) "By the new group"'] pattern = re.compile (r'^\((.*)\)\s*"\S+\s*(.*)\s\S+"$') for txt in texts: matchobj = re.search (pattern, txt) number, midtext = matchobj.group (1, 2) print ("(%s) %s" % (number, midtext)) -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Saturday, June 15, 2013 11:54:28 AM UTC-6, subhaba...@gmail.com wrote: > Thank you for the answer. But I want to learn bit of interesting > regular expression forms where may I? > No Mark, thank you for your links but they were not sufficient. Links to the Python reference documentation are useful for people just beginning with some aspect of Python; they are for people who already know Python and want to look up details. So it's no surprise that you did not find them useful. > I am looking for more intriguing exercises, esp use of or in > the pattern search. Have you tried searching on Google for "regular expression tutorial"? It gives a lot of results. I've never tried any of them so I can't recommend any one specifically but maybe you can find something useful there? There is also a Python Howto on regular expressions at http://docs.python.org/3/howto/regex.html Also, maybe the book "Regular Expressions Cookbook" would be useful? It seems to have a lot of specific expressions for accomplishing various tasks and seems to be online for free at http://it-ebooks.info/read/920/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/15/2013 12:18 PM, rusi wrote: > On Jun 15, 10:52 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> 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. Steven's advice on how to deal with Nikos was probably the most sensible thing I've seen posted here on the subject. 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. >[...] > Everyone is exasperated and talking of kill-filing him. Don't be silly. You don't know what "everyone" (the vast majority of whom read and don't post) here think. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Saturday, June 15, 2013 2:04:31 PM UTC-6, Νικόλαος Κούρας wrote: > Thank you ruspy. Don't thank me. You are not contributing in a positive way to the situation. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
Oops... On Saturday, June 15, 2013 12:47:18 PM UTC-6, ru...@yahoo.com wrote: > Links to the Python reference documentation are useful for people > just beginning with some aspect of Python; they are for people who > already know Python and want to look up details. That was supposed to be: Links to the Python reference documentation are NOT useful for people just beginning with some aspect of Python and as long as I'm revising, I mean that as a general statement, nothing wrong with a reference doc link accompanying a simpler explanation or pointer thereto. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/16/2013 02:04 PM, Steven D'Aprano wrote: > 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. > >> 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. 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. 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. 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. 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. 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.) So positive reinforcement for less bad behavior, negative reinforcement (which for trolling is NO response, not negative responses) for more bad. Standard behavioral conditioning. 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. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/17/2013 01:23 AM, Chris Angelico wrote: > On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus wrote: >> 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. > > This is definitely a reason to feel guilty. You are asking people to > provide live help for free, rather than simply reading the > documentation. It is NOT a matter of simply reading the documentation. I have posted here several times as have many others about some of the problems the documentation has, especially for people who don't already know Python. Take a look at issue http://bugs.python.org/issue16665 for an example of why the Python doc has some of the problems that it does. (Please change the subject line if you want to discuss the documentation rather than Nikos.) While the Python tutorial is a good answer for many people it is not the answer for everyone. Many people don't have a large block of time to sit down and go through it from beginning to end. Many people don't learn well reading a large volume of not-immediately-relevant material, trying to commit it to memory, and then trying to apply it all later, as opposed to looking up those aspects of python relevant to what they are attempting at that moment. (I am in that category.) All these problems are aggravated for people whose native language is not English. > If the help files are too technical for you, you will > need to improve your technical ability. (Though the PEPs shouldn't > need to concern you, generally.) Live help is a VERY expensive service > to offer, because it involves an expert's time dedicated to one single > person. Luckily, in a group of volunteers, participants can individually decide how much their time is worth and answer if they want or not if they don't. The reality, regardless of whether you or I think the world should not be this way, is that Nikos has embarked on his website building project and telling him to drop it and come back after he has learned more is totally ineffectual noise. > Collective help is far more efficient - that's why > documentation exists, because it gets read by far more people than > wrote it (at least, that's the theory). Yup. And it works well most of the time but occasionally not. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
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. >> 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. 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 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. 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 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'm not willing to go though twelve gazillion previous posts to try and find examples of improved behavior so I'll leave it as my personal impression and that you disagree. >> 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. Unfortunately it is not a symmetrical situation. Nikos responds only in his own threads and is more killable that many of the eggers who both more numerous and respond in many other threads that are of interest. But then I seldom killfile people (alw
Re: Don't feed the troll...
On 06/17/2013 03:43 PM, Chris Angelico wrote: > On Tue, Jun 18, 2013 at 12:41 AM, wrote: >> On 06/17/2013 01:23 AM, Chris Angelico wrote: >>> On Mon, Jun 17, 2013 at 3:04 PM, Ferrous Cranus >>> wrote: 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. >>> >>> This is definitely a reason to feel guilty. You are asking people to >>> provide live help for free, rather than simply reading the >>> documentation. >> >> It is NOT a matter of simply reading the documentation. >> I have posted here several times as have many others about >> some of the problems the documentation has, especially for >> people who don't already know Python. > > I'm aware the docs aren't perfect. But there's a world of difference between: > > "Here's my code, tell me what's wrong. TELL ME NOW!!" > > and > > "Having trouble understanding this function [link to docs] - I expect > X but Y happens". I'm not sure he even thinks in those terms. He seems to have a hard time isolating misbehaving code to a particular function's behavior. I could speculate that it doesn't occur to him to lookup the function, or it hard to find (I had lots of problems finding stuff in the Python docs at first because the difference between builtins, other functions, methods, classes (look like functions when called) was not clear to me and when I did find the right place the doc was often in terms I didn't understand), or that he does but can't get a clear idea or gets the wrong idea about how it behaves, or... Figuring out how beginners think is something that talented teachers are good at and (from my observations) almost nobody here is. > That's what I take issue with. The implication behind Nikos's > questions is that he *can't be bothered* reading the docs, which he > has explicitly confirmed above. He didn't confirm that at all! You are seeing what you want to see rather than what is there. He said he didn't read them because (see the quoted text above!), "[they] seem too technical for me", not "I can't be bothered". I agree the poor problem descriptions and the "help me now" tone (in other messages) is irritating. But I also realize I don't work for him and have no obligation to respond. So if it is something I can help with and I feel like it and no one else has posted anything useful, I might try. If I don't feel like it a quick click of the mouse moves me to the next topic. What is a waste of time is a "hey, rtfm at this link, dickwad" response. It doesn't help Nikos. It sends the message to everyone else that aggressive responses are ok And it likely prods Nikos (or whomever) to respond in kind. (A link in conjunction with some help though one hopes will be constructive.) > That's nothing to do with "the > problems the documentation has"; "[they] seem too technical for me" doesn't necessarily imply a problem with the docs (although it could) but it does imply their usefulness to Nikos is going to be limited until he gains a better understanding of some of the basic concepts and terminology of Python. And to anticipate the obvious, I am not advocating the docs be written to address Nikos' level of understanding, only that if people with much better understanding also find problems with them, that it is not surprising that Nikos has even more trouble with them, quite possibly finding them not useful at all. > if Python had perfect documentation, > he still wouldn't read it. If your crystal ball is that good, could you try using it to solve some of Nikos' problems? Now in the end you may turn out to be right and Nikos is playing everyone here to get as much free help as possible and those willing to help him are getting suckered. Still, until that becomes clear to me personally I'd rather err of the side of helping him when I can than not. And in either case abusive posts don't help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/17/2013 04:22 PM, Mark Lawrence wrote: > On 17/06/2013 15:41, ru...@yahoo.com wrote: >> It is NOT a matter of simply reading the documentation. >> I have posted here several times as have many others about >> some of the problems the documentation has, especially for >> people who don't already know Python. > > It's extremely easy to change the Python documentation, either raise an > issue on the bug tracker or send an email to IIRC docs at python dot > org. Really? Did you bother to read the link I included? Ironic that you are one of the people criticizing Nikos for not reading anything. > The fastest time I've ever seen between an issue being raised and > the change being implemented was literally minutes. If that isn't good > enough, put up or shut up. Perhaps you missed this? http://bugs.python.org/issue1397474 While the lower bound may be minutes, the upper bound is a hell of a lot longer. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/18/2013 02:22 AM, Antoon Pardon wrote: > 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. 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. >> 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). see "Drowning" below 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 reply certainly did address that and did so explicitly. Now if you mean that you don't care *why* he doesn't want to read them, the only thing that matters is that he doesn't/won't, them we have different standard for evaluating people and I don't accept yours. To me the reason does matter as it affects my evaluation of how they may adapt in the future. >> 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. see "Drowning" below. >> 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 debu
Re: Don't feed the troll...
On 06/18/2013 01:21 AM, Chris Angelico wrote: > On Tue, Jun 18, 2013 at 2:39 PM, alex23 wrote: >> tl;dr Stop acting like a troll and we'll stop perceiving you as such. > > This being Python-list, we duck-type. You don't have to declare that > you're a troll, like you would in C; you just react like a troll and > we'll treat you as one. We never ask "are you a troll", we just ask > "do you quack like a troll". People are much more complex than Python objects. While duck-typing is a useful heuristic it does not guarantee accurate results. And keep in mind that stereotyping and racial profiling are forms of duck typing. You need to be careful when duck-typing people. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
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: >>> 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. 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. >>> 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. 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. >> 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. The costs are different in magnitude. Roughly: 1.People willing to read and possibly respond helpfully to Nikos. 2.People an
Re: Don't feed the troll...
On 06/21/2013 01:32 PM, Antoon Pardon wrote: > 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: >>> 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? "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. >> 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. 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. >> 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. I haven't
Re: Making a pass form cgi => webpy framework
On 06/23/2013 07:01 AM, Νίκος wrote:> Hello, as you all know i'am using cgi method for my web script. > > I have been told that webpy is the way to go sor script simple enough as > mines. > > Can you please show me the simplest example you can think of utilizing a > templates (index.html) and a python script (metrites.py) ? > > I want to see if it is easy to ditch cgi and pass to the world of web > frameworks. I don't know anything about webpy so I can help with that. But I did want to say that you can use templates without using a web framework like webpy. They are very useful even with cgi code and can simplify the cgi code a lot. For my web server stuff (relatively small sites with low traffic) cgi is fine (simple, easy to debug, lots of online documentation and help) so I don't buy the "cgi is dead" comments seen frequently here. -- http://mail.python.org/mailman/listinfo/python-list
Re: Making a pass form cgi => webpy framework
On 06/23/2013 09:15 AM, Νίκος wrote: > Στις 23/6/2013 5:57 μμ, ο/η ru...@yahoo.com έγραψε: >> On 06/23/2013 07:01 AM, Νίκος wrote: > Hello, as you all know i'am using cgi method for my web script. >>> >>> I have been told that webpy is the way to go sor script simple enough as >>> mines. >>> >>> Can you please show me the simplest example you can think of utilizing a >>> templates (index.html) and a python script (metrites.py) ? >>> >>> I want to see if it is easy to ditch cgi and pass to the world of web >>> frameworks. >> >> I don't know anything about webpy so I can help with that. >> >> But I did want to say that you can use templates without >> using a web framework like webpy. They are very useful >> even with cgi code and can simplify the cgi code a lot. >> >> For my web server stuff (relatively small sites with low >> traffic) cgi is fine (simple, easy to debug, lots of online >> documentation and help) so I don't buy the "cgi is dead" >> comments seen frequently here. > > Exactly my sentiments. As you know my webiste is http://superhost.gr > I write my html templates in notepad++ and then i use 'metrites.py' > script as a means of opening my html templates and substitute spcial > variables of html files with the onces being calculated within my python > script, foe xample every html file of mine bottom down has its own page > counter. > > Ill give an example. >[...snip...] > Every request of an html file on superhost.gr is being redirected into > metrites.py script which make the substitution insde the html > templates(yes in one python script but it can handle all my html files > form within) > > This is the simplest idea of web frameworking (if i can call it like that) > > Now, if you can find me a better way of what i have actually descri bed > i will ditch cgi and use your method. Personally i believe a more easy > method from what i demonstrated cannot possibly .exist. Firstly, I wrote: >> I don't know anything about webpy so I can help with that. I meant, I don't know anything about webpy so I *can't* help with that. (Just in case it wasn't obvious.) The option I mentioned was continue using cgi (but using a web templates package instead of your own), not to ditch cgi. You would be ditching cgi if you switch to a web framework. I was saying that you don't have to use a web framework to use a web template package. The advantage of using an already-developed web template package is that it will have a lot more features and capabilities than your current way. The disadvantage is that it will take some time to learn to use it; you already know how to use your own template system. If you do want to look into using a template package you'll need to pick one. There is list of them with some info in each, here: http://wiki.python.org/moin/Templating?highlight=%28templates%29 Mako templates is a very popular package and since I've played with it a little, I'll use it as an example. Your template would look almost the same. Instead of using Python's %s string formatting, you would use Mako's rules for substitutions. For simple variable they use ${variablename}. > === > > > Οι servers τρέχουν Linux και ο χειρισμός του λογαριασμού χρήστη > γίνεται μέσω του cPanel. > Eδρεύουν στο Houston του Texas, σε ένα απο τα πιο αξιόπιστα - > ταχύτατα > DataCenters της Αμερικής. > Ζητείστε να σας ανοίξω δοκιμαστικό λογαριασμό μιας εβδομάδας > προς > αξιολόγηση της ποιότητας υπηρεσιών! > ${thequote} > > > > > > > > > === and your code that gets values to substitute would be the same: > == > # pick a random mp3 from the the music directory > quote = random.choice( list( open( > '/home/nikos/www/data/private/quotes.txt', encoding='utf-8' ) ) ) > # pick a random line from the quote text file > music = random.choice( os.listdir( '/home/nikos/www/data/music/' ) ) > == But instead of opening and reading index.html yourself, you use Mako to read it: template = mako.template.Template (filename='templates/index.html') and then use Mako to do the substitutions: html = template.render (thequote=quote, mp3file=music) print (html) "thequote" and "mp3file" are the variable names used inside the template. "quote" and "music" are of course the variable names yuo use in your python code. In this simple example, there is not much advantage of Mako over your templates. But with more complicated cases, for instance, when you have tables or forms that you want to dynamically construct from external data (info extracted from a database for example) then a template system like Mako makes your Python code simpler because all the table and form ' stuff is in the template file, and all the Python code has to do is get the data and pass it t
Re: Python development tools
On 06/23/2013 02:40 PM, cutems93 wrote: > [...] The Python wiki at http://wiki.python.org/moin/ has a lot of info on most of your subjects. I've included links to there for some of your items below. All your items below also have comercial products available but I an not familiar with any so all me comments below pertain only to free tools. > 1. Automated Refactoring Tools I wish. > 2. Bug Tracking This is not really Python specific so any bug tracking tool you want to use will work. There are several written in Python. The Python (cpython) project uses one called Roundup. > 3. Configuration And BuildTools 4. Distribution Utilities http://wiki.python.org/moin/DistributionUtilities > 5. Documentation Tools The most popular documentation tools for Python projects is Spinx, probably because the Python documentation itself is build with Spinx. see also http://wiki.python.org/moin/DocumentationTools > 6. Integrated Development Environments http://wiki.python.org/moin/IntegratedDevelopmentEnvironments > 7. Python Debuggers Python comes with a builtin debugger called pdb. There are also a number of other add-on debuggers like pydb. See also: http://wiki.python.org/moin/PythonDebuggingTools > 8. Python Editors Any editor for programming is fine. This is mostly personal taste and experience. It is a frequent topic of discussion here so a web search should turn up some info. > 9. Python Shells > 10. Test Software Python comes with modules that will assist you in writing your own tests, most notable unittest and doctest. There are a number of third party modules too: See http://wiki.python.org/moin/UnitTests > 11. Useful Modules The main repository for public Python modules is PyPi: See https://pypi.python.org/pypi > 12. Version Control Git and Mercurial (hg) seem to be the two most popular "modern" VCS used by Python developers with Bazaar (bzr) right behind them. There was a discussion here very recently on that subject, see https://groups.google.com/d/topic/comp.lang.python/MD4Oqq9GJiQ/discussion > What else do I need? Also, which software is used in daily base? I > know version control software and bug tracking software are used > almost everyday by developers. Which software is used less often? This really depends on what kind of development you will be doing and who else you will be doing it with. A minimal development environment is a shell, python interpreter, and an internet connection. > Also, I will use GUI interface for Python. What kind of widget > toolkits do you recommend? I know there are GTK+ and Qt. Python comes with a GUI toolkit called tkinter. The other major GUI toolkit is wxPython although it is not yet available for Python3. See also http://wiki.python.org/moin/GuiProgramming Hope this helps get you started. -- http://mail.python.org/mailman/listinfo/python-list
Re: Loop Question
On 06/23/2013 05:18 PM, christheco...@gmail.com wrote: > How do I bring users back to beginning of user/password question once they > fail it? thx This is not a very good question. There is no context so we cannot tell if you are talking about a command line program that prompts for a username and password or a GUI program with a text box asking for the user/password or something else. Nor how exactly you go about doing the asking. Some code showing what you are trying to do would help a lot. I'll guess you're asking about a simple command line program. Maybe something like the following is what you want? while True: user = input ("User? ").strip() pw = input ("Password? ").strip() if check_user (user, pw): break print ("Hello %s" % user) check_user() is a function you'll define somewhere that checks the user and password and returns True if they are correct and False if not. Since you didn't say, I'm also assuming you're using Python 3; for Python 2 the code will be a little different. This is a useful guide to asking questions in a way that makes it easier for people to answer (and thus help *you* get better, faster answers): http://www.catb.org/esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Python development tools
On 06/23/2013 05:49 PM, Roy Smith wrote:> In article <263da442-0c87-41df-9118-6003c6168...@googlegroups.com>, ru...@yahoo.com wrote: >> > 1. Automated Refactoring Tools >> I wish. > Why? I've never seen the appeal of these. I do plenty of refactoring. > It's unclear to me what assistance an automated tool would provide. I've often wanted something that would help globally change things like function and method names including across multiple files. Even variable names in large functions (ideally functions should be small enough that this is not a problem but sometime shit happens). I am not great at picking good names to begin with and often code drift makes them even worse with time. Editor search and replace doesn't cut it. Other things like finding all uses of various objects/functions etc would also be useful now and then but I suppose that is a common IDE capability? -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
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: >[...] Note: although I clipped the "group volition" paragraphs, thank you for pointing out that Nikos posts go back to dec 2011. I was not aware of that. >>> 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. 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". If you don't wish to address the issue directly then, please do so indirectly by telling how your solution, to inundate the offender (and group in general) with a deluge of flames, somehow satisfies the "concerns of individuals or small groups" and of the majority. The only rational conclusion I can draw is that you either don't care about the majority or you think the majority of people here have no problem with masses of flamage and hostile and aggressive posts. 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. This is a "no concern" argument. Many of your following points are effectively the same argument, so I will mark them all with the preceding sentence and address them all at the end. >[...snip ...] >> So what is obvious "help" to you may not be so much so to >> the recipient and in the face of all these differences >> IMO tolerance is very helpful. >> >> Again I'm not claiming that my interpretation of Nikos' >> responses must be correct; I may be wrong and he may be >> reading this and laughing his ass off at my naivete, but >> I reject your certainty that your reading as pure troll is >> the only correct one. And even if I am wrong in this particular >> case, I think tolerance is helpful for maintaining a non- >> hostile environment in general. > > What certainty? I don't claim certainty in Nikos being a pure > troll. I state that it doesn't matter to me. Yes, my mistake. > As I said earlier > intend is not magic and even if Nikos would not be a troll > but still behaves largely as one, especially after over one > year of presence I wonder what meaningful difference there is > between a real troll and someone who just behave very troll > like? Different kinds of trolls (with different motivations) one can guess will respond differently. A classic troll motivated almost exclusively by a desire to get attention and instigate discord will be energized by the hostile responses you propose. H
Re: Making a pass form cgi => webpy framework
On 06/23/2013 07:44 PM, Νίκος wrote:> Why use mako's approach which requires 2 files(an html template and the > actual python script rendering the data) when i can have simple print > statements inside 1 files(my files.py script) ? > After all its only one html table i wish to display. Good question. Sometimes your way is best. The main advantage of using templates is that the template contains only html (mostly) and the cgi code contains only python (mostly). The idea is that you can look at the template and see only the kind of code (html) that affects how the page looks. With some template systems you can edit the template files with a html editor and do the page design visually. Even in a text editor it is usually easier to see the how the html "works" without spurious stuff like code. And when you look at the cgi code, you see only the Python code that is needed to get the variable data that is displayed in the page without the distraction of a lot of html stuff. -- http://mail.python.org/mailman/listinfo/python-list
Re: newbie EOL while scanning string literal
On Tuesday, June 25, 2013 4:19:43 PM UTC-6, willle...@gmail.com wrote: >[...] > na=('type first integer n\')##THE RED SHADOW APPEARS HERE## You want \n at the end of the string, not n\. A backslash character \ in front of the ' escapes the ' and causes it to to be considered as a character in the string rather than ending the string. -- http://mail.python.org/mailman/listinfo/python-list
Re: newbie EOL while scanning string literal
On 06/25/2013 04:19 PM, willlewis...@gmail.com wrote: > I'am starting to learn python reading a book and I have to do some > exercises but I can't understand this one, when I run it it says EOL > while scanning string literal and a red shadow next to a line of > code. > > I'm trying to get input from user. I have 3 questions: > > - Whats does EOL mean and in what circumstances can I face it again > and how to avoid it. > > - Is this code correct or just looks silly, I am a newbie in > programming how can I write this code better OR is it just not right > 'specify'. You'll find some other errors in your code after you fix the string problem. I'll leave them for you to find since they're pretty obvious. But one I'll mention because it is easy to miss because it produces wrong results rather than an error. Try running your program with the input: 5, 5, 1 (which shouldn't be a triangle). > int(naa) int() *returns* the int value of naa, but doesn't change the value of naa which remains a string. > - in how many ways can I specify the input has to be an integer, do I > have to specify one by one or can I do something to get all input > converted to integers in one step. naa = int (input ('type first integer\n')) is still three steps but a little more concise. Other ways are to put one input() call inside a loop that runs three times, saving each input in an array. Or you could read one string containing three numbers in one input statement, then split them into separate numbers. These may require python stuff you haven't gotten to yet though. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/30/2013 11:25 AM, Antoon Pardon wrote: > Op 28-06-13 19:20, Ian Kelly schreef: >[...] >> 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 don't have anything to add to the discussion beyond restating what I've already said (which I'm not interested in doing), except to address this point in light of recent posts on the list. 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). Collective experience may not always be totally reliable but it seems to me it is better than the non-experience that you have offered. 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. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 07/01/2013 01:38 PM, Antoon Pardon wrote: > > 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. That is a possibility. But your "cocoon" senario is highly improbable because, 1. There will never be 100% compliance with any consensus here, and 2. There will always be enough backscatter and other leakage that all cocoons will be will rather permeable. If you'll recall it was that permeability, and the cost it imposes on the large majority of people here who object to it, that was an argument against your proposal, back at the start of this thread. Even allowing the possibility of two trolls mixing it up [*1], how does your proposal, to amplify the volume of hostility several times, improve the situation for your newbee? Far better to simply remind your newbee that most here feel that not feeding trolls is the most appropriate response and then demonstrate that in practice. >> >> 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. And a lot of misery is caused by people enforcing their idea of "right". [*1] You and Nikos in the "python adds an extra half space..." thread might be an actual example of your hypothetical: two trolls intentionally provoking each other and in the process, successfully provoking a lot of emotional reaction from others. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
Since this thread too has gone into the trash hole thanks to our resident trolls I might as well comment... On 07/02/2013 04:34 PM, Ben Finney wrote:> Joshua Landau writes: > >> On 2 July 2013 13:01, Antoon Pardon wrote: >> > 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. > > So even if that term describes their behaviour and manner, you think > no-one should ever point it out? If it is relevant and likely to be helpful to the asker, by all means please point it out. But if someone is asking a question about *python*, what relevance does their competence as an Apache administrator (or ability as a father for that matter) have to do with it? [*1] 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." In Nikos' case, unless you're an idiot or severely socially challenged, it should have been clear early on that pointing out his knowledge deficits was not going to be helpful to him. Telling him to "hire someone" without any knowledge of his goals or resources is as patently assine as trying to justify it as "telling the truth". >> > 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. > > So you agree the correct term to use *is* “incompetent”, as Anton said. > Yet you don't want Anton to use the correct term. > > Needless to say, I disagree with your position. There is no place for > baseless insults in this community; but when the behaviour of someone in > this community is harmful, then it is entirely appropriate to use clear > terms (e.g. “incompetent”, “inconsiderate”) to describe their behaviour. Those are anything but clear. They are subjective and highly judgmental and frequently applied one-sidedly. (Not "rude" when an alpha poster here says it but "rude" when someone else does.) 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. [*1] I realize in Nikos' case, there were questions about web site administration, but then the answer should be (if you don't want to deal with it and you can't can't control your need to reply with something), a polite, "that's off topic here but the apache list might be able to help you." -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 07/02/2013 05:18 PM, Joshua Landau wrote: > On 2 July 2013 23:34, Ben Finney wrote: >[...] >> Needless to say, I disagree with your position. There is no place for >> baseless insults in this community; but when the behaviour of someone in >> this community is harmful, then it is entirely appropriate to use clear >> terms (e.g. “incompetent”, “inconsiderate”) to describe their behaviour. > > Firstly, describing someone's behaviour and describing someone's > character are two completely different things. The second is far more > judgemental and unhelpful than the first. Antoon is describing > people's character. You are talking about describing their actions. In practice there is often little difference. "You are acting like an asshole" could be defended as describing a behavior and "you are rude" as describing a character (rude by nature). The reality is that few of the people at whom such statements are aimed will make such fine distinction. If you use negatively judgemental statements against other posters, a significant number of them will respond to you in kind. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 07/03/2013 08:12 AM, feedthetr...@gmx.de wrote: > > Am Mittwoch, 3. Juli 2013 12:00:14 UTC+2 schrieb Νίκος: >> >> Στις 3/7/2013 12:45 μμ, ο/η Chris Angelico έγραψε: >> >> ] You have betrayed the trust of all your customers. >> >> ... >> >> I just received a call form on of my customers asking me to explain your >> >> mail ... >> >> Of course i should have give you the root pass(it was indeed stupid), >> >> but you violated my trust. >> >> You should have been clear that you didnt want to help and not asking me >> >> via private mail for the root pass. > > > > May i cite: > > Am Dienstag, 4. Juni 2013 19:12:41 UTC+2 schrieb Νικόλαος Κούρας: >> >> Τη Τρίτη, 4 Ιουνίου 2013 8:09:18 μ.μ. UTC+3, ο χρήστης Chris Angelico >> >> έγραψε: >>> >>> On Wed, Jun 5, 2013 at 3:02 AM, Νικόλαος Κούρας >>> >>> wrote: I'm willing to let someone with full root access to my webhost to see thigns from the inside. ... >>> >>> You need to read up on what happens when you enter Dummy Mode and give >>> >>> someone full root access to your web host. You really REALLY need to >>> >>> understand what that means before you offer random strangers that kind >>> >>> of access to someone else's data. >>> >>> > > * > > * >>> >>> I've half a mind to take you up on your offer, then go look for >>> >>> personal and private info from your clients, and email it to them >>> >>> (along with a link to this thread) to point out what's going on. > > * > > * >>> >>> ChrisA >> >> >> >> I know what full root access mean. >> >> I also trust you. >> >> ... > > > > Am Mittwoch, 5. Juni 2013 00:12:26 UTC+2 schrieb Chris Angelico: >> >> The call is strong... I could rule the galaxy alongside my father... >> >> I've searched my feelings, and I know this to be true! >> >> > > * > > * >> >> Okay. I accept. I'll **do as I promised.** Might be interesting, and >> >> educative - for someone, at least. > > * > > * > > [emphasis added for those, who do not want to read the whole post] > > > > Any questions? Yes. If you tell someone you're going to beat them up but they don't take you seriously because they are naive, or they think you're kidding, or they don't understand you because you told them in hints rather than directly, is it ok to beat them up? Are the existence of laws against beating people up negated because you told them in advance? Or negated because they "deserve" the beating? Does it make any difference if they contribute to their own beating, say by showing up at a designated place and time? Does it make any difference if the beating is for their own good? (In the beater's opinion?) (In the majority opinion?) Does it make any difference if there are ways other than beating of communicating the message? How long and how hard should those alternate ways be tried before resorting to beating? I am sorry Mr/Ms. FeedTheTroll for being so dumb. I know the answers to all these questions are obvious to everyone else here but I am not sure about them. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
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. And yes, I think "wouldn't antagonize your boss" is not a bad heuristic for judging the politeness of your response. You shouldn't be asking for respect from other posters here if you're not willing to provide the same respect IMO. But even if you reject that there is the fundamental nature of people: that if you disrespect others they are likely to respond in kind and (IMO) most people here find the resulting climate unpleasant. You can't do much about trolls who occasionally show up and disrespect you but you can promote a climate of respect by not responding in kind. > 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. There are many things "accepted on this list" that are questionable. 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? >> 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. You do not have state your belief on every off-topic inflammatory subject that happens to come up. And if you don't want to help someone because of something you don't like about them, you don't have to. But you also don't have to tell all of us why we should agree with you or try to publicly bully into not helping those who don't share your opinion. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 07/02/2013 07:24 PM, Steven D'Aprano wrote: >[...] > On the other hand, I've certainly learned a lot in my newbie days from > being told off quite harshly by some of the Python community alphas, like > the Effbot Fredrik Lundh, and Alex Martelli. It hurts to be told you're > an idiot by one of the alphas, but sometimes you need to be told you're > an idiot[1]. Even if you're not, realising that others think you are > builds character[2]. True, for some people, some times. As your [2] footnote admits it can be damaging as well. I have noticed that the ratio of female to mail posters here (at least as I can guess from names) seems far lower than the same ratio of programmers where I've worked. I asked a female programmer once why she didn't use groups like c.l.p. and she cited harshness and bickering as the main reason. Obviously a sample of one doesn't prove anything but... Effbot was around when I first started reading c.l.p and although I immediately recognized his contributions to and knowledge of python, I always questioned whether his positive contributions weren't negated by his negative ones. (Consider how many positive things he contributed that wouldn't have been mentioned by someone else had he not posted them, versus the disruption caused in reaction to his attitude.) >[...] > [2] Sometimes it builds stronger, better character. Sometimes it builds > weaker, broken character. It's all character. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 07/03/2013 12:08 PM, rusi wrote: > On Wednesday, July 3, 2013 10:31:23 PM UTC+5:30, ru...@yahoo.com wrote: >> Are the existence of laws against beating people up negated because >> you told them in advance? Or negated because they "deserve" the >> beating? > > One of the fundamental purpose of laws is to legalize what you call > 'beating-up' Goes by the names like jail-sentences, fines and > ultimately capital punishment. Thanks, I hadn't realized there were laws requiring Nikos to be competent to run a web server business. Next time I interact with Nikos I'll inform him that he is acting illegally and C.L.P. has been empowered (I'm still a little fuzzy about by who) to punish him! > Civilization would not be possible without these. > > BTW the etymological roots of 'civilization' come from 16th century > usages such as "I shall civilise thee with my rod" Again thanks! That never occurred to me. Since "civilization" is a word in the *English* language and since we English speakers (especially us Christian ones!!) define morality and civilization for the world, then that word's root is really significant! >> Does it make any difference if the beating is for their own good? >> (In the beater's opinion?) (In the majority opinion?) > > As a good Christian I believe that Chris tried more than anyone else > on this list to help Nikos before talking recourse to another gem of > biblical wisdom: He that spareth his rod hateth his son: but he that > loveth him chasteneth him betimes. Wow! And yet again thanks! Now that I know I can just apply Christian ethics, my questions are answered. You know, those ethics that results in the crusades against the Islamic world, the ethics that thought it a great idea to torture heretics to death in the Inquisition, the ethics that resulted in the genocide of millions of South, Central and North American indigenous people who refused to accept Jesus and persisted in their heathen devil-worshiping ways? The ethics that even today deny abortions to women at risk of death carrying pregnancy to full term? I'll will go and reread my bible to figure out how to deal with Nikos. That's what I love about the Internet!!! Post a question and one gets an answer in minutes! No need to think or study all those dull old philosophy and sociology books. >[...snip...] -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 07/03/2013 05:12 PM, Joshua Landau wrote: > On 3 July 2013 02:21, wrote: >[...] >> The reality is that few of the people at whom such statements >> are aimed will make such fine distinction. If you use negatively >> judgemental statements against other posters, a significant >> number of them will respond to you in kind. > > I think most people will take "you are stupid" and "what you've done > is stupid" to have very different levels of hostility, even though the > same thing to be said has been expressed. That does not mean people > will not take offense at the second, but they will take less. I > believe that this does generalise. I think the first is perceived as more hostile not because of any character vs behavior difference but simply because it is broader -- the implication is that most anything done by the person will be stupid rather than one specific action for the second. If one compares "you're stupid to have done that" (character) vs "what you've done is stupid" (behavior), I am not sure there is much difference; at least I don't think I'd make much distinction. IOW, I maintain that it is the "stupid" part that results in the major part of the recipient's negative reaction. Of course since neither of us are psychologists this is all pretty speculative. > Note that I am not advocating calling people's actions stupid, as it > is still just a harsher way of saying "you've made a mistake". Agreed, 100%. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
On 07/03/2013 09:07 PM, rusi wrote: >[...] > I got into it because I felt Chris had done more service to Nikos and > the list than others and then was being misrepresented. I don't know why you think I "misrepresented" him. I questioned the morality of his accepting access to Nikos' server and then doing what he did. If you think it is a black-and-white question then you are welcome to your opinion but you are wrong. Somebody needed to point out the other side even if it happens to be a minority opinion here. Those actions of Chris and their morality are independent of any other help he did or did not provide Nikos which is why I clipped that part. (For the record I could post links to a number of distinctly unhelpful posts Chris also made to Nikos but I am not disputing in general Chris' efforts here.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Important features for editors
On 07/04/2013 08:24 AM, MRAB wrote: > On 04/07/2013 14:22, Tim Chase wrote: >> On 2013-07-04 05:02, Dave Angel wrote: >> [snip an excellent list of things to look for in an editor] > It's 2013, yet Unicode support is merely a "nice-to-have"? I agree that this is pretty important. Even if you don't have to deal with Unicode today, the chances are good that you will need to, if only in an occasional way, in the future. One thing not mentioned (sorry if I missed it) that I use more than many of the features that have been mentioned is some form of advanced search/replace. I.e. something that can do regular expression searches and replaces including multiline ones. Another feature I find necessary is very fast start up time since I open an editor hundreds of times a day. Because advanced features and fast startup seem to be mutually exclusive, I often use two editors, a simple but quick starting one like Gedit on Linux or Notepad on Windows for 90% of routine editing and Emacs for the the other 10% when I need to do something more powerful. But as a disclaimer I should add that I do not spend 8+ hours a day doing nothing but programming so YMMV. BTW, the group is currently having a problem both with trolls and with regulars here that bite at every baited hook that drifts past their screen. There seems to nothing to be done other than ignore the obnoxious posts but I am sorry they have infiltrated your discussion. Hopefully this comment won't add to the problem. -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
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. 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. 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. (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 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. >> 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 [...] No. I originally wrote "your boss (or anyone else where impoliteness could have real consequences for you)." I believe most people would read that as intended, some sort of generalized authority figure, if not boss then maybe a police officer, or a powerful politician that could quaff your permit application, or the touchy father of a woman you want to date, and not necessarily "Mr. Joel Davis, my boss at this job at this moment and also my golfing buddy." > 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. The answers will presumably share a common characteristic: the need to address the person with politeness and respect, even when expressing disagreement with them. >> 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 priso
Re: python adds an extra half space when reading from a string or list
On 07/04/2013 02:50 AM, feedthetr...@gmx.de wrote: > Am Mittwoch, 3. Juli 2013 19:01:23 UTC+2 schrieb ru...@yahoo.com: >[...] Any questions? >> Yes. >[...] >> I know the answers to all these questions are obvious >> to everyone else here but I am not sure about them. > > Then I hope, I was able to enlighten you. ;-) as i said, i love the internet, it's so easy to get answers to all those questions i thought were difficult and complex. You cleared everything up in just a few sentences, thanks. i'm now going to go read the truth about the 9-11 attacks. -- http://mail.python.org/mailman/listinfo/python-list
Re: List comp help
On 07/14/2013 11:16 AM, Chris Angelico wrote: > On Mon, Jul 15, 2013 at 3:10 AM, Joseph L. Casale > wrote: >> I have a dict of lists. I need to create a list of 2 tuples, where each >> tuple is a key from >> the dict with one of the keys list items. >> >> my_dict = { >> 'key_a': ['val_a', 'val_b'], >> 'key_b': ['val_c'], >> 'key_c': [] >> } >> [(k, x) for k, v in my_dict.items() for x in v] >> >> This works, but I need to test for an empty v like the last key, and create >> one tuple ('key_c', None). >> Anyone know the trick to reorganize this to accept the test for an empty v >> and add the else? > > Yeah, it's remarkably easy too! Try this: > > [(k, x) for k, v in my_dict.items() for x in v or [None]] > > An empty list counts as false, so the 'or' will then take the second > option, and iterate over the one-item list with None in it. Or more simply: [(k, v or None) for k, v in my_dict.items()] This assumes that all the values in my_dict are lists, and not other false values like 0, which would also be replaced by None. -- http://mail.python.org/mailman/listinfo/python-list
Re: List comp help
On Sunday, July 14, 2013 12:32:34 PM UTC-6, ru...@yahoo.com wrote: > Or more simply: > [(k, v or None) for k, v in my_dict.items()] Too simply :-( Didn't read the op carefully enough. Sorry. -- http://mail.python.org/mailman/listinfo/python-list
email 8bit encoding
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? -- http://mail.python.org/mailman/listinfo/python-list
Re: [python] email 8bit encoding
On 07/29/2013 12:16 AM, W. Trevor King wrote: > On Sun, Jul 28, 2013 at 04:41:27PM -0700, ru...@yahoo.com wrote: >> 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 asked about this a while back [1], but never got a response. My > current best-guess is here [2]. My fallback flattening works for > everything except the 8-bit encoded messages using the UTF-16 charset, > but it's pretty ugly. > > Let me know if you figure out something cleaner :). > > Cheers, > Trevor > > [1]: http://thread.gmane.org/gmane.comp.python.general/725425 > [2]: https://github.com/wking/rss2email/blob/master/rss2email/email.py#L226 Thanks, that was very helpful. My code is just a quick utility tool for internal use so I am able to be fairly hackish without shame. :-) Since I am synthesizing the mails from scratch and the encoding requirements fairly simple, I could probably dispense with the email/smtplib packages altogether and just pipe my text directly to sendmail. But I thought using Python's email package would be easier. Silly me. Thanks again. -- http://mail.python.org/mailman/listinfo/python-list
Re: simpler increment of time values?
On Wednesday, July 4, 2012 6:29:10 PM UTC-6, Vlastimil Brom wrote: > Hi all, > I'd like to ask about the possibilities to do some basic manipulation > on timestamps - such as incrementing a given time (hour.minute - > string) by some minutes. > Very basic notion of "time" is assumed, i.e. dateless, > timezone-unaware, DST-less etc. > I first thought, it would be possible to just add a timedelta to a > time object, but, it doesn't seem to be the case. > > The code I came up with (using time and datetime modules) seems rather > convoluted and I would like to ask about some possible more > straightforward alternatives I missed. > The equivalent function (lacking validation) without the (date)time > libraries seems simple enough (for this limited and individual task). > Although it is probably mostly throw-away code, which seems to do what > I need, I'd be interested in better/more elegant... solutions. > > # # # > import time > import datetime > import re > > print re.sub(r"^0","", (datetime.datetime(*list(time.strptime("8.45", > "%H.%M"))[:6]) + datetime.timedelta(minutes=30)).strftime("%H.%M")) > # 9.15 > > # # # # # # # # # > > def add_minutes(hour_min_str, separator=".", minutes_to_add=0): > h, m = [int(s) for s in hour_min_str.split(separator)] > sum_minutes = h * 60 + m + minutes_to_add > h, m = divmod(sum_minutes, 60) > h = h % 24 > return "%s%s%s" % (h, separator, m) > > print add_minutes(hour_min_str="8.45", separator='.', minutes_to_add=30) > # 9.15 > > # # # # # # # # # > > Is it true, that timedelta cannot be used with dateless time values? > (Is there some other possibility than the current one, where strptime > actually infers 1. 1. 1900?) > Is there some simpler way to adapt the incompatible output of strptime > as the input of datetime? > Is it possible to get one-digit hours formatted without the leading zero? > > Thanks in advance for any suggestions or remarks; >regards, > Vlastimil Brom If it's any consolation, I had to add a small constant time delta to all the times in a video subtitles file and my code ended up looking very much like yours. What should have take five minutes to write took several hours, I remain surprised and disappointed that doing something so simple (read time text into time object, add timedelta, print result) was so awkward in Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: simpler increment of time values?
On Thursday, July 5, 2012 11:34:16 AM UTC-6, John Nagle wrote: >[...] >You can also call time.time(), and get the number of seconds > since the epoch (usually 1970-01-01 00:00:00 UTC). That's just > a number, and you can do arithmetic on that. > >Adding a datetime.time to a datetime.timedelta isn't that > useful. It certainly is useful and I gave an obvious and real- world example in my previous post. > It would have to return a value error if the result > crossed a day boundary. Why? When I turn the adjustment knob on my analog clock it crosses the day boundary from 23:59 to 0:00 with no problem whatsoever. Why is Python unable to do what billions of clocks do? Instead I have to convert everything to seconds and do the same math I would have done in fortran in 1980. Phew. Another example of Pythonic "purity beats practicality" -- http://mail.python.org/mailman/listinfo/python-list
Re: Article on the future of Python
On 09/27/2012 10:37 PM, Chris Angelico wrote:>[...] > * MySQL is designed for dynamic web sites, with lots of reading and > not too much writing. Its row and table locking system is pretty > rudimentary, and it's quite easy for performance to suffer really > badly if you don't think about it. But if your needs are simple, MySQL > is probably enough. PostgreSQL uses MVCC to avoid locks in many cases. > You can happily read from a row while it's being updated; you'll be > unaware of the update until it's committed. MVCC comes with a cost though, as anyone who has ever needed to do a SELECT COUNT(*) on a large Postgresql table knows. >[...] > * Both engines have good support in popular languages, including > (dragging this back on topic, kicking and screaming) Python. Maybe things are different now but a few years ago I was trying to choose between Postgresql and Mysql about the time Python 2.4 (I think) was released. After waiting for over a year for the Python mysql dbi module to be released for the then current version of Python (I needed a binary for Windows) I finally gave up and decided to go with Postgresql (the psycopg2 module was available a very short time after the new Python was.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/14/2012 03:58 PM, Ben Finney wrote:> Zero Piraeus writes: >[...] > What's needed, IMO, is a difficult balance: there needs to be calm, > low-volume, but firm response to instances of hostile behaviour, making > clear by demonstration – especially to the people only observing the > discussion – that such hostility is unwanted and not to be tolerated in > our community. >[...] The problem with this is that while there may sometimes be a weak consensus, different people have different ideas about what is "wrong". Thus when a member of this esteemed group was recently attacked as racist, for punning another member's name when responding somewhat heatedly, I, according to your view, should have jumped in to point out unfair accusations of racism are not only wrong, but hurt the cause of anti-racism by devaluing such charges when they are legitimate. No, what you propose will only reduce the signal to noise ratio and increase the amount of off-topic arguments. The old tried-and-true advise is still the best: don't feed the trolls. Experience with three decades of mailing lists and usenet has shown that most of them give up and go somewhere else when they don't get a response. Of course this does not apply when you are the one attacked (or perceive you are) -- in that case your advice for a low-key factual response is quite appropriate. (And then drop it.) > To those who feel the need to “fight” the trolls: thank you for caring > enough about the Python community to try to defend it. But I'm concerned > that you tend to pour fuel on the flames yourself, and I hope you can > work to avoid becoming the monster you fight. > >> And, yes, I know bringing it up could be construed as stoking the >> flames ... but, well, "silence = acquiescence" and all that. > > Agreed. Thanks again. No. Silence != acquiescence as a few minutes of thought will show. The fact that it is often repeated does not make it true. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/14/2012 10:36 PM, alex23 wrote:> On Oct 15, 1:22 pm, ru...@yahoo.com wrote: >> Thus when a member of this esteemed group >> was recently attacked as racist, for punning another member's >> name when responding somewhat heatedly, > > Again, there is a difference between "attacking" someone "as racist" > and *criticising* their *comments* as *possibly* racist. When the > person whose name was being punned said that they themselves were > unsure whether it was intended as a racial attack, then the behaviour > was worth commenting on. I just went back and reread what you and some others wrote to make sure I was not misremembering and am comfortable sticking with my description. (FTR, your initial response was "Please, don't be a dick.") My intent was not to reargue that issue but to point out that different people have differing ideas on what is "acceptable" and "unacceptable" here and that if Ben Finney's advice to respond (in moderation) whenever one reads an "unacceptable" opinion is taken, one will create an environment in which troll's will flourish. The best advise is to ignore such posts and encourage others to do the same. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/16/2012 10:49 AM, Steven D'Aprano wrote: > > On Tue, 16 Oct 2012 09:27:48 -0700, rurpy wrote about trolls and dicks: No, I wrote about trolls. "dicks" is a highly emotive and almost totally subjective word that I would not use in a rational discussion. Perhaps you were trying to be amusing? >> >> The best advise is to ignore such posts and encourage others to do the >> >> same. > > > > If you ignore such posts, how will the poster know they are unacceptable? Do you really think that in the vast majority of cases that the poster is blithely unaware of the inflammatory nature of their post? The whole point of trolling is to generate responses by posting something inflammatory. It sounds to me like your view is that most such posts are made by people who are simply brand new to the internet (or at least the civilized parts of it) and thus, when their error is pointed out, will say thanks and change their ways. > > How should somebody distinguish between "I am being shunned for acting > > like a dick", and "I have not received any responses because nobody has > > anything to add"? Because you sent them private email telling them that? (And if you can't do that, maybe you should take it as a hint that they're not particularly interested in your "help"?) > > If I believe that your behaviour ("giving lousy advice") is causing great > > harm to this community, and *I don't say anything*, how will you know to > > change your behaviour? If that was how you thought, then you would be someone I hope would follow my advice. Because you would clearly seem to be unable to distinguish between difference of opinion on a subject relevant to the newsgroup, and inflammatory trolling. Further you see the situation in extreme terms ("*great harm*") and one in which only a single point of view (your's) is acceptable. You would be bordering on delusional by thinking your post would somehow change my "behavior". But even if you had a more rational response and saved that reaction for actual trolling and not someone who simply disagreed with you, I ask again, what makes you think your response will change that troll's behavior, when in actuality, your kind of response is exactly what most trolls hope to elicit? Did it help in the case I mentioned? > > How will others know that I do not agree with your > > advice? Why is it so important to you that I and others know what you think? Since you are (usually) a reasonable person I don't need to read your explicit pronouncement to assume that you disagree with some repugnant post. If it were possible to somehow have a single, reasonable response generated to an offensive post, that would be great. But I don't think that is possible. Multiple people will feel the need to take on that duty. Others will feel the response is not strong enough or doesn't represent their personal take and post their responses. Some will respond righteously to non-offensive posts. (The use of "troll" as a synonym for "I/we don't agree with you" is quite noticeable in this group.) The perp will inevitably followup with more offensive posts in response. This is how things have worked since the invention of mailing lists and why "don't feed the trolls" has served fairly well for three decades. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/16/2012 02:17 PM, Prasad, Ramit wrote:> Steven D'Aprano wrote: >> On Tue, 16 Oct 2012 09:27:48 -0700, rurpy wrote about trolls and dicks: >> >> > The best advise is to ignore such posts and encourage others to do the >> > same. >> >> If you ignore such posts, how will the poster know they are unacceptable? >> >> How should somebody distinguish between "I am being shunned for acting >> like a dick", and "I have not received any responses because nobody has >> anything to add"? >> >> If I believe that your behaviour ("giving lousy advice") is causing great >> harm to this community, and *I don't say anything*, how will you know to >> change your behaviour? How will others know that I do not agree with your >> advice? > > I agree completely. I was about to say that I was fine with meeting > known trolls with silence, but what happens when new or infrequent > readers see the troll's writing with no one objecting? Are they to > ignore the troll or assume that the list condones the troll's words? You do not give enough credit to people. The vast majority of people are capable of recognizing offensive posts and recognizing that non-response to them is intentional. I think it is absurd to think that most normal people will see such posts and conclude that all Python programmers agree with them. (No time to look it up but I vaguely recall a long series of anti-semitic posts here that were largely ignored. I've seen no evidence that there are people who brand the Python community as anti-semitic.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/16/2012 08:45 PM, Steven D'Aprano wrote: > On Tue, 16 Oct 2012 14:10:17 -0700, rurpy wrote: > >> On 10/16/2012 10:49 AM, Steven D'Aprano wrote: >>> > On Tue, 16 Oct 2012 09:27:48 -0700, rurpy wrote about trolls and >>> > dicks: >> >> No, I wrote about trolls. "dicks" is a highly emotive and almost >> totally subjective word > > As opposed to "troll", which is unemotional and objective? Not. Not not. Please be careful of binary thinking. I did not say "troll" is unemotional and objective; I said it was much less so than "dick". It has a fairly specific meaning (see the wikipedia article for example.) >> that I would not use in a rational discussion. > > I would. If someone is acting like a dick, why not call them by the word > that most accurately describes their behaviour? Because (as I said) it is highly subjective and hence describes not their behavior but rather your opinion of their behavior. > I see nothing troll like in Dwight "call me David, but I can't be > bothered changing my signature" Hutto's behaviour. He doesn't seem to be > trolling, in either sense: he doesn't appear to be making provocative > statements for the purpose of making people think, nor does he seem to be > making inflammatory statements to get a rise out of people. He seems to > genuinely want to help people, in a clumsy, aggressive, and I believe > often intoxicated way. > > So it seems to me that you are wrongly applying the term "troll" as a > meaningless pejorative to anyone who behaves badly. Hardly meaningless. It seems to me there is a spectrum ranging from those who post for the pure enjoyment of starting an argument, through those who have a on-topic reason to post but have a lot of attitude, through those who usually keep their attitude under control but go off when provoked to those who really are clueless and have no idea that their attitude is offensive to anyone. This is further complicated by the fact that some offensive behaviors are offensive to some and not to others, and worse, some people are offended by any opinion they disagree with. Finally there are lots of people, some drive-by, some with lots of python knowledge and regulars here, who just enjoy arguing. That trait is not restricted to trolls. So regardless of the category of "troll", telling them to stop is more likely to result in a response ranging from a repetition of what they already said to "go screw yourself", followed by dozens of more responses telling them everything from "stop" to "you're an asshole". You are right that I lumped them all under the label "troll". I will do so through the rest of this post since I don't have any other good labels. >> Perhaps you were trying to be amusing? > > Certainly not. > >>>> >> The best advise is to ignore such posts and encourage others to do >>>> >> the same. > [...] >>> > How should somebody distinguish between "I am being shunned for >>> > acting like a dick", and "I have not received any responses because >>> > nobody has anything to add"? >> >> Because you sent them private email telling them that? > > My, what a ... unique ... concept of "ignore such posts" you have. What's so unique about it? I have seen such advice dozens of times including in this list. (Oh wait, I just read ahead. I'll respond below). > So far, this has been the best advice you have given so far. My opinion > is that there is a graduated response to dickish behaviour: > > * send a message telling the person they are acting unacceptably, > preferably privately on a first offence to avoid public shaming > (when possible -- lots of people aren't privately contactable > for many reasons other than that they are trolls); > > * if the behaviour continues, make a public comment condemning > that behaviour generally without engaging directly in a debate > or "tit-for-tat" argument with the person. That's great except that, * Many people feel compelled to make the same public comment * Tit-for-tat arguments usually do ensue. > And for those who value their own peace and quiet over the community > benefit: > > * block or killfile posts from that person so they don't > have to be seen, preferably publicly. * And all too often that is followed up with a public **plonk**. (I really don't care that you (generic) killfiled someone. I'm quite capable of deciding who to read on my own.) > When I killfile someone, I tend to make it expire after a month or three, > just in
Re: Aggressive language on python-list
On 10/17/2012 12:16 PM, Chris Angelico wrote:> On Thu, Oct 18, 2012 at 3:48 AM, rurpy wrote: >>On 10/16/2012 08:45 PM, Steven D'Aprano wrote: >>> Except that you've made a 180- >>> degree turn from your advice to "ignore" bad behaviour, but apparently >>> didn't notice that *sending private emails* is not by any definition >>> "ignoring". So apparently you don't actually agree with your own advice. >> >> Do you have Asberger's by any chance? Can you understand that >> I said "ignore" in the context of public discussions in this >> newsgroup/maillist? > > That's nothing to do with Asperger's. Ignoring something/someone does > not include sending a private message. What you may be trying to say > is that we should refrain from publicly responding to bad behaviour, > which is not the same thing. If you want to pull a Humpty Dumpty and > use "ignore" to mean "not respond to in public", then go ahead, I'm > not stopping you - but do please make it clear somewhere in your post. I thought (and think now) that it was quite clear in context that "ignore" was to be taken relative to what was being discussed -- responding in this list. Did you seriously think I meant you weren't supposed even read it? That you must not print it out and burn it in effigy? That you can't mention it to a friend as an example of something that pissed you off that day? That you can't write a blog entry about it? That you can't report it to law enforcement if you thought it was threatening? I see responding privately to the poster in exactly the same vein. Ignore it *on the list*. I hope that makes it clear enough? -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On Wednesday, October 17, 2012 1:20:15 PM UTC-6, rurpy wrote: > On 10/17/2012 12:16 PM, Chris Angelico wrote: >[...] > Ignore it *on the list*. Quick addendum: I wrote earlier (in some post in this thread I don't have time to dig up now) that the above possibly should not apply when one is the target of (a perceived) offensive post. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/17/2012 02:28 PM, Oscar Benjamin wrote:> On 17 October 2012 19:16, Chris Angelico wrote: >> On Thu, Oct 18, 2012 at 3:48 AM, wrote: >>>On 10/16/2012 08:45 PM, Steven D'Aprano wrote: Except that you've made a 180- degree turn from your advice to "ignore" bad behaviour, but apparently didn't notice that *sending private emails* is not by any definition "ignoring". So apparently you don't actually agree with your own advice. >>> >>> Do you have Asberger's by any chance? Can you understand that >>> I said "ignore" in the context of public discussions in this >>> newsgroup/maillist? >> >> That's nothing to do with Asperger's. Ignoring something/someone does >> not include sending a private message. What you may be trying to say >> is that we should refrain from publicly responding to bad behaviour, >> which is not the same thing. If you want to pull a Humpty Dumpty and >> use "ignore" to mean "not respond to in public", then go ahead, I'm >> not stopping you - but do please make it clear somewhere in your post. > > I would also assume that ignoring a post means not replying on or off list. Then I hope my reply to Chris clarified that for you as well. > Moreover, I think it's unfortunate for you to make this comment with > an irrelevant reference to Asperger's syndrome. I'll give you the > benefit of the doubt that you didn't mean it this way but the comment > is easily interpreted as being disparaging to people with Asperger's. Yes, on rereading that, I agree it was uncalled for and I retract it and apologize to any who may have been offended by it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Aggressive language on python-list
On 10/17/2012 05:39 PM, Ian Kelly wrote:> On Wed, Oct 17, 2012 at 5:17 PM, Steven D'Aprano wrote: >> Excuse me, I think that anybody who was offended by it needs to take a >> long, hard look at themselves. Would you be offended if Rurpy asked "Are >> you diabetic?" > > If the question were sincere, no. On the other hand, if it were a > rhetorical question with the implication that only diabetics could > possibly be so obtuse, then yes, it would be offensive. > > Instead of "diabetic", try inserting the word "black" or "female". > There's no shame in those either, yet I think that the offensiveness > of either of those words used in that context should be obvious. The question *was* sincere. Some people with Asberger's tend to take words and expressions too literally. I know because it it is a problem I often have. Nevertheless I should not have raised the issue in the newsgroup, especially when criticizing Steven for not just asking, but asserting, that someone else's writings were the products of excessive drug use. This list is not the place to ask or speculate about personal traits of posters; rather only on message contents. -- http://mail.python.org/mailman/listinfo/python-list
Re: python scripts for web
On 10/18/2012 04:02 AM, Zero Piraeus wrote:> On 18 October 2012 05:22, wrote: >>[...] > By the way: are you using Google Groups? It's just that I'm led to > understand that it's recently started to misbehave [more than it used > to], and your replies are addressed to both > and , > which is redundant. When you post from Google Groups you will sometimes see a checkbox above the edit window that is a cc to the python mailing list () which is checked by default. If you uncheck that, you'll stop the double posting. -- http://mail.python.org/mailman/listinfo/python-list
Re: Preventing crap email from google?
[I posted the following in another thread yesterday...] When you post from Google Groups you will sometimes see a checkbox above the edit window that is a cc to the python mailing list () which is checked by default. If you uncheck that, you'll stop the double posting. -- http://mail.python.org/mailman/listinfo/python-list
Re: Preventing crap email from google?
> On Fri, 19 Oct 2012 21:21:11 -0700 (PDT), ru...@yahoo.com declaimed the > following in gmane.comp.python.general: > >> [I posted the following in another thread yesterday...] >> >> When you post from Google Groups you will sometimes >> see a checkbox above the edit window that is a cc to >> the python mailing list () >> which is checked by default. >> >> If you uncheck that, you'll stop the double posting. > > That is different from the Google Groups double-spacing ">" quoted > material. Yes, I realized that right after I clicked send. However since it is also a common problem when posting from GG, maybe some other readers of this thread will find it useful. Re the specific problem mentioned, I just paste the original message into an emacs window, add the quote marks and paste back into the GG compose window. Another alternative is to use "paste as quotation" into a mail client compose window, and then paste back into GG. A small PITA but not a big deal if GG is otherwise convenient. But perhaps the same mentality that makes it just sooo hard to read a double spaced post (that one is willing to killfile a whole class of participants) is the same mentality that makes sooo hard to correct such posts to begin with. -- http://mail.python.org/mailman/listinfo/python-list
Re: Obnoxious postings from Google Groups
On 10/30/2012 11:07 PM, Robert Miles wrote:> On 9/16/2012 8:18 AM, Ben Finney wrote: >> Νικόλαος Κούρας writes: >> >>> Iam sorry i didnt do that on purpose and i dont know how this is done. >>> >>> Iam positng via google groups using chrome, thats all i know. >> >> It is becoming quite clear that some change has happened recently to >> Google Groups that makes posts coming from there rather more obnoxious >> than before. And there doesn't seem to be much its users can do except >> use something else. You (BF) are wrong that there "doesn't seem to be much its users can do..." and I explained why previously. However, since you have advocated killfiling anyone using GG (which I do) you probably didn't see my post. If you choose intentional ignorance that is your choice but you do a disservice to the community by advocating that others do the same. (Officer, I don't deserve this ticket because I couldn't see the traffic signal was red; I had my eyes closed. :-) > You're probably referring to their change in the way they handle > end-of-lines, which is now incompatible with most newsreaders, > especially with multiple levels of quoting. It's a minor pain to fix this when posting, but 1. It is fixable (and previous post of mine gave a couple ways) 2. The double spacing is obvious in Google's compose window so if one posts anyway, it is a matter of laziness. > The incompatibility tends to insert a blank line after every line. > With multiple levels of quoting, this gives blank line groups that > often roughly double in size for every level of quoting. > > Robert Miles -- http://mail.python.org/mailman/listinfo/python-list
Re: datetime issue
On 10/31/2012 09:11 AM, Grant Edwards wrote:> On 2012-09-16, ?? wrote: > >> Iam positng via google groups using chrome, thats all i know. > > Learn something else. Google Groups is seriously and permanently > broken, and all posts from Google Groups are filtered out and ignored > by many people (including myself -- I only saw this because somebody > else replied to it). "Broken"? Yes. But so is every piece of software in one way or another. Thunderbird is one of the most perpetually buggy pierces of software I have ever used on a continuing basis. "Seriously"? That's pretty subjective. I manage to use it without major problems so it couldn't be that bad. I posted previously on how to use it without the double posts or the double spacing. "Permenantly"? Your ability to foretell the future leaves me in awe. :-) Feel free to filter whatever you want but be aware than in doing so you risk missing information that could help you avoid disseminating erroneous info. Of course, carrying out some kind of private war against Google Groups may be more important to you than that... -- http://mail.python.org/mailman/listinfo/python-list
Re: datetime issue
On Wednesday, October 31, 2012 3:38:57 PM UTC-6, Mark Lawrence wrote: > On 31/10/2012 19:35, ru...@yahoo.com wrote: >> "Broken"? Yes. But so is every piece of software in one way >> or another. Thunderbird is one of the most perpetually buggy >> pierces of software I have ever used on a continuing basis > > Please provide evidence that Thunderbird is buggy. I use it quite > happily, don't have problems, and have never seen anybody complaining > about it. I hesitate to respond to this because thunderbird bugs are really OT, but since you insist... A few years ago started keeping a list TB problems I encountered. I stopped maintaining it a year or so ago. It is a mixture of bugs, misfeatures, and things I couldn't figure out, etc. Many have been fixed in later versions. Nevertheless, it illustrates *my* experience with TB. Note that despite the problems, I still use TB in some contexts. Different apps have different bugs/(mis)features and every person has their own weighting factors on those bugs. End result is different people prefer different apps for different purposes (and some of us find GG the least worst choice for posting here.) * In Search dialog clicked on the Search in folder dropdown after an earlier search and TB crashed (disappeared along with the new message I was editing.) [3.0.1] * Search for japanese text in body no longer works (never finds text even when it exists). [3.0.1] Used to work. * Each mail message displays useless header info that uses 25% of the available vertical space. * When editing a reply message, typing a return at eol results in two blank lines inserted. * When editing message, siometimes edit cursor disappears tho editing still seems to work normally. * Requires voodoo to create hmtl new message when default is plain text or visa versa. Have to hold shift key while clicking "write" button. Shift while choosing "new", "reply", etc in menu doesn't work. * Frequently, clinking on a usenet newsgroup results in TB freeze. Only solution is to remove group and re-add later. (Problem since 2.x days.) * Frequently after an apparently normal shutdown, attempt to restart results in "TB is already running" error. * Some folders in the folder tree view are greyed out and not selectable even though they have no visible different properties than selectable ones. Don't know how they got that way. * Clicking on a folder in the folder tree pane results in a pop- up dialog "this folder is not selectable" that has to be dismissed, even though one is trying to get it's properties, or is selecting it to create a subfolder. * Messages change from "read" to "unread" in folders at random when folder is accessed, or even when it is not accessed. [gone in 3.0.3?] * Interminttently, when I click a usenet message to view it, the contents pane remains blank. Contents of that message remain blank foreever. [new with 3.0.1]. * When TB main window closed while editing an email, can no longer save the email, even if the TB main window is reopened. * Counts of new messages in usenet groups are often wildly high. * When opening up a usenet server, status bar reports "no new messages on server" even though TB then updates the groups with the new messages that *are* on the server. [new in 3.0.1] * After upgrade to TB-3.0, opening a usenet server results not only in the group being scanned for new messages in each group (as before) but also the headers for all those new messages being downloaded (slow on a dialup connection and a waste of time if I don't intend to read anything in that group). No obvious way to revert to original behaviour. * Even tho the number of unread messages listed beside a usenet group in the folder pane is less than the download limit, I sometimes get pop-up asking how many messages to download, when I access the group. (side effect of above problem I think.) * Sometimes TB downloads two copies of each header. * When I compress folders, get a series of several dozen pop- up messages (each requiring a click on "OK") telling me that foplder "xx" is not selectable. * Copy-paste from TB to other app fails if TB is closed before the paste -- the paste buffer appears empty [TB-3.0b4] * Copy paste fails by removing text (forgot if it is just the copied text or other text) in the TB message when pasted somewhere else. [TB-2?] * After upgrade to TB-3.0x, i no longer see a way to create a new imap subfolder. Had to create it using MSOE. * After upgrade to TB-3.0x double clicking on attached .jpg image no longer opens it -- only option is to save and open outside of TB. phfft. * HTF do you change the font size for plain text message composition? Prefs has a setting for html but... * search of body for multiple "anded" text never ends if one of the search boxes is empty. * Search "stop" button doesn't stop search. * One group frequently, without any actio
Re: Obnoxious postings from Google Groups
On 11/01/2012 03:55 AM, Jamie Paul Griffin wrote: > Anybody serious about programming should be using a form of > UNIX/Linux if you ask me. It's inconceivable that these systems > should be avoided if you're serious about Software Engineering and > Computer Science, etc. For UNIX there are loads of decent news > reading software and mail user agents to learn and use. slrn is a > good one and point it at gmane.org as someone else pointed out. I > can't even imagine using a browser or Google Groups, etc. now. Are you saying that this group is only for "serious" programmers? "serious" is also a matter of opinion. I have some serious programmer friends who maintain, in complete sincerity, that serious programmers should not waste time on slow, script-kiddie languages like Python, but should be developing their skills with serious professional languages like Java, C#, etc. -- http://mail.python.org/mailman/listinfo/python-list
Re: datetime issue
On 11/01/2012 06:09 AM, Grant Edwards wrote:> On 2012-10-31, ru...@yahoo.com wrote: >> On 10/31/2012 09:11 AM, Grant Edwards wrote:> On 2012-09-16, ?? >> wrote: >>> Iam positng via google groups using chrome, thats all i know. >>> >>> Learn something else. Google Groups is seriously and permanently >>> broken, and all posts from Google Groups are filtered out and ignored >>> by many people (including myself -- I only saw this because somebody >>> else replied to it). >> >> Feel free to filter whatever you want but be aware than in >> doing so you risk missing information that could help you >> avoid disseminating erroneous info. Of course, carrying out >> some kind of private war against Google Groups may be more >> important to you than that... > > Based on past experience, the chances of useful information being > posted via Google Groups is very small. The benefit of avoiding all > the spam and garbage the comes from that source is more than worth the > small risk of missing something worthwhile. > > Note that I'm _not_ talking about people posting to the mailing list > using Gmail -- only people posting via the Google Groups web UI. Your experience is that most GG posts are junk but not most Gmail posts. And yet someone else posted that Gmail posts are the junk ones. So I wonder how accurate these evaluations are. In either case, while there has been some spam and garbage posts in c.l.p in the past, I haven't seen very many lately. And even in the past, they seemed pretty recognizable to me and easily skipped over. As for stupid questions, undesired formatting etc, I seldom look at the message headers so I never noticed whether they are mostly from GG or Gmail. But then again I never found it hard to glance at a post and move on if I didn't want to read it. YMMV. -- http://mail.python.org/mailman/listinfo/python-list
Re: Obnoxious postings from Google Groups
On 11/02/2012 03:36 AM, Jamie Paul Griffin wrote: > / ru...@yahoo.com wrote on Thu 1.Nov'12 at 15:08:26 -0700 / > >> On 11/01/2012 03:55 AM, Jamie Paul Griffin wrote: >>> Anybody serious about programming should be using a form of >>> UNIX/Linux if you ask me. It's inconceivable that these systems >>> should be avoided if you're serious about Software Engineering >>> and Computer Science, etc. For UNIX there are loads of decent >>> news reading software and mail user agents to learn and use. slrn >>> is a good one and point it at gmane.org as someone else pointed >>> out. I can't even imagine using a browser or Google Groups, etc. >>> now. > >> Are you saying that this group is only for "serious" programmers? > > I don't see where my comments suggested that this group is only for > serious programmers. I simply believe that the UNIX platform, in > whatever form, is better placed and designed for all sorts of > computing and engineering projects. The history of UNIX speaks for > itself. Many Universities that offer respected and credible science > based degree programmes, namely engineering and computing programmes, > strongly encourage students to become competent with UNIX systems. > Windows in my opinion is really for those who use the internet on a > casual basis or in a commercial environment where its staff are not > necessarily computer literate and therefore need a platform that they > can use which doesn't require them to learn more complex techniques > and protocols. But, having said that, I'm not against Windo ws at > all. I use it frequently and enjoy using it most of the time. Wow, that makes me feel like I am back in the 1990s! Thanks for the trip down memory lane. :-) >> "serious" is also a matter of opinion. I have some serious >> programmer friends who maintain, in complete sincerity, that >> serious programmers should not waste time on slow, script-kiddie >> languages like Python, but should be developing their skills with >> serious professional languages like Java, C#, etc. > > That is a narrow minded approach. different languages serve different > purposes and it's down to the developer to use which language she > needs to achieve what it is they've set out to do. Sometimes, basic > shell scripts can be extremely powerful for certain tasks; other > needs will require something different. I certainly wouldn't describe > Python as a "script-kiddie" language. It's extremely powerful and > modern. So there ;-P lol Right. I happen to agree with you and was just repeating an elitist attitude I've often heard where what *I* use is for *serious* business and what *they* use is just for playing around, for those without as much technical competence as me, etc. Without a quantitative definition of "serious" and some objective evidence supporting it, your opinion that unix is more "serious" than windows is as narrow-minded as my friends' opinion (which was the point I was trying to make and which you seem to have missed.) I don't particularly like Windows and am able to mostly avoid it these days, but think you should realize that describing it as not for *serious* use is going irritate some people and make you look like you are not able to make objective judgements. (I also hope I haven't just been suckered by a troll attempt, windows/unix is better then unix/windows being an age-old means of trolling.) -- http://mail.python.org/mailman/listinfo/python-list
Re: datetime issue
On 11/02/2012 03:57 AM, Jamie Paul Griffin wrote: > / ru...@yahoo.com wrote on Thu 1.Nov'12 at 15:00:48 -0700 / >> [...list of Thunderbird problems...] > > With a list of problems like that maybe the time spent on learning > how to use a Usenet client or mua that is properly written would be > worthwhile. And that would be which one exactly? I have tried a few other mail and usenet clients, and as I said, indeed the point of my post was, they *all* have their own set of bugs, misfeatures and missing features. > Personally I haven't used the Google Groups interface, > and most likely never will so I can't really comment on how it > performs or how nice it is to use but if you're happy with it that's > the main thing. But you can't deny that it does cause irritating > problems for other people trying to read information sent from it. I can and do deny that. I certainly acknowledge that GG contributes to such posts, but naive users of GG and readers who are too easily irritated are two other major contributing factors. -- http://mail.python.org/mailman/listinfo/python-list
Re: Obnoxious postings from Google Groups
On 11/04/2012 04:13 AM, Jamie Paul Griffin wrote: > / ru...@yahoo.com wrote on Fri 2.Nov'12 at 11:39:10 -0700 / > >> (I also hope I haven't just been suckered by a troll attempt, >> windows/unix is better then unix/windows being an age-old means of >> trolling.) > > No, i'm not a "troll". I was just adding my opinion to the thread, I > assumed that was allowed. I didn't say UNIX is better than Windows, > did I; I just feel that Windows is not -- for me anyway -- the most > suitable plaform for learning about the science of computing and > coding, etc... being a computer science student that's the view i > have and share with those I learn with and from. Why must people be > accused of trolling everytime they make a statement that conveys a > preference over one platform or language, for example, than the > other. Provoking someone by labeling them a troll or implying they > might be is a bit childish really. I deliberately worded my response to avoid calling you a troll but rather just suggested the possibility so a denial without all the indignation would be more appropriate. (And FWIW I agree that "troll" is often used here synonymously with "I disagree with you" but that is not how I used it.) You should realize that a good way to start an endless argument and one that has a long history of being used by trolls is to assert that OS/language/whatever is "better" than some other one in an environment where there are also lots of users of the other one. Substituting "serious" or any other value-laden, unsubstantiatable word for "better" is just a insignificant variation. -- http://mail.python.org/mailman/listinfo/python-list
Re: Proper place for everything
On 11/02/2012 04:12 PM, Steven D'Aprano wrote: > On Fri, 02 Nov 2012 11:51:29 -0700, Jason Benjamin wrote: > >> On another note, it appears that Google (the only archive I can find for >> this group) only has a little under 400 messages archived for this >> group, > > Google Groups is poison. If you post with it, you will be ignored by a > large percentage of the regulars here. >[...] > Bad options are: > > - Absolutely anything to do with Google Groups. It's a crap user- > interface, posts don't follow established standards for email and news, > and Google requires you to sign in just to read the archives, which in > my opinion is morally indefensible. Jason, You should also be aware that there are a number of people here such as myself that use Google Groups for various reasons and there is concurrently some discussion of this in other threads including the correction of just plain erroneous info about GG that has been propagated here. AFAIK, there is no real definition of "regular" nor any count of how many of them (whoever "them" is) that ignore GG. Pretty obviously "crap user interface" is in the eye of the beholder and the login requirement is a personal issue. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple Question regarding running .py program
On 11/13/2012 09:10 PM, Chris Angelico wrote: > On Wed, Nov 14, 2012 at 2:31 PM, Caroline Hou wrote: >> Thank you Dave and everybody here for your helpful comments!This >> place is awesome! I found this group when I googled python-list. >> Seems like this is not the usual way you guys access the list? > > There are several ways to communicate with this list. > [...] > * Use a news-to-web gateway such as Google Groups. That > specific one is deprecated on this list, as there's more > noise than signal from Google Groups. Caroline, Chris is mistaken about this, if for no other reason than there is no authority here empowered to decide to deprecate anything. What Chris should have said is that there are some people on this list who don't like Google Groups for whatever reason and encourage others to ignore posts from Google Groups. How successful this boycott effort is is not clear. I use Google Groups as it suits my needs better than any of the alternatives, and so do many others. Both of the other alternatives Chris mentioned involve too much setup or overhead for those who read/post here only occasionally. GG fills this niche adequately if used with care. If you do use Google Groups to post, there are a couple of things you should be careful of: * You'll sometimes see a checkbox above the GG send window that is a CC to the python mailing list () which is checked by default. Uncheck that before sending, or the list will get two copies of your message. * GG doesn't do a very good job in quoting the post you are replying to. If you look at your recent post here: http://mail.python.org/pipermail/python-list/2012-November/635070.html (or on GG) you will see lots and lots of lines empty save for the ">" quote markers. This makes a post hard to read. A way to avoid this is to remove the blank extra blank lines in the GG send window by hand before posting. Alternatively, many email programs have a "paste as quotation" option when writing mail. What I do is to open a blank new email message, copy the original post I'm replying to from GG, paste-as-quotation into the new mail window, then copy and paste back into the GG send window. Pretty easy to do once you get used to it. Hope this helps and provides a little more accurate info about posting from GG than has been provided so far. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple Question regarding running .py program
On 11/13/2012 11:02 PM, Chris Angelico wrote: > On Wed, Nov 14, 2012 at 4:08 PM, rurpy wrote: >> On 11/13/2012 09:10 PM, Chris Angelico wrote: >>> * Use a news-to-web gateway such as Google Groups. That >>> specific one is deprecated on this list, as there's more >>> noise than signal from Google Groups. >> >> Caroline, Chris is mistaken about this, if for no other >> reason than there is no authority here empowered to decide >> to deprecate anything. What Chris should have said is >> that there are some people on this list who don't like >> Google Groups for whatever reason and encourage others >> to ignore posts from Google Groups. >> >> How successful this boycott effort is is not clear. > > To be more accurate: This is deprecated *by members of* this list. As > there is no commanding/controlling entity here, it's up to each > individual to make a decision - for instance, abusive users get > killfiled rather than banned. The use of Google Groups to post is > deprecated in the original sense of the word: strongly disapproved of. s/deprecated *by members of*/deprecated *by some members of*/ (and accuracy could probably be increased further by replacing "some" with "a few".) And again, s/strongly disapproved of/strongly disapproved of by some/ I was objecting to your attempts to make it sound like a fact that GG posts were nearly universally condemned here, an error you repeat again above. > My own opinion on the matter is that if it takes as much effort as you > describe to use GG properly, it's wasting your time on a massive > scale. Surely it's easier to read and post email? "that much effort"? Do you consider a couple of copy- pastes to be "that much effort"? "wasting your time on a massive scale"? Sheesh, get a grip man, let's not get silly. On the other hand finding and configuring a newsreader for someone whose never done it before, as you recommend, is a major time consumer. And signing up for python-list email, posting, dealing with several days' volume, and then signing off because one does not want to read it full time[*], is no picnic either compared to using GG. Sorry, but there are *good* reasons for some people to use GG whether you want to admit it or not. == [*] Actually, now that I think about it, IIRC one can sign up for python-list email, and go into the mailman settings and disable mail delivery, allowing one to post to the list via email yet read the list via GG, Gmane or whatever. However, this is not going to be obvious to many occasional posters, and is still a PITA compared to just posting from GG as our hypothetical user does for all the other groups he/she participates in. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple Question regarding running .py program
On 11/14/2012 06:35 AM, Chris Angelico wrote: > On Wed, Nov 14, 2012 at 6:02 PM, rurpy wrote: >> On 11/13/2012 11:02 PM, Chris Angelico wrote: >>> To be more accurate: This is deprecated *by members of* this list. As >>> there is no commanding/controlling entity here, it's up to each >>> individual to make a decision - for instance, abusive users get >>> killfiled rather than banned. The use of Google Groups to post is >>> deprecated in the original sense of the word: strongly disapproved of. >> >> s/deprecated *by members of*/deprecated *by some members of*/ >> >> (and accuracy could probably be increased further by replacing >> "some" with "a few".) > > I stand by what I said. Members, plural, of this list. I didn't say > "all members of", ergo the word "some" is superfluous, yet not > needful, as Princess Ida put it. Then you would have no problem I suppose with "Australians are racists" because some Australians are racist and I didn't say "all"? I stand by what I said. Using the passive voice to give a false sense of authority, leaving out quantifiers when there are likely thousands of readers of this group perhaps a half dozen who've been vocal against GG, is not an accurate description. > In any case, the fact remains that a number of this list's best > responders have killfiled Google Groups posters as a whole. > Consequently, GG forces you to go to quite a bit of extra work AND > prevents your message from getting through to everyone. Why go to > extra work to get a worse result? As a user of GG, Usenet and email lists I claim you are wrong. GG does NOT require "quite a bit of extra work". If it did, I wouldn't use it. For occasional posters, GG is EASIER. (It would be even easier if Google would fix their execrable quoting behaviour but as I showed, it is easy to work around that.) I think you are ignoring setup time and a number of other secondary factors, things that are very significant to occasional posters, in your evaluation of "easy". As for "best", that is clearly a matter of opinion. The very fact that someone would killfile an entire class of poster based on a some others' posts reeks of intolerance and group-think. And since some of the anti-GG proponents are also among the most opinionated and argumentative participants here, their not reading GG posts could be seen as an advantage. As an aside, I've noticed that some those most vocal against GG have also been very vocal about this group being inclusive. If one observes that women post here (as a group) a lot less frequently then men, and if GG is easier for occasional posters, then the anti-GG attitude expressed here by a few would have the effect of disproportionately discriminating against women. > I am therefore not going to > recommend Google Groups to anyone as a means of posting to > python-list/c.l.p, That's fine. But when doing so please leave out the false metaphors... > any more than I would recommend writing it on a > Post-It note and feeding it into your floppy drive. ...such as posting here via GG is similar to feeding post-its into a floppy drive. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple Question regarding running .py program
On Wednesday, November 14, 2012 4:07:53 PM UTC-7, Steven D'Aprano wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: > [...] > > As an aside, I've noticed that some those most vocal against GG have > > also been very vocal about this group being inclusive. > > I call bullshit. If you are going to accuse people of being "very vocal" > against minorities, you damn well better have some evidence to back up > your claim. > > And if you don't, I would expect a public apology for that slur. I wasn't very clear. I should have written "...those most vocal against GG have also been very vocal *in favor* of this group being inclusive." In the next paragraph which you clipped I pointed out the irony of that attitude versus one possible effect of advocating the blacklisting of GG posters: > > If one observes that women post here (as a group) > > a lot less frequently then men, and if GG is easier > > for occasional posters, then the anti-GG attitude > > expressed here by a few would have the effect of > > disproportionately discriminating against women. Response to your other points will need to wait until I have more time. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple Question regarding running .py program
On 11/14/2012 04:07 PM, Steven D'Aprano wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: I'll skip the issues already addressed by Joshua Landau. >[...] > I don't understand why you suggest counting setup time for the > alternatives to Google Groups, but *don't* consider setup time for Google > Groups. You had to create a Google Account didn't you? You've either put > in your mobile phone number -- and screw those who don't have one -- or > you get badgered every time you sign in. You do sign in don't you? Yes I sign in. And I've never entered my mobile phone number and no I don't get badgered every time (I've not been asked when I logged in several times today and I just tried again to confirm.) I have been asked in the past and just ignore it -- click Save (or whatever the button is) with a blank text box. As was pointed out, a large number of people already have Google accounts. And creating an account at Google is not comparable to researching news readers, downloading and installing software, setting up an account, etc for someone who's never even heard of usenet before. Subscribing to email is easier but it has its own problems (all those email you don't care about, the time delay (I've had to wait over 24 hours for a response for some email lists), what to do when you're traveling, reading some groups via email but others by GG. I've also had problems trying to post through Gmane and then there were Gmane's accessibly problems a few months ago, fixed now but for how long? The OP had already found her way to GG and managed to post. So the incremental cost for her to *continue* using GG is very low. That's in comparision to *changing* to a new posting method. I'm not saying the Google is always easier than an alternative but for a significant number of people it is. But most importantly it is *their* place to say what is easier for them, not yours or mine. [...] > Even if you are right that Google Groups is easier for some users, in my > opinion it is easy in the same way as the Dark Side of the Force. > Quicker, faster, more seductive, but ultimately destructive. Well, that's the best example of FUD I've seen in this thread so far. Congratulations. ;-) >> As for "best", that is clearly a matter of opinion. The very fact that >> someone would killfile an entire class of poster based on a some others' >> posts reeks of intolerance and group-think. > > Intolerance? Yes. But group-think? You believe that people are merely > copying the group's prejudice against Google Groups. Please don't tell me what I believe, especially when you get it wrong. > I don't think they > are. I think that the dislike against GG is group consensus based on the > evidence of our own eyes, not a mere prejudice. The use of Google Groups > is, as far as I can tell, the single most effective predictor of badly > written, badly thought out, badly formatted posts, and a common source of > spam. Again you repeat Chris Angelo's mistake (if it's a mistake). "group's prejudice"? You've presented no evidence that "the group" as a whole or in large part (including many people who seldom if ever post) share your view. Same with "consensus". A consensus of whom? Are you saying there is a consensus among those who dislike GG posts that they dislike GG posts? You say the dislike is "not a mere prejudice" and yet I can't help but wonder where the hard evidence is. I've not seen it posted though I could have easily missed it. All the news/email tools I use make it a little work to see where a post came from -- usually they'll be a button somewhere or a menu item to show the headers and one will scan those for the source. While easy enough it is still (at least for me) much easier to simply skip a post based on the subject/poster or a quick peak at the contents. So I've never had any inclination to look and have no idea how many crap posts come from GG. Yet you claim that a large percentage of this group has made the effort to do that. (Or maybe there is an easier way to check?) However I can easily imagine how some could think they are checking... "Oh man, what a crap post! Let's check the headers. Yup, just as I thought, Google Groups." But of course, our genius doesn't keep any records and the cases where he is wrong don't make as much impression on his memory. Further, he doesn't bother to check the headers on the non-crap posts. Even a junior-high science student could see the problems with this methodology. And how many people actually do even that? Some may find it an offensive suggestion but there is such a
Re: python-daemon
On 12/16/2012 08:26 AM, n8fel...@gmail.com wrote: > Hello all. Got a question for anyone out there that is willing to > help. Looking to make a Python Daemon, Google searches lead me to > http://pypi.python.org/pypi/python-daemon. My question is 2 part. 1) > pip install python-daemon downloads version 1.6, but the site states > that 1.5.5 is the latest version. Anyone know why this is? 2) With > python-daemon having been last uploaded in 2010, is anyone aware if > there is a better implementation for python daemons, or is this still > considered current? The author of the python-daemon package I believe is Ben Finney, who sometimes posts here. Sadly, I think he is a member of a group of people here who say they filter out and ignore all messages posted from Google Groups (which would include yours and mine). If you get no other good answers here, you could try emailing him directly at ben+pyt...@benfinney.id.au, which is the address on a recent post from him. Or you could repost from other than GG if you don't mind being a tool of someone else's political agenda. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to make a basic Python score counter in a game... will not count.
> Hey guys, I'm working on a Python rock paper scissors (lizard spock) > game, and the beginning is complete. After I finished it, I thought, > "You know what? I think I can make this even better, and add a score > counter." And so I did. > > The problem is that it doesn't seem to actually keep track of score. > In fact it always keeps the score at 0 for both players. It's fully > functional otherwise, but it's bothering me that I can't get it to > work. > > Currently using Windows Python 32 bit v2.6.8 > > Download of the code here: > https://www.box.com/s/2lupxeyk5jvsxs0zkdfb > > Copy of the code here: > http://pastebin.com/MNdgiuSY If you are keeping the score in 'winx 'and 'winy' then you are adding one to the the values but not saving the results. I think you want winx = winx + 1 or more concisely, winx += 1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to make a basic Python score counter in a game... will not count.
On Sunday, December 16, 2012 10:09:53 AM UTC-7, Kwpolska wrote: >[...] > PS. please do not use pastebin.com. Why? -- http://mail.python.org/mailman/listinfo/python-list
Re: python-daemon
On Sunday, December 16, 2012 1:25:51 PM UTC-7, Chris Angelico wrote: >[...] > If your post is swallowed by someone's twit filter, that probably > means that you're doing something twittish. Switching to direct mail > isn't going to win you any friends :) Switching your newsgroup client, > however, will have all the same benefits; so do you want to be a tool > of the anti-Google-Groups propaganda, or of the > anti-anti-Google-Groups propaganda? The contents of a twit filter can be just as good an indication of a twit reader as a twit poster. And as was pointed out the last time this subject came up, no, other clients do not "have all the same benefits" [as GG]. Rather than continue this twit-for-twat noise I've tried to provide something a little more constructive at http://wiki.python.org/moin/GoogleGroupsPython -- http://mail.python.org/mailman/listinfo/python-list
Re: python-daemon
On 12/16/2012 11:16 PM, Chris Angelico wrote: > On Mon, Dec 17, 2012 at 9:18 AM, wrote: >> On Sunday, December 16, 2012 1:25:51 PM UTC-7, Chris Angelico wrote: >>>[...] >>> If your post is swallowed by someone's twit filter, that probably >>> means that you're doing something twittish. Switching to direct mail >>> isn't going to win you any friends :) Switching your newsgroup client, >>> however, will have all the same benefits; so do you want to be a tool >>> of the anti-Google-Groups propaganda, or of the >>> anti-anti-Google-Groups propaganda? >> >> The contents of a twit filter can be just as good an indication >> of a twit reader as a twit poster. >> >> And as was pointed out the last time this subject came up, no, >> other clients do not "have all the same benefits" [as GG]. >> >> Rather than continue this twit-for-twat noise I've tried to >> provide something a little more constructive at >> >> http://wiki.python.org/moin/GoogleGroupsPython > > All you've said is the exact same things that have already been said, > including that not everyone will see your post if you use Google > Groups. Why use something that unnecessarily restricts your audience, > when non-restrictive posting methods work just fine? I keep saying them because people like you keep saying (in effect) that there is no difference in clients (in terms of usability, convenience, setup effort and other factors that vary on a person-by-person basis.) I even wrote that above, right in the post you're replying to: >> no, other clients do not "have all the same benefits" and yet you respond that other "posting methods work just fine" Again, that may be true for you and your definition of "fine", and maybe even for many people but it is not true for everyone, As you say, all this has been said before and if you need to refresh your memory, please see the list archives, the thread, "Simple Question regarding running .py program" around nov 14. > Anyway. This debate isn't going away; I have no strong side in it, I'm > just informing people of the fact that posting from GG will reduce > your potential response sources. No, that's not what you were "just" informing people of... you were also informing us that we are "twits" for finding Google Groups fits our needs better than some other clients. -- http://mail.python.org/mailman/listinfo/python-list
Re: python-daemon
On Monday, December 17, 2012 12:33:52 AM UTC-7, Chris Angelico wrote: > On Mon, Dec 17, 2012 at 6:25 PM, wrote: > > No, that's not what you were "just" informing people of... > > you were also informing us that we are "twits" for finding > > Google Groups fits our needs better than some other clients. > > I didn't say that. The first twit filter I met was when my dad put > *his own* address into it, to avoid downloading the posts he'd sent > (on a modem, that was significant). And that was the most normal thing > to do, twitting yourself :) You wrote, >>> If your post is swallowed by someone's twit filter, that probably >>> means that you're doing something twittish. Perhaps in your part of the world, "twit" means something different than it means here, but here the meaning is pretty clear and quite derogatory. -- http://mail.python.org/mailman/listinfo/python-list
Re: where to view open() function's C implementation source code �
On Monday, December 17, 2012 10:35:58 PM UTC-7, Roy Smith wrote: > iMath wrote: > > where to view open() function's C implementation source code ï¼ > http://www.python.org/download/releases/ > Download the source for the version you're interested in. iMath: There is no need to download the source. You can browse the source code online. For the v3.0.0 version of open(): hg.python.org/cpython/file/bd8afb90ebf2/Modules/_io/_iomodule.c For 2.7.3 I think what you want is the builtin_open() function in http://hg.python.org/cpython/file/70274d53c1dd/Python/bltinmodule.c and the file object and open_the_file() function in http://hg.python.org/cpython/file/70274d53c1dd/Objects/fileobject.c Hope this helps. -- http://mail.python.org/mailman/listinfo/python-list
Re: where to view open() function's C implementation source code �
On Tuesday, December 18, 2012 1:57:37 PM UTC-7, ru...@yahoo.com wrote: >[...] > source code online. For the v3.0.0 version of open(): > hg.python.org/cpython/file/bd8afb90ebf2/Modules/_io/_iomodule.c oops, that should have been: http://hg.python.org/cpython/file/bd8afb90ebf2/Modules/_io/_iomodule.c -- http://mail.python.org/mailman/listinfo/python-list
Re: where to view open() function's C implementation source code �
On 12/18/2012 04:55 PM, iMath wrote: > > å¨ 2012å¹´12æ19æ¥ææä¸UTC+8ä¸å4æ¶57å37ç§ï¼ru...@yahoo.comåéï¼ > >[...] >> >> There is no need to download the source. You can browse the >> >> source code online. For the v3.0.0 version of open(): >> >> hg.python.org/cpython/file/bd8afb90ebf2/Modules/_io/_iomodule.c >> >> >> >> For 2.7.3 I think what you want is the builtin_open() function in >> >> http://hg.python.org/cpython/file/70274d53c1dd/Python/bltinmodule.c >> >> and the file object and open_the_file() function in >> >> http://hg.python.org/cpython/file/70274d53c1dd/Objects/fileobject.c >> >> >> >> Hope this helps. > > > > thanks very much ! Your welcome. I noticed that you, like me, are using Google Groups. You might want to read this page about posting from Google Groups: http://wiki.python.org/moin/GoogleGroupsPython It will help you avoid double posts and other Google Groups posting problems that annoy other people here. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to detect the encoding used for a specific text data ?
On Thursday, December 20, 2012 4:57:19 AM UTC-7, iMath wrote: > how to detect the encoding used for a specific text data ? The chardet package will probably do what you want: http://pypi.python.org/pypi/chardet -- http://mail.python.org/mailman/listinfo/python-list
Re: How to call wget by python ?
On Wednesday, January 9, 2013 7:11:34 PM UTC-7, iMath wrote: > can you give me an example code ? For running any system command from Python, you can use the subprocess module: http://docs.python.org/3/library/subprocess.html#module-subprocess To run "wget -p -k http://python.org"; from Python you could do something like this: import subprocess subprocess.call (['wget', '-p', '-k', 'http://python.org']) -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On 01/27/2013 02:04 AM, Ferrous Cranus wrote: >[...] > data = cur.fetchall() > for row in data: > print ( "" ) > > for item in row: > print( ''' href='http://www.%s?show=log'>%s ''' % (item, item) ) >[...] > Okey, so far BUT i want the url linking to happen only for the URL column's > value, and not for the hits column too. How do i apply the url link to the > URL column's value only? Ferrous, 'row' has two items (the url and the hit count) in it, right? So print each separately rather than in a loop: data = cur.fetchall() for row in data: url = row[0] hits = row[1] print ( "" ) print( " %s : % (url, hits) ) -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On 01/27/2013 11:44 AM, Κώστας Παπαδόπουλος wrote: > This is not correct. > the attribute is for url (row[0]) only, not for url and hits too. > > i want the following working code: > > = > data = cur.fetchall() > for row in data: > url = row[0] > hits = row[1] > print ( "" ) > print( " %s > " % (url, url) ) > print( " %s " % (hits) ) > = > > inside the loop i posted initially, if its possible. The easiest way is to separate them when you read 'row' data = cur.fetchall() for row in data: for url,hits in row: print ( "" ) print( " %s : % (url, hits) ) Note that sql query you used guaranties that each row will contain exactly two items so there is no point in using a loop to go through each row item as you would if you did not know how many items it contained. But if you insist on going through them item by item in a loop, then you need to figure out which item is which inside the loop. One way is like: data = cur.fetchall() for row in data: print ( "" ) item_position = 0 for item in row: if item_position == 0: print( " %s :" % (item[0], item[0])) if item_position == 1: print( " %s " % item[1] ) item_position += 1 There are many variations of that. You can simplify the above a little by getting rid of the "item_position=" lines and replacing "for item in row:" with "for item_position, item = enumerate (item):" But I think you can see the very first code example above is way more simple. By the way, it would be a lot easier to read your posts if you would snip out the extra blank lines that Google Groups adds. There are some suggestions in http://wiki.python.org/moin/GoogleGroupsPython -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On 01/27/2013 01:50 PM, Mitya Sirenef wrote: > On 01/27/2013 03:24 PM, Κώστας Παπαδόπουλος wrote: >> Τη Κυριακή, 27 Ιανουαρίου 2013 9:12:16 μ.μ. UTC+2, ο χρήστης >> ru...@yahoo.com έγραψε: > >> > > > > Yes indeed, there is no need to use a loop since i know the exact > number of items i'am expecting. Thanks you very much for clarifying this > to me: > > One last thing i want to ask you: > > > > > > try: > > cur.execute( '''SELECT host, userOS, browser, hits, lastvisit FROM > visitors > > WHERE counterID = (SELECT ID FROM counters WHERE URL = %s) ORDER BY > lastvisit DESC''', (htmlpage,) ) > > except MySQLdb.Error, e: > > print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2] ) > > else: > > data = cur.fetchall() > > > > for host, useros, browser, hits, lastvisit in data: > > print ( "" ) > > > > for item in host, useros, browser, hits, lastvisit.strftime('%A %e > %b, %H:%M').decode('cp1253').encode('utf8'): > > print ( " %s " % item ) > > > > sys.exit(0) > > === > > > > That would be also written as: > > > > for row in data: > > print ("tr>") > > for item in row: > > print( "blah blah blah" ) > > > > And that would make the code easier to read and more clear, but its > that 'lastvisit' column's value than needs formating,hence it makes me > use the above syntax. > > > > Is there any simpler way to write the above working code without the > need to specify all of the columns' names into the loop? > > > You can write: > > for row in data: > print ("tr>") > row = list(row) > row[-1] = row[-1].strftime(...) > for item in row: > print( "blah blah blah" ) Or alternatively, for row in data: print ("tr>") for item_num, item in enumerate (row): if item_num != len(row) - 1: print( "blah blah blah" ) else: print( item.strftime(...) ) Or, being a little clearer, LASTVISIT_POS = 4 for row in data: print ("tr>") for item_num, item in enumerate (row): if item_num != LASTVISIT_POS: print( "blah blah blah" ) else: print( item.strftime(...) ) -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-ideas] changing sys.stdout encoding
On 06/06/2012 10:09 AM, MRAB wrote: > On 06/06/2012 08:09, Rurpy wrote: >> On 06/05/2012 05:56 PM, MRAB wrote: >>> On 06/06/2012 00:34, Victor Stinner wrote: >>>> 2012/6/5 Rurpy: >>>>> In my first foray into Python3 I've encountered this problem: >>>>> I work in a multi-language environment. I've written a number >>>>> of tools, mostly command-line, that generate output on stdout. >>>>> Because these tools and their output are used by various people >>>>> in varying environments, the tools all have an --encoding option >>>>> to provide output that meets the needs and preferences of the >>>>> output's ultimate consumers. [snip] >>>>> In converting them to Python3, I found the best (if not very >>>>> pleasant) way to do this in Python3 was to put something like >>>>> this near the top of each tool[*1]: >>>>> >>>>> import codecs >>>>> sys.stdout = codecs.getwriter(opts.encoding)(sys.stdout.buffer) >>>> >>> In Python 3, you should use io.TextIOWrapper instead of >>> codecs.StreamWriter. It's more efficient and has less bugs. >>> > >>>> What I want to be able to put there instead is: > >>>> > >>>> sys.stdout.set_encoding (opts.encoding) [snip] >>> And if you _do_ want multiple encodings in a file, it's clearer to open >>> the file as binary and then explicitly encode to bytes and write _that_ >>> to the file. >> >> But is it really? >> >> The following is very simple and the level of python >> expertise required is minimal. It (would) works fine >> with redirection. One could substitute any other ordinary >> open (for write) text file for sys.stdout. >> >>[off the top of my head] >>text = 'This is %s text: 世界へ、こんにちは!' >>sys.stdout.set_encoding ('sjis') >>print (text % 'sjis') >>sys.stdout.set_encoding ('euc-jp') >>print (text % 'euc-jp') >>sys.stdout.set_encoding ('iso2022-jp') >>print (text % 'iso2022-jp') >> >> As for your suggestion, how do I reopen sys.stdout in >> binary mode? I don't need to do that often and don't >> know off the top of my head. (And it's too late for >> me to look it up.) And what happens to redirected output >> when I close and reopen the stream? I can open a regular >> filename instead. But remember to make the last two >> opens with "a" rather than "w". And don't forget the >> "\n" at the end of the text line. >> >> Could you show me an code example of your suggestion >> for comparison? >> >> Disclaimer: As I said before, I am not particularly >> advocating for a for a set_encoding() method -- my >> primary suggestion is a programatic way to change the >> sys.std* encodings prior to first use. Here I am just >> questioning the claim that a set_encoding() method >> would not be clearer than existing alternatives. >> > This example accesses the underlying binary output stream: > > > # -*- coding: utf-8 -*- > > import sys > > class Writer: > def __init__(self, output): > self.output = output > self.encoding = output.encoding > def write(self, string): > self.output.buffer.write(string.encode(self.encoding)) > def set_encoding(self, encoding): > self.output.buffer.flush() > self.encoding = encoding > > sys.stdout = Writer(sys.stdout) > > initial_encoding = sys.stdout.encoding > > text = 'This is %s text: 世界へ、こんにちは!' > sys.stdout.set_encoding('utf-8') > print (text % 'utf-8') > sys.stdout.set_encoding('sjis') > print (text % 'sjis') > sys.stdout.set_encoding('euc-jp') > print (text % 'euc-jp') > sys.stdout.set_encoding('iso2022-jp') > print (text % 'iso2022-jp') > > sys.stdout.set_encoding(initial_encoding) OK, let's see if I've got this right... You take a duplicate of my code, add a class with three methods and some other statements and you claim the result is clearer and simpler than my code? That is, union (A, B) is simpler than A? Interesting definition of simpler you've got there :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Hot to split string literals that will across two or more lines ?
You can leave out the "+" if you want, adjacent strings are automatically concatenated. print "a string which is very loo" \ "ong." Perhaps this is more efficient, since the string concatenation can be done by Python's parser rather than at runtime? Lars Kellogg-Stedman <[EMAIL PROTECTED]> wrote: > > > print "a string whcih is very very looo\ > > ng." > > > print "a string which is very loo" \ > + "ong." > > -- Lars -- Lars Kellogg-Stedman <[EMAIL PROTECTED]> This email address will expire on 2005-11-23. -- http://mail.python.org/mailman/listinfo/python-list
examining python objects
Is there a function/class/module/whatever I can use to look at objects? I want something that will print the object's value (if any) in pretty-printed form, and list all it's attributes and their values. And do all that recursively. I want to be able to find out everything about an object that Python can introspectively find out. Something like the 'x' command does in the Perl debugger. Anything like this exist? (And why isn't something like this already in pdb?) -- http://mail.python.org/mailman/listinfo/python-list
Re: examining python objects
__repr__ almost always only prints a summary of it's object, not the detailed internal structure that I want to see. When it prints values, that are not pretty-printed, nor are the objects that constitute the value printed recursively. Writing my own __repr__() is emphatically what I don't want to do! That is no better than debugging by inserting print statements, a technique from the 1980's. I am surprised (err, astounded actually) that a basic tool like this isn't available. Besides debugging, I would think it would be very helpful to people leaning python. Perhaps one of the Python IDEs contains something like this I could extract from it but I was hoping to shortcut what will be a time consuming search. Ben Finney wrote: > [EMAIL PROTECTED] wrote: > > Is there a function/class/module/whatever I can use to look at > > objects? > > The repr() function is what you want. > > > I want something that will print the object's value (if any) in > > pretty-printed form, and list all it's attributes and their values. > > And do all that recursively. > > The repr() function returns what the object's __repr__ method returns. > You'll notice that the builtin container types (string, set, list, > dict, ...) will show the values of their referred objects also. > > Define the __repr__ method on your classes so that they show whatever > information you think is useful for debugging. > > -- > \ "If you go flying back through time and you see somebody else | > `\ flying forward into the future, it's probably best to avoid eye | > _o__)contact." -- Jack Handey | > Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: examining python objects
"Chris Mellon" <[EMAIL PROTECTED]> wrote: On 18 Nov 2005 14:05:05 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > -- snip -- > > Writing my own __repr__() is emphatically what I don't > > want to do! That is no better than debugging by inserting > > print statements, a technique from the 1980's. > > It's still a good idea, though Yes and I often resort to it when I have no other choice. But it is often faster and more efficient to step through a section of problem code in pdb and look at variables. (And no I don't want to use a hevyweight or gui based ide.) > > I am surprised (err, astounded actually) that a basic > > tool like this isn't available. Besides debugging, I would > > think it would be very helpful to people leaning python. > > All of this functionality is intrinsically available within Python - > it's a dynamic language and you can easily inspect an object directly > to see what it looks like. Try (pretty) printing the objects __dict__ > or __slots__. Well, my reason for posting is that i've spent a couple days already trying to roll my own and it is not so easy. For one thing, my knowlage about all of the nitty gritty of the internals of objects is limited. A big part of my wanting this is to help me understand objects better. Does __dict__ and __slots__ give you all the attributes of an object? I thought new-style objects didn't even have a __dict__. I notice dir() does not list __dict__ as an attribute, even though it is one. You can see my understanding of these things is rather limited right now (due in no small part to Python's shitty docs.) While doing this is a educational, I am (supposed to be) working on something else I need to finish. I think it is more efficient to learn by looking at objects with a pre-written tool, then to spend a week or more trying to write it myself. And also, I also don't like taking days to duplicate something I'm sure has already been done numerous times. > > Perhaps one of the Python IDEs contains something > > like this I could extract from it but I was hoping to shortcut > > what will be a time consuming search. > > wxPython includes a graphical shell & namespace browser which you may > find useful. >-- snip -- I'll look for this but I'd rather find something I didn't have to hack. What a bummer, maybe I should be posting this to the "reinventing the wheel" thread. :-( -- http://mail.python.org/mailman/listinfo/python-list
Re: examining python objects
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > Is there a function/class/module/whatever I can use to > > look at objects? I want something that will print the object's > > value (if any) in pretty-printed form, and list all it's attributes > > and their values. And do all that recursively. > > I want to be able to find out everything about an object that > > Python can introspectively find out. > > Then check the inspect module I want a callable, ready-to-use class or function. Inspect provides soime funtions that would be useful for wrinting such a class or function, but does not provide one. I seems that nobody who has written or used such a tool reads this group, or feels like responding. FWIW, (for anyone looking for something similar in the future) I found http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/137951 which will format and print an object's attributes. By combining that and pprint in the Python distrib, I think can coble up what I am looking for. Still, it is discouraging that such a basic thing is not provided with python, or at lleast easily available in some library. -- http://mail.python.org/mailman/listinfo/python-list
Re: examining python objects
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > Is there a function/class/module/whatever I can use to > > look at objects? I want something that will print the object's > > value (if any) in pretty-printed form, and list all it's attributes > > and their values. And do all that recursively. > > I want to be able to find out everything about an object that > > Python can introspectively find out. > > Then check the inspect module I want a callable, ready-to-use class or function. Inspect provides soime funtions that would be useful for wrinting such a class or function, but does not provide one. I seems that nobody who has written or used such a tool reads this group, or feels like responding. FWIW, (for anyone looking for something similar in the future) I found http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/137951 which will format and print an object's attributes. By combining that and pprint in the Python distrib, I think can coble up what I am looking for. Still, it is discouraging that such a basic thing is not provided with python, or at lleast easily available in some library. -- http://mail.python.org/mailman/listinfo/python-list
Re: about list
Shi Mu wrote: > How to run a function to make [1,2,4] become [[1,2],1,4],[2,4]]? > Thanks! You want [[1,2],[1,4],[2,4]]? That is, all combinations of 2 items from the list? You might want to look at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 >>> import * from xpermutations >>> [x for x in UniqueCombinations ([1,2,4], 2)] [[1, 2], [1, 4], [2, 4]] That web page also gives urls to other recipies that do the same thing. -- http://mail.python.org/mailman/listinfo/python-list
Re: about sort and dictionary
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > so what would an entry-level Python programmer expect from this > > piece of code? > > > > for item in a.reverse(): > > print item > > for item in a.reverse(): > > print item > > > > I would expect it to first print a in reverse then a as it was. > > > > a=[1,2,3] > > > > I expect it to print > > > > 3 > > 2 > > 1 > > 1 > > 2 > > 3 > > > really? wouldn't > > 3 > 2 > 1 > 3 > 2 > 1 > > make a lot more sense ? I am not a complete newb at python, but I am still pretty new. I too thought immediately that the output should be 3,2,1, 1,2,3. I used reverse() and sort() a couple time and of course read the docs before I did. I noted they do the change inplace, and don't find rememering that to be a terrible burden. Actually, I get rather annoyed by the comment that they return None "as a reminder" that the change is inplace. How arrogant! While I'm sure the designers had kindly intentions. my memory, though bad, is not that bad, and I object to being forced to write code that is more clunky than need be, because the designers thought they needed to help me with my memory. -- http://mail.python.org/mailman/listinfo/python-list
Re: examining python objects
Colin J. Williams wrote: > [EMAIL PROTECTED] wrote: > > Bruno Desthuilliers wrote: > > > >>[EMAIL PROTECTED] a écrit : > >> > >>>Is there a function/class/module/whatever I can use to > >>>look at objects? I want something that will print the object's > >>>value (if any) in pretty-printed form, and list all it's attributes > >>>and their values. And do all that recursively. > >>>I want to be able to find out everything about an object that > >>>Python can introspectively find out. > >> > >>Then check the inspect module > > > > > > I want a callable, ready-to-use class or function. > > Inspect provides soime funtions that would be useful for wrinting > > such a class or function, but does not provide one. > > > > I seems that nobody who has written or used such a tool reads > > this group, or feels like responding. > > > > FWIW, (for anyone looking for something similar in the future) > > I found http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/137951 > > which will format and print an object's attributes. By combining that > > and pprint in the Python distrib, I think can coble up what I am > > looking > > for. > > > > Still, it is discouraging that such a basic thing is not provided with > > python, or at lleast easily available in some library. > > > In the interactive mode, you might try >> help(object) I want all the information about the object I can get through introspection. help() give some (a lot more than I realized, so thanks) but not everything. -- http://mail.python.org/mailman/listinfo/python-list
Re: about sort and dictionary
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 22 Nov 2005 08:53:07 -0800, rurpy wrote: > > > I am not a complete newb at python, but I am still pretty new. > > I too thought immediately that the output should be 3,2,1, 1,2,3. > > What you are saying is that a.reverse() should *both* change a in place > *and* return a reference to the same list. Yes. I don't see a problem with this. > > I used reverse() and sort() a couple time and of course read > > the docs before I did. I noted they do the change inplace, and > > don't find rememering that to be a terrible burden. Actually, I > > get rather annoyed by the comment that they return None "as > > a reminder" that the change is inplace. How arrogant! While > > I'm sure the designers had kindly intentions. my memory, though > > bad, is not that bad, and I object to being forced to write code > > that is more clunky than need be, because the designers thought > > they needed to help me with my memory. > > Built-in methods with side-effects (sort, reverse, update, clear, etc.) > return None because every function must return something, not because it > is a reminder. Python is not Pascal, and there are no procedures. Quoting directly from the Library Reference: "To remind you that they operate by side effect, they don't return the sorted or reversed list." > There are four possibilities for a construction like list.sort(): > > (1) sort the list in place and return a reference to the same list; > (2) sort the list in place and return a copy of the same list; > (3) sort the list in place and return None; > (4) don't sort in place and return a sorted list. > > No solution is always right, no solution is always wrong, but the most > flexible is a combination of (3) and (4). Python now has that with sort() > and sorted(). Prior to the addition of sorted() to the language, (3) was > considered the best solution because of a simple Python principle: never > duplicate objects unless explicitly told to. #2 makes no sense. I see the primary difference as inplace or copy sort, and the return value as a secondary issue: (1) Leave orignal list alone and sort a copy. Obviously this has to return a reference to that copy. (2) Sort list in place and... (2a) Don't return anything (i.e. return None) (2b) Return a reference to the list. (2b) is clearly the most flexible (of the inplace options) because it subsumes option (2a) -- if is you don't want to use the returned refernce for stylistic reasons, then don't. I think this is just another (admittedly minor) case of Python's designers using Python to enforce some idea of programming style purity. -- http://mail.python.org/mailman/listinfo/python-list