Re: Version Control Software
On Sat, Jun 15, 2013 at 3:39 PM, Tim Delaney timothy.c.dela...@gmail.com wrote: I can absolutely confirm how much ClearCase slows things down. I completely refused to use dynamic views for several reasons - #1 being that if you lost your network connection you couldn't work at all... And that right there is why modern source control systems are distributed, not centralized. It's so much easier with git; we lost our central hub at one point, and another dev and I simply pulled from each other for a bit until we got a new Scaphio online. With centralized version control, that would have basically meant a complete outage until the new box was up. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory usage steadily going up while pickling objects
Giorgos Tzampanakis wrote: I have a program that saves lots (about 800k) objects into a shelve database (I'm using sqlite3dbm for this since all the default python dbm packages seem to be unreliable and effectively unusable, but this is another discussion). The process takes about 10-15 minutes. During that time I see memory usage steadily rising, sometimes resulting in a MemoryError. Now, there is a chance that my code is keeping unneeded references to the stored objects, but I have debugged it thoroughly and haven't found any. So I'm beginning to suspect that the pickle module might be keeping an internal cache of objects being pickled. Is this true? Pickler/Unpickler objects use a cache to maintain object identity, but at least shelve in the standard library uses a new Pickler/Unpickler for each set/get operation. I don't have sqlite3dbm, but you can try the following: import shelve class A: pass ... a = A() s = shelve.open(tmp.shelve) s[x] = s[y] = a s[x] is s[y] False If you are getting True there must be a cache. One way to enable a cache yourself is writeback: s = shelve.open(tmp.shelve, writeback=True) s[x] = s[y] = a s[x] is s[y] True You didn't do that, I guess? -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On Fri, 14 Jun 2013 16:58:20 +0300, Nick the Gr33k wrote: On 14/6/2013 1:14 μμ, Cameron Simpson wrote: Normally a character in a b'...' item represents the byte value matching the character's Unicode ordinal value. The only thing that i didn't understood is this line. First please tell me what is a byte value Seriously? You don't understand the term byte? And you're the support desk for a webhosting company? -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Fri, 14 Jun 2013 12:32:56 +0300, Nick the Gr33k wrote: I'mm not trolling man, i just have hard time understanding why numbers acts as strings. It depends on the context. -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie: The philosophy behind list indexes
Chris Rebert wrote: On Jun 14, 2013 10:26 PM, ian.l.came...@gmail.com wrote: What is the thinking behind stopping 'one short' when slicing or iterating through lists? I find Dijkstra's explanation rather convincing: http://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831.html This is the only case where I prefer the pdf ;) http://www.cs.utexas.edu/~EWD/ewd08xx/EWD831.PDF -- http://mail.python.org/mailman/listinfo/python-list
Re: Wrong website loaded when other requested
On 14/6/2013 9:45 μμ, Mark Lawrence wrote: On 14/06/2013 17:46, Mark Lawrence wrote: Sure, just give me your password. He actually offered to do just this!!! How stupid can you get? I'm so fed up with his behaviour that I've emailed the Greek Embassy in London pointing out what he's up to. I've requested that someone looks at his activities and decides whether or not Greek law has been broken by him risking his clients' data. So Ferrous Cranus, if you feel the weight of the law landing on your shoulders, please *DON'T* blame me, just look in the mirror and you'll find the real culprit. i did not offer you my password for real. I said that if you state here in the list in front of all that you will actually try to solve whats wrong with files.py then i will you the password, which i knew you wouldn't state such a thing. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging memory leaks
Chris Angelico ros...@gmail.com writes: ... It's terrible advice in generality, because it encourages a sloppiness of thinking: Memory usage doesn't matter, we'll just instruct people to reset everything now and then. Memory usage may matter. But if you loose 1 kb a day, your process can run 3 years before you have lost 1 MB. Compare this to the 485 MB used when you start firefox. The situation looks different when you loose 10 MB a day. -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On Saturday, 15 June 2013 02:09:20 UTC+10, Steven D'Aprano wrote: To everyone else... I know that Nikos' posts are draining. Sometimes he brings me to the brink of despair too. But if you aren't part of the solution, you are part of the problem: writing short-tempered, insulting posts after short-tempered, insulting post doesn't teach him, it just adds to EVERYBODY'S frustration with this never-ending serious of threads. What about our frustration that this thread has become so overwhelmingly his support group? It's not like there isn't a list where he could post absolute beginner questions: http://mail.python.org/mailman/listinfo/tutor Although I'm pretty sure their first response would be read the docs / play with the interpreter, neither of which he's shown any desire to do. Please keep the snarky comments offlist. Tried that. He posts them back here. Alternatively, I'd ask that if you're so willing to deal with him, that the *two of you* take this show offlist instead? I'm genuinely curious as to whether he'd agree to this: given his propensity for changing his mail headers so regularly, the whole thing still screams performance troll. (I mean, seriously, how many days elapsed between his being burned by Chris Angelo and him offering to give you access to his server? Isn't refusing to budge from a position the defining characteristic of a ferrous cranus?) -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On 15/6/2013 9:50 πμ, alex23 wrote: Please keep the snarky comments offlist. Tried that. He posts them back here. Alternatively, I'd ask that if you're so willing to deal with him, that the *two of you* take this show offlist instead? I'm genuinely curious as to whether he'd agree to this: given his propensity for changing his mail headers so regularly, the whole thing still screams performance troll. (I mean, seriously, how many days elapsed between his being burned by Chris Angelo and him offering to give you access to his server? Isn't refusing to budge from a position the defining characteristic of a ferrous cranus?) I called my self 'Ferrous Cranus'(this is what a guy from a forum initially called me for being hard-headed :-) ) because i'm indeed hardheaded and if i believe that 1 thing should have worked in some way i cant change my mind easily that it works in another fashon(only if the counter-arguments are strong). Being strong-headed != acting as a troll About the changing of NNTP hosts. (well Google Groups gave me and you issues with its constant adding of '\n' between lines. I was given many complains about that so as Chris suggested i ditched Google Groups and try to find out how i can use TB instead. As for the mail, i decided since my questions concern python and my website to change the gmail address to support@ which is more relevant. I have also correct each time my spelling before i post. Now as for you, you should be thankful for Steven and Cameron answers to this groups because answering my questions. 1. help me 2. help others, which afraid to ask, in the propensity of being laughed upon 3. help other groups members like Michale Torrie whose admitted that some of the explanation was useful to him and he didn't knew that Boolean expressions can return string values instead of True or False. 3. help you, because you are being educated yourself too, because i sincerely doubt if you knew anything i i have asked. So, stop complaining and try to be helpful here or just mute my thread as Chris suggested as a working solution opposed to kill filing. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie: The philosophy behind list indexes
On Friday, June 14, 2013 10:21:28 PM UTC-7, ian.l@gmail.com wrote: I'm sure there's a good reason, but I'm worried it will result in a lot of 'one-off' errors for me, so I need to get my head around the philosophy of this behaviour, and where else it is observed (or not observed.) My understanding is that it's so the same index can be used in slicing a list into complementary parts. This also makes concatenation the inverse operation of slicing: Python 3.3.1 (default, Apr 17 2013, 22:30:32) [GCC 4.7.3] on linux Type help, copyright, credits or license for more information. a = list(range(10)) a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] a[:7] [0, 1, 2, 3, 4, 5, 6] a[7:] [7, 8, 9] a[:7] + a[7:] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] It's a logical extension of the start-indexing-at-zero issue, when you think about it. Yes, you will make the occasional off-by-one error at first. You'll get over it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging memory leaks
On Sat, Jun 15, 2013 at 4:52 PM, dieter die...@handshake.de wrote: Chris Angelico ros...@gmail.com writes: ... It's terrible advice in generality, because it encourages a sloppiness of thinking: Memory usage doesn't matter, we'll just instruct people to reset everything now and then. Memory usage may matter. But if you loose 1 kb a day, your process can run 3 years before you have lost 1 MB. Compare this to the 485 MB used when you start firefox. The situation looks different when you loose 10 MB a day. Right. Everything needs to be scaled. Everything needs to be in perspective. Losing 1 kilobit per day is indeed trivial; even losing one kilobyte per day, which is what I assume you meant :), isn't significant. But it's not usually per day, it's per leaking action. Suppose your web browser leaks 1024 usable bytes of RAM every HTTP request. Do you know how much that'll waste per day? CAN you know? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie: The philosophy behind list indexes
On 15/06/13 07:21, ian.l.came...@gmail.com wrote: I bet this is asked quite frequently, however after quite a few hours searching I haven't found an answer. What is the thinking behind stopping 'one short' when slicing or iterating through lists? By example; a=[0,1,2,3,4,5,6] a [0, 1, 2, 3, 4, 5, 6] a[2:5] [2, 3, 4] To my mind, it makes more sense to go to 5. I'm sure there's a good reason, but I'm worried it will result in a lot of 'one-off' errors for me, so I need to get my head around the philosophy of this behaviour, and where else it is observed (or not observed.) I think it simplify some arithmetic. How many element contain a[2:5]? Answer 5-2=3. And a[:5] contain the first 5 elements. Olive -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On Sat, 15 Jun 2013 10:04:41 +0300, Nick the Gr33k wrote: I called my self 'Ferrous Cranus'(this is what a guy from a forum initially called me for being hard-headed :-) ) because i'm indeed hardheaded and if i believe that 1 thing should have worked in some way i cant change my mind easily that it works in another fashon(only if the counter-arguments are strong). Then you need to stop trying to write python code, because you refuse to accept how python works, and python is not going to change for you! -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On 14/6/2013 7:42 μμ, Nobody wrote: Python implements these operators by returning the actual value which determined the result of the expression rather than simply True or False. which in turn the actual value being returned is a truthy or a falsey. That cleared the mystery in my head entirely. I wouldn't have asked so many follow-up questions in the thread if i received that kind of a response. Thank you very much for this response. If the result is known after evaluating the first argument, the first argument is returned. If it has to evaluate the second argument, the second argument is returned (by that point it has already forgotten the value of the first argument). So, the less it has to calculate to determine the correct result of an expression the better. Thanks again very much. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On 15/6/2013 10:49 πμ, Denis McMahon wrote: On Sat, 15 Jun 2013 10:04:41 +0300, Nick the Gr33k wrote: I called my self 'Ferrous Cranus'(this is what a guy from a forum initially called me for being hard-headed :-) ) because i'm indeed hardheaded and if i believe that 1 thing should have worked in some way i cant change my mind easily that it works in another fashon(only if the counter-arguments are strong). Then you need to stop trying to write python code, because you refuse to accept how python works, and python is not going to change for you! Given the right counter-arguments one can't make a stand against something that is without no doubt True. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On 15/6/2013 3:14 πμ, Cameron Simpson wrote: On 14Jun2013 12:50, Nikos as SuperHost Support supp...@superhost.gr wrote: | I started another thread because the last one was !@#$'ed up by | irrelevant replies and was difficult to jeep track. | | name=abcd | month=efgh | year=ijkl | | print(name or month or year) | abcd | | Can understand that, it takes the first string out of the 3 strings | that has a truthy value. | | print(k in (name and month and year)) | True | | No clue. since the expression in parenthesis returns 'abcd' how can | 'k' contained within 'abcd' ? Did you print the result of name and month and year? It is the _last_ value (if true at all). You used or in the first example and and in the second. okey, lets see it again: print (name or month or year) abcd Yes, 'k' isn't contained in the result string 'abcd' print (name and month and year) hijk print( k in (name and month and year) ) True Yes they work as expected, i was mistaken, sorry. | print(name and month and year) | ijkl | | Seems here is returning the last string out of 3 strings, but have | no clue why Python doing this. To evaluate an and it must test all of them to be true, and it keeps the last value tested. (Or False, of course, if they are not all true, in which case Python stops testing at the first False). Yes, i know it behaves like that, the question is why: As Nobody explained to me, the reason is that Python expressions results back the argument that determined the evaluation of the Boolean expression, which in turn can be a truthy or a falsey used in 'or' or 'and' respectively. Returning a truthy value equals True returning a falsey value equals False so it all boils down to the Booleans type of values True or False. But for what you are doing, and and or are not good operations. Something like: k in (name+month+year) or k in name or k in month or k in year Used to wrote it myself like the latter but needed a more compact way of writing it for clarity so i used the former. but those 2 gives the same results back k in (name+month+year) == k in (name and month and year) True so both seem to work as expected. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: A certainl part of an if() structure never gets executed.
On 15/6/2013 8:27 πμ, Larry Hudson wrote: On 06/14/2013 09:56 AM, Nick the Gr33k wrote: On 14/6/2013 7:31 μμ, Steven D'Aprano wrote: On Fri, 14 Jun 2013 16:07:56 +0300, Nick the Gr33k wrote: Returning True is the same thing as returning a variable's truthy value? NO! 'True' and 'False' are the two values of the boolean type. The 'and' and 'or' logical operators do NOT return a boolean type of True or False. Indeed. print( name and month and year ) hijk print( bool( name and month and year ) ) True print( name or month or year ) abcd print( bool( name or month or year ) ) True Also they do NOT return a variable's truthy value, they return the variable itself. No, as seen from my above examples, what is returned after the expr eval are the actual variables' values, which in turn are truthy, *not* the variable itself. Now, that returned variable can then be interpreted as a boolean value for other operations in the same way that (virtually) all data types can be interpreted as a boolean. Let me emphasize... they are INTERPRETED as having a boolean VALUE, but they are NOT a boolean TYPE. Yes the returned value of 'hijk' is being interpreted as bool('hijk'), which boils down as truthy. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the help-vampire
On Fri, Jun 14, 2013 at 6:09 AM, rusi rustompm...@gmail.com wrote: Since identifying a disease by the right name is key to finding a cure: Nikos is not trolling or spamming; he is help-vampiring. I think he's a very dedicated troll elaborately disguised as a help vampire. Remember that one of the names he previously used to post to this list was Ferrous Cranus. http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
: On 14 June 2013 08:50, Nick the Gr33k supp...@superhost.gr wrote: So, if i had no interest of actually learning python i would just cut n' paste provided code without worrying what it actually does, since knowing that came form you would be enough to know that works. Worrying what it actually does is good; an inquiring mind is a prerequisite for becoming a good programmer. Another prerequisite is discipline. That means the discipline to try and work out for yourself what's going on, rather than repeatedly spamming this list with trivial enquiries. It also means the discipline to both read and type carefully: until and unless you learn to take more care in how you express yourself, both in code and in prose, you will be plagued by syntax errors and frustrated responses respectively. I have only skimmed it, but you might find the following tutorial helpful: http://learnpythonthehardway.org/ Many of the early exercises may seem too basic, and you'll be tempted to skip them - given your conduct here, I imagine you'll be *strongly* tempted to skip them. Don't. You need to learn discipline. -[]z. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 2013-06-15 03:09, Cameron Simpson wrote: On 15Jun2013 10:42, Ben Finney ben+pyt...@benfinney.id.au wrote: | D'Arcy J.M. Cain da...@druid.net writes: | Even for those who do participate by email, though, your approach is | broken: | My answer is simple. Get a proper email system that filters out | duplicates. | | The message sent to the individual typically arrives earlier (since it | is sent straight from you to the individual), and the message on the | forum arrives later (since it typically requires more processing). | | But since we're participating in the discussion on the forum and not in | individual email, it is the later one we want, and the earlier one | should be deleted. They're the same message! (Delivered twice.) Replying to either is equivalent. So broadly I don't care which gets deleted; it works regardless. | So at the point the first message arrives, it isn't a duplicate. The | mail program will show it anyway, because “remove duplicates” can't | catch it when there's no duplicate yet. But it can when the second one arrives. This is true regardless of the delivery order. Ben said that he doesn't use email for this list. Neither do I. We use one of the newsgroup mirrors. If you Cc us, we will get a reply on the newsgroup (where we want it) and a reply in our email (where we don't). The two systems cannot talk to each other to delete the other message. | You do this by using your mail client's “reply to list” function, which | uses the RFC 3696 information in every mailing list message. No need, but a valid option. | Is there any mail client which doesn't have this function? If so, use | your vendor's bug reporting system to request this feature as standard, | and/or switch to a better mail client until they fix that. Sorry, I could have sworn you said you weren't using a mail client for this... He's suggesting that *you* who are using a mail reader to use the reply to list functionality or request it if it is not present. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Pattern Search Regular Expression
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. If any one of the esteemed members can help. Thanking you in Advance, Regards, Subhabrata -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory usage steadily going up while pickling objects
On 2013-06-15, Peter Otten wrote: Giorgos Tzampanakis wrote: I have a program that saves lots (about 800k) objects into a shelve database (I'm using sqlite3dbm for this since all the default python dbm packages seem to be unreliable and effectively unusable, but this is another discussion). The process takes about 10-15 minutes. During that time I see memory usage steadily rising, sometimes resulting in a MemoryError. Now, there is a chance that my code is keeping unneeded references to the stored objects, but I have debugged it thoroughly and haven't found any. So I'm beginning to suspect that the pickle module might be keeping an internal cache of objects being pickled. Is this true? Pickler/Unpickler objects use a cache to maintain object identity, but at least shelve in the standard library uses a new Pickler/Unpickler for each set/get operation. I don't have sqlite3dbm, but you can try the following: import shelve class A: pass ... a = A() s = shelve.open(tmp.shelve) s[x] = s[y] = a s[x] is s[y] False This returns False in my case. If you are getting True there must be a cache. One way to enable a cache yourself is writeback: No, I haven't enabled writeback. -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
Nick the Gr33k supp...@superhost.gr writes: On 15/6/2013 3:14 πμ, Cameron Simpson wrote: But for what you are doing, and and or are not good operations. Something like: k in (name+month+year) or k in name or k in month or k in year Used to wrote it myself like the latter but needed a more compact way of writing it for clarity so i used the former. but those 2 gives the same results back k in (name+month+year) == k in (name and month and year) True so both seem to work as expected. That happens only by chance: it seems you now understand the evaluation of boolean expressions in Python, so the following should be clear to you: k in (there + is + a + k + character + somewhere) True k in (there and is and a and k and character and somewhere) False ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory usage steadily going up while pickling objects
On 2013-06-15, Dave Angel wrote: On 06/14/2013 07:04 PM, Giorgos Tzampanakis wrote: I have a program that saves lots (about 800k) objects into a shelve database (I'm using sqlite3dbm for this since all the default python dbm packages seem to be unreliable and effectively unusable, but this is another discussion). The process takes about 10-15 minutes. During that time I see memory usage steadily rising, sometimes resulting in a MemoryError. Now, there is a chance that my code is keeping unneeded references to the stored objects, but I have debugged it thoroughly and haven't found any. So I'm beginning to suspect that the pickle module might be keeping an internal cache of objects being pickled. Is this true? You can learn quite a bit by using the sys.getrefcount() function. If you think a variable has only one reference (if it had none, it'd be very hard to test), and you call sys.getrefcount(), you can check if your assumption is right. Note that if the object is part of a complex object, there may be several mutual references, so the count may be more than you expect. But you can still check the count before and after calling the pickle stuff, and see if it has increased. Note that even if it has not, that doesn't prove you don't have a problem. Could the problem be the sqlite stuff? Can you disable that part of the logic, and see whether just creating the data still produces the leak? I tried both with the standard shelve and with sqlite3dbm and sys.getrefcount() of the stored object (and any of the objects it references) does not seem to go up after it's stored... I also tried closing the shelve after storing each object and re-opening it right away with the n flag (which instructs it to start with a new, empty database) and the memory still rises with the same rate. So it seems that the pickle module does keep some internal cache or something like that. I don't want to resort to reading the pickle source code, but it seems I will have to... -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A certainl part of an if() structure never gets executed.
Nick the Gr33k supp...@superhost.gr writes: On 15/6/2013 8:27 πμ, Larry Hudson wrote: Also they do NOT return a variable's truthy value, they return the variable itself. No, as seen from my above examples, what is returned after the expr eval are the actual variables' values, which in turn are truthy, *not* the variable itself. In the context we are talking about, the variable itself has the very same meaning as the actual variable value: mylist = ['foo'] emptylist = [] result = emptylist or mylist result.append('bar') result is mylist True print(mylist) ['foo', 'bar'] ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Sat, 15 Jun 2013 02:42:55 -0700, subhabangalore 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. No need for a regular expression. py sentence = By the new group py words = sentence.split() py words[1:-1] ['the', 'new'] Does that help? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory usage steadily going up while pickling objects
Giorgos Tzampanakis wrote: So it seems that the pickle module does keep some internal cache or something like that. I don't think there's a global cache. The Pickler/Unpickler has a per- instance cache (the memo dict) that you can clear with the clear_memo() method, but that doesn't matter here. I don't want to resort to reading the pickle source code, but it seems I will have to... I'd look somewhere else... -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On 15/06/2013 10:42, 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. If any one of the esteemed members can help. Thanking you in Advance, Regards, Subhabrata I tend to reach for string methods rather than an RE so will something like this suit you? c:\Users\Mark\MyPythontype a.py for s in (In the ocean, On the ocean, By the ocean, In this group, In this group, By the new group): print(' '.join(s.split()[1:-1])) c:\Users\Mark\MyPythona the the the this this the new -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Sat, 15 Jun 2013 10:05:01 +, Steven D'Aprano wrote: On Sat, 15 Jun 2013 02:42:55 -0700, subhabangalore 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. No need for a regular expression. py sentence = By the new group py words = sentence.split() py words[1:-1] ['the', 'new'] Does that help? I thought OP wanted: words[words[0],words[-1]] But that might be just my caffeine deprived misinterpretation of his terminology. -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On 15/06/2013 11:24, Denis McMahon wrote: On Sat, 15 Jun 2013 10:05:01 +, Steven D'Aprano wrote: On Sat, 15 Jun 2013 02:42:55 -0700, subhabangalore 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. No need for a regular expression. py sentence = By the new group py words = sentence.split() py words[1:-1] ['the', 'new'] Does that help? I thought OP wanted: words[words[0],words[-1]] But that might be just my caffeine deprived misinterpretation of his terminology. sentence = By the new group words = sentence.split() words[words[0],words[-1]] Traceback (most recent call last): File stdin, line 1, in module TypeError: list indices must be integers, not tuple So why would the OP want a TypeError? Or has caffeine deprivation affected your typing skills? :) -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory usage steadily going up while pickling objects
On 2013-06-15, Peter Otten wrote: Giorgos Tzampanakis wrote: So it seems that the pickle module does keep some internal cache or something like that. I don't think there's a global cache. The Pickler/Unpickler has a per- instance cache (the memo dict) that you can clear with the clear_memo() method, but that doesn't matter here. I don't want to resort to reading the pickle source code, but it seems I will have to... I'd look somewhere else... Indeed. The problem was in my code after all. Still, thanks to all for the memory debugging tips! -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging memory leaks
rusi rustompm...@gmail.com writes: On Jun 15, 5:16 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Is a web browser a “typical desktop app”? A filesystem browser? An instant messenger? A file transfer application? A podcatcher? All of those typically run for months at a time on my desktop. Any memory leak in any of those is going to cause trouble, please hunt them all down with fire and exterminate with prejudice. Oh well -- I guess I am an old geezer who shuts my machine when I am done! As do I. And when I power on the machine, it resumes exactly where it left off: with the exact same contents of memory as when I pressed the Suspend button. That is, the memory leak will continue to accumulate as the run time of the process continues. Yeah I know -- not so good for the disk though its good for the planet! You can have both: a continuous session, and stop consuming power while not using your machine. -- \ “It is far better to grasp the universe as it really is than to | `\persist in delusion, however satisfying and reassuring.” —Carl | _o__)Sagan | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Cameron Simpson c...@zip.com.au writes: On 15Jun2013 10:42, Ben Finney ben+pyt...@benfinney.id.au wrote: | The message sent to the individual typically arrives earlier (since | it is sent straight from you to the individual), and the message on | the forum arrives later (since it typically requires more | processing). | | But since we're participating in the discussion on the forum and not | in individual email, it is the later one we want, and the earlier | one should be deleted. They're the same message! (Delivered twice.) Replying to either is equivalent. Wrong. They have the same Message-Id, but one of them is delivered via the mailing list, and has the correct RFC 3696 fields in the header to continue the discussion there. The one delivered individually is the one to discard, since it was not delivered via the mailing list. Bah. Plenty of us like both. In the inbox alerts me that someone replied to _my_ post, and in the python mail gets it nicely threaded. Your mail client doesn't alert you to a message addressed to you? Sorry, I could have sworn you said you weren't using a mail client for this... As I already said, this is demonstrating the fact that “reply to all” is broken even for the use case of participating via email. -- \ “Software patents provide one more means of controlling access | `\ to information. They are the tool of choice for the internet | _o__) highwayman.” —Anthony Taylor | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Jun 15, 3:55 pm, Mark Lawrence breamore...@yahoo.co.uk wrote: On 15/06/2013 11:24, Denis McMahon wrote: On Sat, 15 Jun 2013 10:05:01 +, Steven D'Aprano wrote: On Sat, 15 Jun 2013 02:42:55 -0700, subhabangalore 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. No need for a regular expression. py sentence = By the new group py words = sentence.split() py words[1:-1] ['the', 'new'] Does that help? I thought OP wanted: words[words[0],words[-1]] But that might be just my caffeine deprived misinterpretation of his terminology. sentence = By the new group words = sentence.split() words[words[0],words[-1]] Traceback (most recent call last): File stdin, line 1, in module TypeError: list indices must be integers, not tuple So why would the OP want a TypeError? Or has caffeine deprivation affected your typing skills? :) :-) I guess Denis meant (words[0], words[-1]) To the OP: You have the identity: words == [words[0]] + words[1:-1] + [words[-1]] So take your pick of what parts of the expression you want (and discard what you dont want). [The way you've used 'extract' is a bit ambiguous] -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging memory leaks
On Jun 15, 4:23 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: rusi rustompm...@gmail.com writes: On Jun 15, 5:16 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Is a web browser a “typical desktop app”? A filesystem browser? An instant messenger? A file transfer application? A podcatcher? All of those typically run for months at a time on my desktop. Any memory leak in any of those is going to cause trouble, please hunt them all down with fire and exterminate with prejudice. Oh well -- I guess I am an old geezer who shuts my machine when I am done! As do I. And when I power on the machine, it resumes exactly where it left off: with the exact same contents of memory as when I pressed the Suspend button. That is, the memory leak will continue to accumulate as the run time of the process continues. Yeah I know -- not so good for the disk though its good for the planet! You can have both: a continuous session, and stop consuming power while not using your machine. Suspend is low-power, hibernate is 0-power http://www.unixmen.com/suspend-vs-hibernate-in-linux-what-is-the-difference/ And I keep having some issues with hibernate -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugging memory leaks
On Sat, Jun 15, 2013 at 9:35 PM, rusi rustompm...@gmail.com wrote: On Jun 15, 4:23 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: rusi rustompm...@gmail.com writes: On Jun 15, 5:16 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Is a web browser a “typical desktop app”? A filesystem browser? An instant messenger? A file transfer application? A podcatcher? All of those typically run for months at a time on my desktop. Any memory leak in any of those is going to cause trouble, please hunt them all down with fire and exterminate with prejudice. Oh well -- I guess I am an old geezer who shuts my machine when I am done! As do I. And when I power on the machine, it resumes exactly where it left off: with the exact same contents of memory as when I pressed the Suspend button. Suspend is low-power, hibernate is 0-power http://www.unixmen.com/suspend-vs-hibernate-in-linux-what-is-the-difference/ And I keep having some issues with hibernate You can configure the Suspend button to hibernate the computer. Though my personal preference, when hibernating a computer, is to trigger it directly from software. Anyway, same difference; shut down a computer without shutting down a process. I do the same with several of my VMs - when I'm done with them, Save Machine State. (Except the one for Magic: The Gathering Online. For some reason MTGO has problems if I don't actually reboot it periodically, so that one I just shut down.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, 15 Jun 2013 21:29:35 +1000 Ben Finney ben+pyt...@benfinney.id.au wrote: Bah. Plenty of us like both. In the inbox alerts me that someone replied to _my_ post, and in the python mail gets it nicely threaded. Your mail client doesn't alert you to a message addressed to you? Every message in my mailbox is addressed to me otherwise I wouldn't get it. Do you mean the To: line? Which address? I have about a dozen addresses not counting the plus sign addresses like the one you use for this list. Which one should I treat as special? Sorry, I could have sworn you said you weren't using a mail client for this... As I already said, this is demonstrating the fact that “reply to all” is broken even for the use case of participating via email. As the person who proposed this I would like to point out that I never suggested reply to all”. I suggested including the poster that you are replying to. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 788 2246 (DoD#0082)(eNTP) | what's for dinner. IM: da...@vex.net, VOIP: sip:da...@vex.net -- http://mail.python.org/mailman/listinfo/python-list
Re: problem uploading docs to pypi
On 15-6-2013 2:23, MRAB wrote: About 10 ten days ago I got the error: Upload failed (503): backend write error while trying to upload to PyPI, and it failed the same way the second time, but worked some time later. You're right. I tried it again just now and it succeeded this time. Cheers Irmen -- http://mail.python.org/mailman/listinfo/python-list
Re: Future standard GUI library
Okay... how long does a round-trip cost? With a protocol that wasn't made for the purpose (such as HTTP) and all that HTML to render (not to mention javascript that's required for even the most trivial issues) - way too long. Considering that usability guidelines generally permit ~100ms for direct interaction, That's generous. A proficient user with a responsive application can easily outpace that. 100ms is definitely a noticeable lag. Even I feel that and I don't use touch-typing to use the GUI. 50ms might not be noticeable, but I don't have the skills myself to test that. (Magento, a PHP-based online shopping cart system, took the better part of a second - something in the order of 700-800ms - to add a single item. And that on reasonable hardware, not a dedicated server but my test box was certainly not trash.) That's not a question of hardware. Just like with MS (Not Responding). That's the entire round-trip cost. The queries from Sikorsky to Yosemite involve three computers (the client, the server, and the file server), and is completed in under 30 milliseconds. I am talking about applications that actually do something. In my case, database applications. A PostgreSQL transaction is supposed to take at most 25ms to complete (anything above is generally considered an issue that needs to be solved, such as bad SQL), *server-side*. That leaves you another 25ms for the entire network protocol (the pgsql protocol, whatever it is, was designed for the purpose, unlike HTTP) *and* the client-side application logic, including the GUI rendering. Qt is already quite sluggish sometimes, don't know why. GTK and wxPython feel swifter, at least on an actual *operating* system. MS (Not Responding) is definitely incapable to allow applications anything remotely close to responsiveness. Minute-long lockups with frozen cursor are normal. That still gives you 70 milliseconds to render the page to the user, Forget that. 25ms for client-server (pgsql) network protocol, client-side application logic *and* GUI. With a web application that would have to include application server-side application logic, *and* generation of HTML (and javascript), *and* HTTP protocol *and* HTML rendering *and* client-side javascript. Won't work. Sincerely, Wolfgang -- http://mail.python.org/mailman/listinfo/python-list
Re: A certainl part of an if() structure never gets executed.
On 15/6/2013 12:54 μμ, Lele Gaifax wrote: Nick the Gr33k supp...@superhost.gr writes: On 15/6/2013 8:27 πμ, Larry Hudson wrote: Also they do NOT return a variable's truthy value, they return the variable itself. No, as seen from my above examples, what is returned after the expr eval are the actual variables' values, which in turn are truthy, *not* the variable itself. In the context we are talking about, the variable itself has the very same meaning as the actual variable value: Are there cases that a variable and the variable's value cosidered to be 2 different things? mylist = ['foo'] emptylist = [] result = emptylist or mylist result = mylist (since its a no-emoty list) result.append('bar') result is mylist True Never seen the last statement before. What does that mean? result is mylist -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On 15/6/2013 12:48 μμ, Lele Gaifax wrote: Nick the Gr33k supp...@superhost.gr writes: but those 2 gives the same results back k in (name+month+year) == k in (name and month and year) True so both seem to work as expected. That happens only by chance: it seems you now understand the evaluation of boolean expressions in Python, so the following should be clear to you: k in (there + is + a + k + character + somewhere) True ALL strings in the parenthesis are being concatenated to a BIG string, like ('k' in BIG_string) which returns the Boolean value of True since 'k' is contained within it. k in (there and is and a and k and character and somewhere) False first the expression of the parenthesis evaluation. The argument being returned from (there and is and a and k and character and somewhere) expresssion, is the one that is responsible for the determination of the expression's evaluation. That would be the last argument, string somewhere because: 1. All previous strings before the last one were found truthies, so it was turn of the last one to be evaled too. 2. Since somewhere is a truthy of course for being a non-empty string then ALL arguments of the expression are found TRUE which results for the expression to stand TRUE. 3. What determined the expression to stand TRUE was the evaluation of the last argument somewhere, so the latter was the key factor for that to happen, hence its being returned back as a result(thats how Python works) 4. so it's like checking if ('k' in somewhere) which return the Boolean value of False since the aforementioned char isn't contained in the aforementioned string. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Future standard GUI library
On Sat, Jun 15, 2013 at 10:25 PM, Wolfgang Keller felip...@gmx.net wrote: Okay... how long does a round-trip cost? With a protocol that wasn't made for the purpose (such as HTTP) and all that HTML to render (not to mention javascript that's required for even the most trivial issues) - way too long. You keep saying this. I have yet to see actual timings from you. Considering that usability guidelines generally permit ~100ms for direct interaction, 100ms is definitely a noticeable lag. Even I feel that and I don't use touch-typing to use the GUI. 50ms might not be noticeable, but I don't have the skills myself to test that. Okay, so let's talk 50ms then. We can handle this. That's the entire round-trip cost. The queries from Sikorsky to Yosemite involve three computers (the client, the server, and the file server), and is completed in under 30 milliseconds. I am talking about applications that actually do something. In my case, database applications. A PostgreSQL transaction is supposed to take at most 25ms to complete (anything above is generally considered an issue that needs to be solved, such as bad SQL), *server-side*. That leaves you another 25ms for the entire network protocol (the pgsql protocol, whatever it is, was designed for the purpose, unlike HTTP) *and* the client-side application logic, including the GUI rendering. No problem. Again taking *actual real figures*, I got roughly 35-40tps in PostgreSQL across a LAN. That's around about the 25ms figure you're working with, so let's use that as a baseline. My benchmark was actually a durability test from work, which was done on two laptops on a gigabit LAN, with the database server brutally powered down in the middle of the test. Each transaction updates a minimum of two rows in a minimum of one table (transaction content is randomized some). So that's 25ms for the database, leaving us 25ms for the rest. 25ms for client-server (pgsql) network protocol, client-side application logic *and* GUI. With a web application that would have to include application server-side application logic, *and* generation of HTML (and javascript), *and* HTTP protocol *and* HTML rendering *and* client-side javascript. Won't work. I've demonstrated already that with basic hardware and a simple Python HTTP server, network, application logic, and generation of HTML, all take a total of 8ms. That leaves 17ms for rendering HTML. Now, getting figures for the rendering of HTML is not easy; I've just spent fifteen minutes researching on Google and playing with the Firebug-like feature of Chrome, and haven't come up with an answer; so it may well be that 17ms isn't enough for a full page load. However, I would say that the matter is sufficiently borderline (bearing in mind that you can always use a tiny bit of JS and a DOM change) that it cannot be called as Won't work; it's what Mythbusters would dub Plausible. Of course, if you're trying to support MS IE, there's no way you'll guarantee 50ms response time. This is all predicated on having at least reasonably decent hardware and software. But using either the 100ms figure from common usability guidelines [1] [2] [3] or your more stringent 50ms requirement [4], it's certainly entirely possible to achieve immediate response using AJAX. I've worked with real figures, hard numbers. You keep coming back with vague FUD that it won't work. Where are your numbers? And like Sir Ruthven Murgatroyd, I fail to see how you can call this impossible in the face of the fact that I have done it. ChrisA [1] http://www.nngroup.com/articles/response-times-3-important-limits/ [2] http://usabilitygeek.com/14-guidelines-for-web-site-tabs-usability/#attachment_719 [3] http://calendar.perfplanet.com/2011/how-response-times-impact-business/ [4] Can you provide a link to any study anywhere that recommends 50ms? -- http://mail.python.org/mailman/listinfo/python-list
Re: Eval of expr with 'or' and 'and' within
On 15/6/2013 12:48 μμ, Lele Gaifax wrote: but those 2 gives the same results back k in (name+month+year) == k in (name and month and year) True so both seem to work as expected. That happens only by chance: it seems you now understand the evaluation of boolean expressions in Python, so the following should be clear to you: yes indeed! if we had questioned python for: k in (name and year and month) that would have returned the argument month back which is efgh and then the if would have evaled to false since 'k' isn't part of the latter. k in (name and month and year) != k in (name and year and month) As wee see, the order of the arguments in an expression matters. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Sat, 15 Jun 2013 11:55:34 +0100, Mark Lawrence wrote: sentence = By the new group words = sentence.split() words[words[0],words[-1]] Traceback (most recent call last): File stdin, line 1, in module TypeError: list indices must be integers, not tuple So why would the OP want a TypeError? Or has caffeine deprivation affected your typing skills? :) Yeah - that last: words[words[0],words[-1]] should probably have been: first_and_last = [words[0], words[-1]] or even: first_and_last = (words[0], words[-1]) Or even: first_and_last = [sentence.split()[i] for i in (0, -1)] middle = sentence.split()[1:-2] -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Sat, 15 Jun 2013 13:41:21 +, Denis McMahon wrote: first_and_last = [sentence.split()[i] for i in (0, -1)] middle = sentence.split()[1:-2] Bugger! That last is actually: sentence.split()[1:-1] It just looks like a two. -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Version Control Software
In article mailman.3359.1371275633.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sat, Jun 15, 2013 at 3:39 PM, Tim Delaney timothy.c.dela...@gmail.com wrote: I can absolutely confirm how much ClearCase slows things down. I completely refused to use dynamic views for several reasons - #1 being that if you lost your network connection you couldn't work at all... And that right there is why modern source control systems are distributed, not centralized. It's so much easier with git; we lost our central hub at one point, and another dev and I simply pulled from each other for a bit until we got a new Scaphio online. With centralized version control, that would have basically meant a complete outage until the new box was up. ChrisA The advantage of DVCS is that everybody has a full copy of the repo. The disadvantage of the DVCS is that every MUST have a full copy of the repo. When a repo gets big, you may not want to pull all of that data just to get the subtree you need. -- http://mail.python.org/mailman/listinfo/python-list
Potential Python 3.3.2 pyvenv bug on Windows
I've recently hit an issue with pyvenv that is causing AttributeErrors in other packages on Windows (see https://groups.google.com/forum/?fromgroups#!topic/pylons-discuss/FpOSMDpdvy4). Here's what I believe is going on: On Windows, the pyvenv pydoc script has a .py extension - so import finds it instead of the system's pydoc module. On Linux, the pyvenv pydoc script doesn't have an extension - so import finds the system's pydoc module. I believe the Windows pyvenv pydoc.py script should be renamed to pydocs.py. Has anyone else hit this issue? Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On 15/06/2013 14:45, Denis McMahon wrote: On Sat, 15 Jun 2013 13:41:21 +, Denis McMahon wrote: first_and_last = [sentence.split()[i] for i in (0, -1)] middle = sentence.split()[1:-2] Bugger! That last is actually: sentence.split()[1:-1] It just looks like a two. I've a very strong sense of deja vu having round the same loop what, two hours ago? Wondering out aloud the number of times a programmer has thought That's easy, I don't need to test it. How are the mighty fallen. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Potential Python 3.3.2 pyvenv bug on Windows
On Sat, Jun 15, 2013 at 3:17 PM, pe...@psantoro.net wrote: I've recently hit an issue with pyvenv that is causing AttributeErrors in other packages on Windows (see https://groups.google.com/forum/?fromgroups#!topic/pylons-discuss/FpOSMDpdvy4). Here's what I believe is going on: On Windows, the pyvenv pydoc script has a .py extension - so import finds it instead of the system's pydoc module. On Linux, the pyvenv pydoc script doesn't have an extension - so import finds the system's pydoc module. I believe the Windows pyvenv pydoc.py script should be renamed to pydocs.py. Has anyone else hit this issue? Peter -- http://mail.python.org/mailman/listinfo/python-list Don't think that's so good of a fix. Following documentation for open-source software is already hard enough on windows, people will not be able to use pydoc.py because it was renamed. It would be slightly better to use pydoc.bat (which could then call pydocs.py), but even so it would be pretty bad. -- Fábio Santos -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Saturday, June 15, 2013 7:58:44 PM UTC+5:30, Mark Lawrence wrote: On 15/06/2013 14:45, Denis McMahon wrote: On Sat, 15 Jun 2013 13:41:21 +, Denis McMahon wrote: first_and_last = [sentence.split()[i] for i in (0, -1)] middle = sentence.split()[1:-2] Bugger! That last is actually: sentence.split()[1:-1] It just looks like a two. I've a very strong sense of deja vu having round the same loop what, two hours ago? Wondering out aloud the number of times a programmer has thought That's easy, I don't need to test it. How are the mighty fallen. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence Dear Group, I know this solution but I want to have Regular Expression option. Just learning. Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On 2013-06-15, Denis McMahon denismfmcma...@gmail.com wrote: On Fri, 14 Jun 2013 16:58:20 +0300, Nick the Gr33k wrote: On 14/6/2013 1:14 , Cameron Simpson wrote: Normally a character in a b'...' item represents the byte value matching the character's Unicode ordinal value. The only thing that i didn't understood is this line. First please tell me what is a byte value Seriously? You don't understand the term byte? And you're the support desk for a webhosting company? Well, we haven't had this thread for a week or so... There is some ambiguity in the term byte. It used to mean the smallest addressable unit of memory (which varied in the past -- at one point, both 20 and 60 bit bytes were common). These days the smallest addressable unit of memory is almost always 8 bits on desktop and embedded processors (but often not on DSPs). That's why when IEEE stadards want to refer to an 8-bit chunk of data they use the term octet. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On 15/6/2013 5:44 μμ, Grant Edwards wrote: There is some ambiguity in the term byte. It used to mean the smallest addressable unit of memory (which varied in the past -- at one point, both 20 and 60 bit bytes were common). These days the smallest addressable unit of memory is almost always 8 bits on desktop and embedded processors (but often not on DSPs). That's why when IEEE stadards want to refer to an 8-bit chunk of data they use the term octet. What the difference between a byte and a byte's value? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
In article kphul7$74q$1...@reader1.panix.com, Grant Edwards invalid@invalid.invalid wrote: There is some ambiguity in the term byte. It used to mean the smallest addressable unit of memory (which varied in the past -- at one point, both 20 and 60 bit bytes were common). I would have defined it more like, some arbitrary collection of adjacent bits which hold some useful value. Doesn't need to be addressable, nor does it need to be the smallest such thing. For example, on the pdp-10 (36 bit word), it was common to treat a word as either four 9-bit bytes, or five 7-bit bytes (with one bit left over), depending on what you were doing. And, of course, a nybble was something smaller than a byte! And, yes, especially in networking, everybody talks about octets when they want to make sure people understand what they mean. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
subhabangal...@gmail.com wrote: I know this solution but I want to have Regular Expression option. Just learning. http://mattgemmell.com/2008/12/08/what-have-you-tried/ Just spell out what you want: A word at the beginning, followed by any text, followed by a word at the end. Now look up the basic regex metacharacters and try to come up with a solution (Hint: you will need groups) http://docs.python.org/3/howto/regex.html#regex-howto http://docs.python.org/3/library/re.html#regular-expression-syntax Bye, Andreas -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On 15/06/2013 15:31, subhabangal...@gmail.com wrote: Dear Group, I know this solution but I want to have Regular Expression option. Just learning. Regards, Subhabrata. Start here http://docs.python.org/2/library/re.html Would you also please read and action this, http://wiki.python.org/moin/GoogleGroupsPython , thanks. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On 15/6/2013 5:59 μμ, Roy Smith wrote: And, yes, especially in networking, everybody talks about octets when they want to make sure people understand what they mean. 1 byte = 8 bits in networking though since we do not use encoding schemes with variable lengths like utf-8 is, how do we separate when a byte value start and when it stops? do we need a start bit and a stop bit for that? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On Sat, 15 Jun 2013 17:49:13 +0300, Nick the Gr33k wrote: What the difference between a byte and a byte's value? Nothing. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Version Control Software
On 2013-06-15, Roy Smith wrote: And that right there is why modern source control systems are distributed, not centralized. It's so much easier with git; we lost our central hub at one point, and another dev and I simply pulled from each other for a bit until we got a new Scaphio online. With centralized version control, that would have basically meant a complete outage until the new box was up. ChrisA The advantage of DVCS is that everybody has a full copy of the repo. The disadvantage of the DVCS is that every MUST have a full copy of the repo. When a repo gets big, you may not want to pull all of that data just to get the subtree you need. Also, is working without connection to the server such big an issue? One would expect that losing access to the central server would indicate significant problems that would impact development anyway. -- Real (i.e. statistical) tennis and snooker player rankings and ratings: http://www.statsfair.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On Sat, Jun 15, 2013 at 11:14 AM, Nick the Gr33k supp...@superhost.grwrote: On 15/6/2013 5:59 μμ, Roy Smith wrote: And, yes, especially in networking, everybody talks about octets when they want to make sure people understand what they mean. 1 byte = 8 bits in networking though since we do not use encoding schemes with variable lengths like utf-8 is, how do we separate when a byte value start and when it stops? do we need a start bit and a stop bit for that? And this is specific to python how? -- What is now proved was at first only imagined! -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: I suggested including the poster that you are replying to. In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: A certainl part of an if() structure never gets executed.
On 06/15/2013 07:07 AM, Nick the Gr33k wrote: result = mylist (since its a no-emoty list) result.append('bar') result is mylist True Never seen the last statement before. What does that mean? result is mylist Yes. Surprisingling good question. http://docs.python.org/3.3/reference/expressions.html#is http://docs.python.org/3/reference/datamodel.html One thing that you may find interesting is that what we often call variables in Python, and which from your code's point of view look and act like variables are in fact names. Whereas in C, assignment can be thought of as copy (a = b in C means that b's value is copied to a), in Python assignment is associating a name with an object. Thus a = b in Python means that now the names a and b both are bound (reference to) the same object. That's why the is operator is there, to help one know if two names point to the same object. I bring this up on the list from time to time because I find it really interesting and intellectually appealing the way Python works. Hearkens back to my class at uni on programming language theory. -- http://mail.python.org/mailman/listinfo/python-list
Scripting Calligra Sheets with Python
I've read all the docs I can find and worked through a lot of examples but I can't figure out how to shift the focus from one cell to another. Could someone point me to the command or an example of how to do this? Thanks, Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: A certainl part of an if() structure never gets executed.
On 15/6/2013 6:53 μμ, Michael Torrie wrote: On 06/15/2013 07:07 AM, Nick the Gr33k wrote: result = mylist (since its a no-emoty list) result.append('bar') result is mylist True Never seen the last statement before. What does that mean? result is mylist Yes. Surprisingling good question. http://docs.python.org/3.3/reference/expressions.html#is http://docs.python.org/3/reference/datamodel.html One thing that you may find interesting is that what we often call variables in Python, and which from your code's point of view look and act like variables are in fact names. Whereas in C, assignment can be thought of as copy (a = b in C means that b's value is copied to a), in Python assignment is associating a name with an object. Thus a = b in Python means that now the names a and b both are bound (reference to) the same object. That's why the is operator is there, to help one know if two names point to the same object. I bring this up on the list from time to time because I find it really interesting and intellectually appealing the way Python works. Hearkens back to my class at uni on programming language theory. (a = b in C means that b's value is copied to a) in C: a = memory chunk able to hold some specific type's value b = memory chunk able to hold some specific type's value a = b means So we have 2 memory units hod, the same value. in Python: a and b you say are names, which still are memory chunks In both situations we still have 2 memory units holding values, so hows that different? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Saturday, June 15, 2013 8:34:59 PM UTC+5:30, Mark Lawrence wrote: On 15/06/2013 15:31, subhabangal...@gmail.com wrote: Dear Group, I know this solution but I want to have Regular Expression option. Just learning. Regards, Subhabrata. Start here http://docs.python.org/2/library/re.html Would you also please read and action this, http://wiki.python.org/moin/GoogleGroupsPython , thanks. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence Dear Group, Suppose I want a regular expression that matches both Sent from my iPhone and Sent from my iPod. How do I write such an expression--is the problem, Sent from my iPod Sent from my iPhone which can be written as, re.compile(Sent from my (iPhone|iPod)) now if I want to slightly to extend it as, Taken from my iPod Taken from my iPhone I am looking how can I use or in the beginning pattern? and the third phase if the intermediate phrase, from my if also differs or changes. In a nutshell I want to extract a particular group of phrases, where, the beginning and end pattern may alter like, (i) either from beginning Pattern B1 to end Pattern E1, (ii) or from beginning Pattern B1 to end Pattern E2, (iii) or from beginning Pattern B2 to end Pattern E2, . Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scripting Calligra Sheets with Python
On 15/06/2013 16:55, Jim Byrnes wrote: I've read all the docs I can find and worked through a lot of examples but I can't figure out how to shift the focus from one cell to another. Could someone point me to the command or an example of how to do this? Thanks, Jim Have you tried asking here http://www.calligra.org/get-help/ as you were pointed in this direction on the tutor mailing list three months ago? -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On 15/06/2013 17:28, subhabangal...@gmail.com wrote: You've been pointed at several links, so what have you tried, and what, if anything, went wrong? Or do you simply not understand, in which case please say so and we'll help. I'm not trying to be awkward, it's simply known that you learn more if you try something yourself, rather than be spoon fed it. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: I suggested including the poster that you are replying to. In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- 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: Don't feed the troll...
On Sat, 15 Jun 2013 18:41:41 +0200 Chris “Kwpolska” Warrick kwpol...@gmail.com wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. Actually, no. Mailman is not your MTA. It only gets the email sent to the mailing list. Your MTA sends the other one directly so Steve is correct. He gets two copies. If his client doesn't suppress the duplicate then he will be presented with both. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 788 2246 (DoD#0082)(eNTP) | what's for dinner. IM: da...@vex.net, VOIP: sip:da...@vex.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Potential Python 3.3.2 pyvenv bug on Windows
Agreed. I did submit a bug report. If the core developers fix this, I suspect they will do so in a manner that does not break existing docs. However, my workaround (rename the pyvenv created scripts\pydoc.py file) should suffice for those who need the problem solved now. Take care, Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, 15 Jun 2013 18:41:41 +0200, Chris “Kwpolska” Warrick wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: I suggested including the poster that you are replying to. In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. Wrong. I got two copies. One via comp.lang.python, and one direct to me. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Mailman forwarding (was: Don't feed the troll...)
On Sat, Jun 15, 2013 at 01:07:29PM -0400, D'Arcy J.M. Cain wrote: On Sat, 15 Jun 2013 18:41:41 +0200 Chris “Kwpolska” Warrick wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano wrote: In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. Actually, no. Mailman is not your MTA. It only gets the email sent to the mailing list. Your MTA sends the other one directly so Steve is correct. He gets two copies. If his client doesn't suppress the duplicate then he will be presented with both. Mailman can (optionally) assume that addresses listed in To, CC, … fields received an out-of-band copies, and not mail them an additional copy [1]. Cheers, Trevor [1]: http://www.gnu.org/software/mailman/mailman-member/node21.html -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, Jun 15, 2013 at 7:07 PM, D'Arcy J.M. Cain da...@druid.net wrote: On Sat, 15 Jun 2013 18:41:41 +0200 Chris “Kwpolska” Warrick kwpol...@gmail.com wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. Actually, no. Mailman is not your MTA. It only gets the email sent to the mailing list. Your MTA sends the other one directly so Steve is correct. He gets two copies. If his client doesn't suppress the duplicate then he will be presented with both. The source code seems to think otherwise: http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/src/mailman/handlers/avoid_duplicates.py On Sat, Jun 15, 2013 at 7:12 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Wrong. I got two copies. One via comp.lang.python, and one direct to me. You are subscribed through Usenet and not http://mail.python.org/mailman/listinfo/python-list, in which case the above doesn’t apply, because Mailman throws the mail to Usenet and not you personally. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 15/6/2013 7:41 μμ, Chris “Kwpolska” Warrick wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: I suggested including the poster that you are replying to. In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html You are spamming my thread. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Jun 15, 10:30 pm, Nick the Gr33k supp...@superhost.gr wrote: You are spamming my thread. With you as our spamming-guru, Onward! Sky is the limit! -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Jun 15, 10:29 pm, Nick the Gr33k supp...@superhost.gr wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.pyhas PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org |http://caliburn.nl/topposting.html How much of a bastard can you be? So bastard is an uncountable noun? -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Sat, Jun 15, 2013 at 6:29 PM, Nick the Gr33k supp...@superhost.gr wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list Yes, Nick. You are not the problem. He is for telling on you. Shame on him! (or her? idk) -- Fábio Santos -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On 15/06/2013 18:29, Nick the Gr33k wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? A classic example of the pot calling the kettle black. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: A certainl part of an if() structure never gets executed.
On 06/15/2013 10:18 AM, Nick the Gr33k wrote: a and b you say are names, which still are memory chunks Yes no matter how you look at it, a dictionary of names and objects is memory and variables in that sense. But at a higher level, we can consider the differences with how a language like C defines variables. In both situations we still have 2 memory units holding values, so hows that different? Perhaps one could think of python names as more like pointers or references in C. But python references are counted and garbage-collected (more like a C++ reference-counting pointer type). For example, a = 4 makes the name a be a reference to the object int(4), which will never ever change in its lifetime (indeed it wouldn't make sense for the integer 4 to change otherwise it wouldn't be a 4). Thus a = a + 1 creates a new object that represents the integer value of 4 + 1, and throws the old object away. a = 5 id(a) 2857664 a = a + 1 id (a) 2857680 Note that the identity (object) of a has changed. If a were a variable in the same sense as C, the identity of a would not change. A mutable object like a list acts more like a variable in some ways: b = [] id(b) 3076765292 b.append(3) id(b) 3076765292 In many cases the distinction is little more than intellectual for all intents and purposes, though it some cases the idea is very powerful. But there a couple of cases where the difference between a variable and a name referencing an object does bite people in Python: http://effbot.org/zone/default-values.htm http://stackoverflow.com/questions/986006/python-how-do-i-pass-a-variable-by-reference -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Sat, 15 Jun 2013 20:29:09 +0300, Nick the Gr33k wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? Were that my data I would be calling him a hero. please learn how to secure data before allowing your sites to escape onto the internet -- You will inherit some money or a small piece of land. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 06/15/2013 11:30 AM, Nick the Gr33k wrote: You are spamming my thread. No he's not. The subject is changed on this branch of the thread, so it's easy to see in any good e-mail reader that this sub-thread or branch is diverting. This is proper list etiquette. -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Sat, Jun 15, 2013 at 7:29 PM, Nick the Gr33k supp...@superhost.gr wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list Does saving that page count? -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, 15 Jun 2013 19:25:21 +0200, Chris “Kwpolska” Warrick wrote: On Sat, Jun 15, 2013 at 7:07 PM, D'Arcy J.M. Cain da...@druid.net wrote: On Sat, 15 Jun 2013 18:41:41 +0200 Chris “Kwpolska” Warrick kwpol...@gmail.com wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. Actually, no. Mailman is not your MTA. It only gets the email sent to the mailing list. Your MTA sends the other one directly so Steve is correct. He gets two copies. If his client doesn't suppress the duplicate then he will be presented with both. The source code seems to think otherwise: Mailman is not the only mailing list software in the world, and the feature you are referring to is optional. http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/src/ mailman/handlers/avoid_duplicates.py On Sat, Jun 15, 2013 at 7:12 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Wrong. I got two copies. One via comp.lang.python, and one direct to me. You are subscribed through Usenet and not http://mail.python.org/mailman/listinfo/python-list, in which case the above doesn’t apply, because Mailman throws the mail to Usenet and not you personally. I still get two copies if you CC me. That's still unnecessary and rude. If I wanted a copy emailed to me, I'd subscribe via email rather than via news. Whether you agree or not, I'd appreciate if you respect my wishes rather than try to wiggle out of it on a technicality. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 15/06/2013 18:30, Nick the Gr33k wrote: On 15/6/2013 7:41 μμ, Chris “Kwpolska” Warrick wrote: On Sat, Jun 15, 2013 at 5:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 15 Jun 2013 07:58:27 -0400, D'Arcy J.M. Cain wrote: I suggested including the poster that you are replying to. In the name of all that's good and decent in the world, why on earth would you do that when replying to a mailing list??? They're already getting a reply. Sending them TWO identical replies is just rude. Mailman is intelligent enough not to send a second copy in that case. This message was sent with a CC, and you got only one copy. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html You are spamming my thread. Funniest thing I've read in years, try taking up writing comedy instead of anything involving computing. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Sat, 15 Jun 2013 18:43:42 +0100, Mark Lawrence wrote: A classic example of the pot calling the kettle black. If you're going to continue making unproductive, off-topic, inflammatory posts that prolong these already excessively large threads, Nikos won't be the only one kill-filed. If you have nothing helpful to say, send it to /dev/null. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
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. If you have nothing helpful to say, send it to /dev/null. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Pattern Search Regular Expression
On Saturday, June 15, 2013 3:12:55 PM UTC+5:30, subhaba...@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. If any one of the esteemed members can help. Thanking you in Advance, Regards, Subhabrata Dear Group, 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. I am looking for more intriguing exercises, esp use of or in the pattern search. Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
Nick the Gr33k supp...@superhost.gr wrote: You are spamming my thread. Well, you don't own this thread. In fact nobody owns it. This is a public forum and thus anybody can answer to any post as he likes. Bye, Andreas -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On Sat, Jun 15, 2013 at 7:52 PM, Alister alister.w...@ntlworld.com wrote: On Sat, 15 Jun 2013 20:29:09 +0300, Nick the Gr33k wrote: On 15/6/2013 8:11 μμ, Chris “Kwpolska” Warrick wrote: On Fri, Jun 14, 2013 at 5:25 AM, alex23 wuwe...@gmail.com wrote: On Jun 14, 2:24 am, Νικόλαος Κούρας supp...@superhost.gr wrote: iam researchign a solution to this as we speak. Spamming endless ZOMG HELP ME I'M INCOMPETENT posts isn't research. -- http://mail.python.org/mailman/listinfo/python-list BTW: Do we have a Greek around that is not Nikos, who is willing to report him to the Police for publishing personal data of his clients? http://superhost.gr/?page=pelatologio.py has PHONE NUMBERS of people according to Google Translate. And that doesn’t seem to be legal. I have already thrown an e-mail address to the domain registrar. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail | always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html How much of a bastard can you be? Were that my data I would be calling him a hero. please learn how to secure data before allowing your sites to escape onto the internet Actually, Nikolaos should be happy I didn’t bother to learn Greek and pony up €6 to actually call those seventeen numbers, as roaming is friggin’ expensive, and that’s assuming that a minute would be enough to tell those people what is going on, and not forgetting that I live in a country where the minimum wage is less than €400, and that the number includes taxes and such. -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Jun 15, 10:52 pm, Steven D'Aprano steve +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. Others -- Fabio -- have indicated their wish to leave the list due to everything becoming Nikos-tainted. Everyone is exasperated and talking of kill-filing him. Let me remind you of your post: http://mail.python.org/pipermail/python-list/2013-June/649581.html In this post you have imputed masturbation to first-time poster for a quite valid question. [I am assuming that google is correct in informing me that choking the chicken means that]. This is way beyond being rude uncalled-for and generally unacceptable. I suggest it is because of something else you said -- viz that Nikos mails are draining you. In short because you are unable to restrain your charitable behavior towards Nikos -- note that this is charity at public (the group) expense -- you are behaving abominably in other contexts, including towards first time posters. If you must help Nikos, please do it in private. He is not wanted here. [This is not specifically addressed to you Steven alone but to all who are feeling charitable at public expense] -- http://mail.python.org/mailman/listinfo/python-list
Re: RFD: rename comp.lang.python to comp.support.superhost
On 15/06/2013 18:51, Steven D'Aprano wrote: On Sat, 15 Jun 2013 18:43:42 +0100, Mark Lawrence wrote: A classic example of the pot calling the kettle black. If you're going to continue making unproductive, off-topic, inflammatory posts that prolong these already excessively large threads, Nikos won't be the only one kill-filed. If you have nothing helpful to say, send it to /dev/null. I do apologise Mr. Self Appointed Policeman. Not. -- Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green. Snooker commentator 'Whispering' Ted Lowe. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list
Re: Version Control Software
On Sat, 15 Jun 2013 15:29:27 +, Giorgos Tzampanakis wrote: Also, is working without connection to the server such big an issue? One would expect that losing access to the central server would indicate significant problems that would impact development anyway. Everyone and every device is connected to the internet all the time, or else the universe comes to an end. Get off my lawn! ;-) Being able to work remotely is a huge win. Anarchy is not. Somewhere in between, reality sets in, and I can work appropriately for different use cases. -- 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
XML to PDF book with ElementTree and xtopdf
Hi list, This may be of interest - a program to create simple PDF books from XML text content: Create PDF books with XMLtoPDFBook: http://jugad2.blogspot.in/2013/06/create-pdf-books-with-xmltopdfbook.html XMLtoPDFBook.py requires ElementTree (which is in the standard Python library), xtopdf, ReportLab and Python. Relevant download links for xtopdf and ReportLab are in the post linked above. Here is a guide to installing xtopdf: http://jugad2.blogspot.in/2012/07/guide-to-installing-and-using-xtopdf.html - Vasudev Ram Python, Linux and open source consulting and training Site: http://dancingbison.com Blog: http://jugad2.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On 15/6/2013 8:47 μμ, Steven D'Aprano wrote: I still get two copies if you CC me. That's still unnecessary and rude. If I wanted a copy emailed to me, I'd subscribe via email rather than via news. Whether you agree or not, I'd appreciate if you respect my wishes rather than try to wiggle out of it on a technicality. I'am also getting 2 notifications two of any response in TB One in the news section and one by mail. Please do not CC. If i wanted mail notification i would subscribed via email. -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
On 14/6/2013 4:58 μμ, Nick the Gr33k wrote: On 14/6/2013 1:14 μμ, Cameron Simpson wrote: Normally a character in a b'...' item represents the byte value matching the character's Unicode ordinal value. The only thing that i didn't understood is this line. First please tell me what is a byte value \x1b is a sequence you find inside strings (and byte strings, the b'...' format). \x1b is a character(ESC) represented in hex format b'\x1b' is a byte object that represents what? chr(27).encode('utf-8') b'\x1b' b'\x1b'.decode('utf-8') '\x1b' After decoding it gives the char ESC in hex format Shouldn't it result in value 27 which is the ordinal of ESC ? No, I mean conceptually, there is no difference between a code-point and its ordinal value. They are the same thing. Why Unicode charset doesn't just contain characters, but instead it contains a mapping of (characters -- ordinals) ? I mean what we do is to encode a character like chr(65).encode('utf-8') What's the reason of existence of its corresponding ordinal value since it doesn't get involved into the encoding process? Thank you very much for taking the time to explain. Can someone please explain these questions too? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't feed the troll...
On Sat, 15 Jun 2013 11:18:03 -0700, rusi wrote: At least two people -- Alex and Antoon -- have told you that by supporting Nikos, when everyone else wants him off list, you are part of the problem. And others have publicly thanked me for giving useful answers to Nikos, because they have learned from them. You replied to Antoon, and agreed with his position that we should shun Nikos, then *immediately* contradicted yourself by stating that Robert Kern's helpful answers were the ideal. And then, just to further demonstrate that your actions are at best inconsistent and at worst hypocritical, you have since gone on to fire barbs at Nikos instead of ignoring him. So please tend to the beam in your own eye before pointing at the mote in mine. Others -- Fabio -- have indicated their wish to leave the list due to everything becoming Nikos-tainted. That would be disappointing, but there's nothing I can do about it. Everyone is exasperated and talking of kill-filing him. Then why don't they? Don't feed the troll includes trying to beat him into submission with insults and half-witty remarks. This is not about Nikos. It's about those who are also doing their bit to make this community an ugly, hostile place. I won't mention names -- you know who you are. Those who take it upon themselves to bait and prod and poke Nikos with insults and inflammatory replies. Appointing themselves Internet Police and making ridiculous claims that Nikos ought to be reported to the police. Sending bogus complaints to the domain registrar. There is a word for this sort of behaviour: bullying. I don't care how morally justified you think you are, you are now just as big a part of the problem as Nikos. Let me remind you of your post: http://mail.python.org/pipermail/python-list/2013-June/649581.html In this post you have imputed masturbation to first-time poster for a quite valid question. [I am assuming that google is correct in informing me that choking the chicken means that]. This is way beyond being rude uncalled-for and generally unacceptable. Not as rude as making such a misleading characterisation of my post. The original poster's reply is one click away from that link: Thank you for your help and sense of humor... all the best, Buford http://mail.python.org/pipermail/python-list/2013-June/649680.html If you insist on taking umbrage on behalf of the OP, I can't stop you, but that says more about you than about me. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Why 'files.py' does not print the filenames into a table format?
Hello, Trying to browse http://superhost.gr/?page=files.py with tailing -F of the error_log i noticed that error log outputs no error! So that means that the script is correct. here are the directory app's files. ni...@superhost.gr [~/www/data/apps]# ls -l total 412788 drwxr-xr-x 2 nikos nikos 4096 Jun 12 12:03 ./ drwxr-xr-x 6 nikos nikos 4096 May 26 21:13 ../ -rwxr-xr-x 1 nikos nikos 13157283 Mar 17 12:57 100\ Mythoi\ tou\ Aiswpou.pdf* -rwxr-xr-x 1 nikos nikos 29524686 Mar 11 18:17 Anekdotologio.exe* -rw-r--r-- 1 nikos nikos 42413964 Jun 2 20:29 Battleship.exe -rw-r--r-- 1 nikos nikos 51819750 Jun 2 20:04 Luxor\ Evolved.exe -rw-r--r-- 1 nikos nikos 60571648 Jun 2 14:59 Monopoly.exe -rwxr-xr-x 1 nikos nikos 1788164 Mar 14 11:31 Online\ Movie\ Player.zip* -rw-r--r-- 1 nikos nikos 5277287 Jun 1 18:35 O\ Nomos\ tou\ Merfy\ v1-2-3.zip -rwxr-xr-x 1 nikos nikos 16383001 Jun 22 2010 Orthodoxo\ Imerologio.exe* -rw-r--r-- 1 nikos nikos 6084806 Jun 1 18:22 Pac-Man.exe -rw-r--r-- 1 nikos nikos 45297713 Jun 10 12:38 Raptor\ Chess.exe -rw-r--r-- 1 nikos nikos 25476584 Jun 2 19:50 Scrabble.exe -rwxr-xr-x 1 nikos nikos 49141166 Mar 17 12:48 To\ 1o\ mou\ vivlio\ gia\ to\ skaki.pdf* -rwxr-xr-x 1 nikos nikos 3298310 Mar 17 12:45 Vivlos\ gia\ Atheofovous.pdf* -rw-r--r-- 1 nikos nikos 1764864 May 29 21:50 V-Radio\ v2.4.msi -rw-r--r-- 1 nikos nikos 3511233 Jun 4 14:11 Ευχή\ του\ Ιησού.mp3 -rwxr-xr-x 1 nikos nikos 66896732 Mar 17 13:13 Κοσμάς\ Αιτωλός\ -\ Προφητείες.pdf* -rw-r--r-- 1 nikos nikos 236032 Jun 4 14:10 Σκέψου\ έναν\ αριθμό.exe The code is as follows: # = # Convert wrongly encoded filenames to utf-8 # = path = b'/home/nikos/public_html/data/apps/' filenames = os.listdir( path ) utf8_filenames = [] for filename in filenames: # Compute 'path/to/filename' filename_bytes = path + filename encoding = guess_encoding( filename_bytes ) if encoding == 'utf-8': # File name is valid UTF-8, so we can skip to the next file. utf8_filenames.append( filename_bytes ) continue elif encoding is None: # No idea what the encoding is. Hit it with a hammer until it stops moving. filename = filename_bytes.decode( 'utf-8', 'xmlcharrefreplace' ) else: filename = filename_bytes.decode( encoding ) # Rename the file to something which ought to be UTF-8 clean. newname_bytes = filename.encode('utf-8') os.rename( filename_bytes, newname_bytes ) utf8_filenames.append( newname_bytes ) # Once we get here, the file ought to be UTF-8 clean and the Unicode name ought to exist: assert os.path.exists( newname_bytes.decode('utf-8') ) # Switch filenames from utf8 bytestrings = unicode strings filenames = [] for utf8_filename in utf8_filenames: filenames.append( utf8_filename.decode('utf-8') ) # Check the presence of a database file against the dir files and delete record if it doesn't exist cur.execute('''SELECT url FROM files''') data = cur.fetchall() for url in data: if url not in filenames: # Delete spurious cur.execute('''DELETE FROM files WHERE url = %s''', url ) # = # Display ALL files, each with its own download button # = print('''body background='/data/images/star.jpg' centerimg src='/data/images/download.gif'brbr table border=5 cellpadding=5 bgcolor=green ''') try: cur.execute( '''SELECT * FROM files ORDER BY lastvisit DESC''' ) data = cur.fetchall() for row in data: (filename, hits, host, lastvisit) = row lastvisit = lastvisit.strftime('%A %e %b, %H:%M') print(''' form method=get action=/cgi-bin/files.py tr td center input type=submit name=filename value=%s /td td center font color=yellow size=5 %s /td td center font color=orange size=4 %s /td td center font color=silver size=4 %s /td /tr /form ''' % (filename, hits, host, lastvisit) ) print( '''/tablebrbr''' ) except pymysql.ProgrammingError as e: print( repr(e) ) === PLEASE take a look, its not a huge code, the encoding was of Steven idea's, so