Re: Python 3 is killing Python

2014-07-18 Thread MRAB
On 2014-07-18 19:20, Steven D'Aprano wrote: On Thu, 17 Jul 2014 11:15:59 -0700, Rick Johnson wrote: On Thursday, July 17, 2014 5:12:23 AM UTC-5, Fabien wrote: For non-informatic students [...] I don't think that's true. Less general languages like Matlab appear much easier to me: unified doc,

Re: Python 3 is killing Python

2014-07-18 Thread MRAB
On 2014-07-18 04:37, Rick Johnson wrote: On Thursday, July 17, 2014 9:15:15 PM UTC-5, Chris Angelico wrote: For myself, though, I completely do not use the editor half of [IDLE]; but it's spectacularly useful (with limitations) as my primary interactive interpreter. Yes Chris, i also think tha

Re: Python 3 is killing Python

2014-07-17 Thread MRAB
On 2014-07-17 04:15, Chris Angelico wrote: On Thu, Jul 17, 2014 at 12:51 PM, Steven D'Aprano wrote: Most programming languages are written for J. Random Hacker, not Jランダムハッカー. I had to paste that into Google Translate to be able to understand what you meant (although I could guess just fine).

Re: This Python 3 is killing Python thread is killing me.

2014-07-16 Thread MRAB
On 2014-07-16 21:40, Skip Montanaro wrote: On Wed, Jul 16, 2014 at 3:27 PM, Mark Lawrence wrote: The difference between our most illustrious resident unicode expert and rr Sorry, who is "rr"? I went looking in the referenced thread but found nobody with those initials. Not so helpfully, Gmail

Re: Python 3 is killing Python

2014-07-15 Thread MRAB
On 2014-07-16 00:53, Rick Johnson wrote: On Tuesday, July 15, 2014 5:40:29 PM UTC-5, Abhiram R wrote: [snip excessive quotations] Aah. Understood. Apologies for the "noobishness" :) Noobishness can be tolerated for a "reasonable" time, especially when the "noob" actively seeks to improve his s

Re: Python 3 is killing Python

2014-07-15 Thread MRAB
On 2014-07-15 13:19, alister wrote: Image, for a moment, a world WITHOUT the great USA! Yes, i know you little commies love to curse the USA, and yes, there are many dark sins committed within AND beyond her borders, but try to tell me you bass-turds, what nation in modern history has contribute

Re: Python 3 is killing Python

2014-07-14 Thread MRAB
On 2014-07-14 23:12, Rick Johnson wrote: On Wednesday, May 28, 2014 3:15:45 PM UTC-5, Chris Angelico wrote: On Thu, May 29, 2014 at 5:58 AM, Larry Martell wrote: No company that I work for is using python 3 - they just have too much of an investment in a python 2 code base to switch. I'm just s

Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example

2014-07-10 Thread MRAB
On 2014-07-10 16:37, fl wrote: Hi, This example is from the link: https://wiki.python.org/moin/RegularExpression I have thought about it quite a while without a clue yet. I notice that it uses double quote ", in contrast to ' which I see more often until now. It looks very complicated to me.

Re: What does (A ``quote'' is the character used to open the string, i.e. either ' or ".) mean?

2014-07-10 Thread MRAB
On 2014-07-10 16:23, fl wrote: On Thursday, July 10, 2014 10:14:14 AM UTC-4, Chris "Kwpolska" Warrick wrote: > Please don't learn from this link. It's from 2001. You should learn from modern documentation: https://docs.python.org/ (if not running 3.4.x, change the version in the top) Yo

Re: Why is it different about '\s' Matches whitespace and Equivalent to [\t\n\r\f]?

2014-07-10 Thread MRAB
On 2014-07-10 14:32, fl wrote: On Thursday, July 10, 2014 7:18:01 AM UTC-4, MRAB wrote: It's equivalent to [ \t\n\r\f], i.e. it also includes a space, so either the tutorial is wrong, or you didn't look closely enough. :-) The string starts with ' ', not '\t&

Re: NaN comparisons - Call For Anecdotes

2014-07-10 Thread MRAB
On 2014-07-10 01:57, Ben Finney wrote: "Anders J. Munch" <2...@jmunch.dk> writes: Joel Goldstick wrote: > I've been following along here, and it seems you haven't received > the answer you want or need. So far I received exactly the answer I was expecting. 0 examples of NaN!=NaN being benefici

Re: Why is it different about '\s' Matches whitespace and Equivalent to [\t\n\r\f]?

2014-07-10 Thread MRAB
On 2014-07-10 11:05, rxjw...@gmail.com wrote: Hi, On a tutorial it says that '\s': Matches whitespace. Equivalent to [\t\n\r\f]. It's equivalent to [ \t\n\r\f], i.e. it also includes a space, so either the tutorial is wrong, or you didn't look closely enough. :-) I test it with: re.match(r

Re: Question about metacharacter '*'

2014-07-06 Thread MRAB
On 2014-07-06 18:41, Albert-Jan Roskam wrote: In article , Rick Johnson wrote: As an aside i prefer to only utilize a "character set" when nothing else will suffice. And in this case r"[0-9][0-9]*" can be expressed just as correctly (and less noisy IMHO) as r"\d\d*". Even better, r"\d+"

Re: How to write this repeat matching?

2014-07-06 Thread MRAB
On 2014-07-06 19:57, rxjw...@gmail.com wrote: Hi, On Python website, it says that the following match can reach 'abcb' in 6 steps: . A step-by-step example will make this more obvious. Let's consider the expression a[bcd]*b. This matches the letter 'a', zero or more letters from the

Re: What is the difference between matchObj.group() and matchObj.group(0)

2014-07-06 Thread MRAB
On 2014-07-06 19:26, rxjw...@gmail.com wrote: Hi, I cannot get the difference between matchObj.group() and matchObj.group(0), Although there definitions are obvious different. And group() mentions 'tuple'. tuple means all the elements in line object? Match Object Methods Description group(n

Re: Question about metacharacter '*'

2014-07-06 Thread MRAB
On 2014-07-06 13:09, Devin Jeanpierre wrote: On Sun, Jul 6, 2014 at 4:51 AM, wrote: Hi, I just begin to learn Python. I do not see the usefulness of '*' in its description below: The first metacharacter for repeating things that we'll look at is *. * doesn't match the literal character *;

Re: Why is regexp not working?

2014-07-04 Thread MRAB
On 2014-07-04 13:27, Florian Lindner wrote: Hello, I have that piece of code: def _split_block(self, block): cre = [re.compile(r, flags = re.MULTILINE) for r in self.regexps] block = "".join(block) print(block) print("---") for r

Re: OOP with MyTime

2014-07-03 Thread MRAB
On 2014-07-03 13:51, kjaku...@gmail.com wrote: On Wednesday, July 2, 2014 4:02:00 PM UTC-4, MRAB wrote: > If you want 'between' to be an instance method of the MyTime class, it needs 'self' as well as the 2 arguments 't1' and 't2'. You can the

Re: OOP with MyTime

2014-07-02 Thread MRAB
On 2014-07-02 20:20, kjaku...@gmail.com wrote: I'm trying to write a boolean function that takes two Mytime objects, t1 and t2 as arguments, and returns True if the object falls inbetween the two times. This is a question from the How to Think Like a Computer Scientist book, and I need help.

Re: Get named groups from a regular expression

2014-07-01 Thread MRAB
On 2014-07-01 16:12, Florian Lindner wrote: Hello, Is there a way I can extract the named groups from a regular expression? e.g. given "(?P\d)" I want to get something like ["testgrp"]. OR Can I make the match object to return default values for named groups, even if no match was produced? i

Re: fixing an horrific formatted csv file.

2014-07-01 Thread MRAB
On 2014-07-01 15:04, flebber wrote: What I am trying to do is to reformat a csv file into something more usable. currently the file has no headers, multiple lines with varying columns that are not related. This is a sample Meeting,05/07/14,RHIL,Rosehill Gardens,Weights,TAB,+3m Entire Circuit,

Re: Searching for lots of similar strings (filenames) in sqlite3 database

2014-07-01 Thread MRAB
On 2014-07-01 12:26, Adam Funk wrote: I have some code that reads files in a leafnode2 news spool & needs to check for new files periodically. The full paths are all like '/var/spool/news/message.id/345/<123...@example.com>' with a 3-digit subdirectory & a Message-ID for the filename itself. I'

Re: protect psycopg script from sql injection?

2014-06-25 Thread MRAB
On 2014-06-25 22:58, celati Laurent wrote: Hello, I coded this following python script via psycopg; web_service_test.py 1/ When i execute it, the result is 'bad resquest'. Could you tell me why? 2/ Could you tell me how to prot

Re: Format String: Only when value supplied

2014-06-24 Thread MRAB
On 2014-06-24 10:18, Florian Lindner wrote: Hello, I have a format string like: print "{:10} {:25} = {:6} ({})".format(mod, name, value, description) description can be None. In this case I want to print an empty string (which can be achieved by replacing it with 'description or ""') and I

Re: Are there performance concerns with popping from front of long lists vs. the end of long lists?

2014-06-22 Thread MRAB
On 2014-06-22 19:03, pyt...@bdurham.com wrote: Should I have any performance concerns with the index position used to pop() values off of large lists? In other words, should pop(0) and pop() be time equivalent operations with long lists? When an item is popped from a list, all of the later it

Re: Not Responding When Dealing with Large Data

2014-06-19 Thread MRAB
On 2014-06-19 17:21, Peter Pearson wrote: On Thu, 19 Jun 2014 12:25:23 +0100, MRAB wrote: [snip] and then you can say: def myCase(c): if len(c) < 8 or len(c) > 80: return False if c in mySet: return False return True which

Re: Not Responding When Dealing with Large Data

2014-06-19 Thread MRAB
On 2014-06-19 09:17, cutey Love wrote: update_idletasks didn't work. The code is this file_path = filedialog.askopenfilename(filetypes=[('text files', '.txt')], multiple=True, defaultextension=".txt") for path in file_path: fo = open(path, "r") for line in fo:

Re: Python Noob, open file dialog

2014-06-17 Thread MRAB
On 2014-06-17 17:49, cutey Love wrote: My first attempt at Python, I'm using Tkinter and all is going well except when I'm using file_path = tkFileDialog.askopenfilename() print "test" opens great and lets me select a file, the problem is it then pauses? instead of continuing with t

Re: None in string => TypeError?

2014-06-09 Thread MRAB
On 2014-06-09 16:34, Roy Smith wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in ' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False '. F

Re: OT: This Swift thing

2014-06-08 Thread MRAB
On 2014-06-07 17:18, Marko Rauhamaa wrote: Roy Smith : The original MacOS was written in Pascal (both applications and kernel). Being able to touch memory locations or registers requires no more than a few short glue routines written in assembler. Pascal is essentially equivalent to C, except

Re: Automating windows media player on win7

2014-06-07 Thread MRAB
On 2014-06-06 14:39, Deogratius Musiige wrote: Thanks a lot mate. You just made my day. I have looked around the net but cannot find the controls available. I would like to be able to: - get current playing track - get wmplayer state (playing/paused/stopped) - get the selected sound device [s

Re: Automating windows media player on win7

2014-06-04 Thread MRAB
On 2014-06-03 09:10, Deogratius Musiige wrote: Hi guys, I have been fighting with automating wmplayer but with no success. It looks to me that using the .OCX would be the best option. I found the code below on the net but I cannot get it to work. I can see from device manager that a driver is

Re: Binary data exchange

2014-05-29 Thread MRAB
On 2014-05-29 23:08, rasikasriniva...@gmail.com wrote: friends I have a pair of simple python programs as follows: #!/usr/bin/python # broadcast.py import socket from ctypes import * import random class PurgeData(Structure): _fields_ = [("press",c_int), ("ticks",c_int), ("volume",c_float)

Re: PEP 8 : Maximum line Length :

2014-05-15 Thread MRAB
On 2014-05-15 22:50, Terry Reedy wrote: On 5/15/2014 10:42 AM, Chris Angelico wrote: Impossible to say, and one of the perpetual annoyances. Here's a web site that I host: http://gilbertandsullivan.org.au/index.php?option=com_content&view=article&id=92:2001-patience&catid=30:patience&Itemid=10

Re: struct.unpack: why 's' fmt char convert to bytestring

2014-05-15 Thread MRAB
On 2014-05-15 13:34, GuoChao wrote: T he Python documentation gives this same example: record = b'raymond\x32\x12\x08\x01\x08' name, serialnum, school, gradelevel = unpack('<10sHHb', record) but get different results as to 's', don't kn

Re: python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly

2014-05-14 Thread MRAB
On 2014-05-14 19:06, Antoon Pardon wrote: op 14-05-14 18:24, Akira Li schreef: Antoon Pardon writes: This is the code I run (python 3.3) host = ... user = ... passwd = ... from ftplib import FTP ftp = FTP(host, user, passwd) ftp.mkd(b'NewDir') ftp.rmd(b'NewDir') This is the traceback Tra

Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-13 Thread MRAB
On 2014-05-13 20:01, scottca...@gmail.com wrote: On Tuesday, May 13, 2014 9:49:12 AM UTC-4, Steven D'Aprano wrote: You may have missed my follow up post, where I said I had not noticed you were operating on a binary .doc file. If you're not willing or able to use a full-blown doc parser, say b

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-13 Thread MRAB
On 2014-05-13 12:59, Simon Evans wrote: Dear Ian, and other programmers, thank you for your advice. I am resending the last message because this twattish cut and paste facility on my computer has a knack of chopping off ones original message, I will try to convey the right message this time :

Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread MRAB
On 2014-05-13 00:41, Sturla Molden wrote: On 12/05/14 15:42, Sturla Molden wrote: - A one-dimensional NumPy array with dtype np.float64 can keep 16 GB of data before a 32 bit index is too small and Python starts to use long. A two-dimensional NumPy array with dtype np.float64 can keep 256 GB of

Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread MRAB
On 2014-05-12 19:31, Ian Kelly wrote: On Mon, May 12, 2014 at 11:47 AM, alister wrote: On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote: This was *NOT* written by our resident unicode expert http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/ Posted as I thought it would make

Re: Fortran

2014-05-11 Thread MRAB
On 2014-05-12 00:15, Steven D'Aprano wrote: On Sun, 11 May 2014 14:43:19 -0400, Roy Smith wrote: In article , Chris Angelico wrote: Some things are more standardized than others. A piano keyboard is incredibly standard, to make it possible to play without having to look at your fingers (eve

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-11 Thread MRAB
On 2014-05-11 23:03, Simon Evans wrote: I have downloaded Beautiful Soup 3, I am using Python 2.7. I understand from your message that I ought to use Python 2.6 or Python 3.4 with Beautiful Soup 4, the book I am using 'Getting Started with Beautiful Soup' is for Beautiful Soup 4. Therefore I g

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-11 Thread MRAB
On 2014-05-11 21:03, Simon Evans wrote: Dear Chris Angelico, Yes, you are right, I did install Python 3.4 as well as 2.7. I have removed Python 3.4, and input the code you suggested and it looks like it has installed properly, returning the following code:- -

Re: Question on Debugging a code line

2014-05-10 Thread MRAB
On 2014-05-10 20:27, subhabangal...@gmail.com wrote: Dear Room, I was trying to go through a code given in http://en.wikipedia.org/wiki/Forward%E2%80%93backward_algorithm[ Forward Backward is an algorithm of Machine Learning-I am not talking on that I am just trying to figure out a query on it

Re: Values and objects

2014-05-10 Thread MRAB
On 2014-05-10 20:10, Ethan Furman wrote: On 05/10/2014 02:32 AM, Chris Angelico wrote: Tell me, what may this function do in a compliant Python? def demo(): ret = spam spam = 23 return ret In CPython, that'll raise UnboundLocalError, because the local variable 'spam' does alrea

Re: How to implement key of key in python?

2014-05-09 Thread MRAB
On 2014-05-10 02:22, eckhle...@gmail.com wrote: I'm migrating from Perl to Python and unable to identify the equivalent of key of key concept. The following codes run well, import csv attr = {} with open('test.txt','rb') as tsvin: tsvin = csv.reader(tsvin, delimiter='\t') for row i

Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-09 Thread MRAB
On 2014-05-09 20:51, scottca...@gmail.com wrote: Hi, here is a snippet of code that opens a file (fn contains the path\name) and first tried to replace all endash, emdash etc characters with simple dash characters, before doing a search. But the replaces are not having any effect. Obvious

Re: Unicode 7

2014-05-02 Thread MRAB
On 2014-05-02 09:08, Steven D'Aprano wrote: On Thu, 01 May 2014 21:42:21 -0700, Rustom Mody wrote: Whats the best cure for headache? Cut off the head o_O I don't think so. Whats the best cure for Unicode? Ascii Unicode is not a problem to be solved. The inability to write standard h

Re: Unicode 7

2014-05-02 Thread MRAB
On 2014-05-02 03:39, Ben Finney wrote: Rustom Mody writes: Yes, the headaches go a little further back than Unicode. Okay, so can you change your article to reflect the fact that the headaches both pre-date Unicode, and are made much easier by Unicode? There is a certain large old book...

Re: Unicode 7

2014-05-01 Thread MRAB
On 2014-05-01 23:38, Terry Reedy wrote: On 5/1/2014 2:04 PM, Rustom Mody wrote: Since its Unicode-troll time, here's my contribution http://blog.languager.org/2014/04/unicode-and-unix-assumption.html I will not comment on the Unix-assumption part, but I think you go wrong with this: "Unicode

Re: Unicode 7

2014-04-29 Thread MRAB
On 2014-04-29 18:37, wxjmfa...@gmail.com wrote: Let see how Python is ready for the next Unicode version (Unicode 7.0.0.Beta). timeit.repeat("(x*1000 + y)[:-1]", setup="x = 'abc'; y = 'z'") [1.4027834829454946, 1.38714224331963, 1.3822586635296261] timeit.repeat("(x*1000 + y)[:-1]", setup="x

Re: feedparser error

2014-04-26 Thread MRAB
On 2014-04-26 03:16, tad na wrote: python 2.7.2 The following code has an error and I can not figure out why: import feedparser d = feedparser.parse('http://bl.ocks.org/mbostock.rss') numb = len(d['entries']) for post in d.entries: print post.pubDate+"\n" -

Re: possible bug in re expression?

2014-04-25 Thread MRAB
On 2014-04-25 17:55, Chris Angelico wrote: On Sat, Apr 26, 2014 at 2:30 AM, Robin Becker wrote: Whilst translating some javascript code I find that this A=re.compile('.{1,+3}').findall(p) doesn't give any error, but doesn't manage to find the strings in p that I want len(A)==>0, the correct t

Re: len() of unsized object - ks test

2014-04-25 Thread MRAB
On 2014-04-25 15:07, Jamie Mitchell wrote: Hello all, I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a few difficulties. # My files are netCDF so I import them as follows: control=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_c

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread MRAB
On 2014-04-23 21:57, tim.thel...@gmail.com wrote: Hello, I am currently writting a program called subuser(subuser.org), which is written as classically imperative code. Subuser is, essentially, a package manager. It installs and updates programs from repositories. I have a set of source files

Re: Why does isoformat() optionally not print the fractional seconds?

2014-04-22 Thread MRAB
On 2014-04-23 01:05, Travis Griggs wrote: Python(3) let me down today. Better to be explicit, and all that, didn’t pan out for me. I have time series data being recorded in a mongo database (I love pymongo). I have an iOS app that consumes the data. Since JSON doesn’t have a time format, I ha

Re: Why Python 3?

2014-04-20 Thread MRAB
On 2014-04-20 17:22, Ian Kelly wrote: On Apr 19, 2014 2:54 PM, "Chris Angelico" mailto:ros...@gmail.com>> wrote: > > On Sun, Apr 20, 2014 at 6:38 AM, Ian Kelly mailto:ian.g.ke...@gmail.com>> wrote: > >> Or you just cast one of them to float. That way you're sure you're > >> working with floa

Re: How to display chinese character in 65001 in pytohn?

2014-04-09 Thread MRAB
On 2014-04-10 02:54, length power wrote: I am in win7 +python3.3. import os os.system("chcp 936") fh=open("test.ch ","w",encoding="utf-8") fh.write("你") fh.close() os.system("chcp 65001") fh=open("test.ch ","r",encoding="utf-8")

Re: threading

2014-04-09 Thread MRAB
On 2014-04-09 16:51, Rick Johnson wrote: [snip] 3. It irks me that language designers pay no attention to consistency. And the evil incarnation of the IMPLICIT PRONOUN raises it's ugly head!!! The pronoun isn't implicit, because it's actually present! (And it's "its ug

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-07 Thread MRAB
On 2014-04-08 02:33, Mark H Harris wrote: On 4/6/14 12:31 PM, Rustom Mody wrote: I think python wins because it (usually) lets people do their thing (includes but not limited to CS-research) and gets out of the way. To say therefore that it is irrelevant to the research is a strange inversion

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread MRAB
On 2014-04-03 19:23, Ethan Furman wrote: On 04/03/2014 09:02 AM, Lucas Malor wrote: In reply to Ian Kelly: Instead of disabling fallthrough by default, why not disable it all together? I was tempted but there are cases in which it's useful. An example switch day casein ("Monday", "Thursday

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-03-30 Thread MRAB
On 2014-03-30 23:57, Rhodri James wrote: On Sun, 30 Mar 2014 11:44:13 +0100, Steven D'Aprano wrote: On Sun, 30 Mar 2014 00:32:58 -0700, Larry Hudson wrote: Unfortunately, there is no good word for "USA-ian". "United States Citizen" is too long and awkward and "United Statesian" is ridiculou

Re: checking if two things do not equal None

2014-03-30 Thread MRAB
On 2014-03-30 13:21, Roy Smith wrote: In article <5337b4e4$0$29994$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: I think Johannes got it right: boolean logic is easier to reason about when there is a minimum of "not"s. I used to do a lot of digital logic design. In certain l

Re: unicode as valid naming symbols

2014-03-27 Thread MRAB
On 2014-03-27 15:51, Rustom Mody wrote: On Thursday, March 27, 2014 8:58:51 PM UTC+5:30, Mark H. Harris wrote: On 3/25/14 6:58 PM, Steven D'Aprano wrote: > To quote a great Spaniard: > “You keep using that word, I do not think it means what you > think it means.” In~con~thev

Re: unicode as valid naming symbols

2014-03-25 Thread MRAB
On 2014-03-25 22:47, Ethan Furman wrote: On 03/25/2014 12:29 PM, Mark H Harris wrote: On 3/25/14 2:24 PM, MRAB wrote: It's explained in PEP 3131. Basically, a name should to start with a letter (this has been extended to include Chinese characters, etc) or an underscore. λ is a classifi

Re: unicode as valid naming symbols

2014-03-25 Thread MRAB
On 2014-03-25 18:30, Mark H Harris wrote: greetings, I would like to create a lamda as follows: √ = lambda n: sqrt(n) On my keyboard mapping the "problem" character is alt-v which produces the radical symbol. When trying to set the symbol as a name within the name-space gives a syntax error:

Re: loop

2014-03-23 Thread MRAB
On 2014-03-24 00:35, pabloerugg...@gmail.com wrote: Hello, I'm trying to create a for loop that starts at 100 and goes to 10Mllion. The increments are like this: 100, 1000, 1, . Basicaly adding a zero each iteration. I'm having problems trying to do it. Can somebody help me Probably be

Re: Error when installing matplotlib-1.3. on Windows

2014-03-16 Thread MRAB
On 2014-03-17 01:20, laguna...@mail.com wrote: I'm trying to install matplotlib from locally stored source archive file (Portable Python 2.7 on Windows): pip install E:\matplotlib-1.3.1.win32-py2.7.exe Got error, below is log: E:\Portable Python 2.7.5.1\App\Scripts\pip run on 03/17/14 03:10:1

Re: Sharing: File Reader Generator with & w/o Policy

2014-03-15 Thread MRAB
On 2014-03-15 21:38, Mark H Harris wrote: hi folks, I am posting to share a File Reader Generator which I have been playing with, that simplifies reading of text files on-demand: like log files, config files, small record flat data-bases, &c. I have two generators to share, one with & one withou

Re: What does gc.get_objects() return?

2014-03-12 Thread MRAB
On 2014-03-12 19:34, Jurko Gospodnetić wrote: Hi all. I was wondering if someone could explain gc.get_objects() in a bit more detail to me. Does it return a list of 'all objects known to Python'? Only some of them? Which does it return? Which it does not? [snip] gc.is_tracked(...

Re: How is unicode implemented behind the scenes?

2014-03-08 Thread MRAB
On 2014-03-09 02:40, MRAB wrote: On 2014-03-09 02:08, Dan Stromberg wrote: OK, I know that Unicode data is stored in an encoding on disk. But how is it stored in RAM? I realize I shouldn't write code that depends on any relevant implementation details, but knowing some of the more c

Re: How is unicode implemented behind the scenes?

2014-03-08 Thread MRAB
On 2014-03-09 02:08, Dan Stromberg wrote: OK, I know that Unicode data is stored in an encoding on disk. But how is it stored in RAM? I realize I shouldn't write code that depends on any relevant implementation details, but knowing some of the more common implementation options would probably h

Re: How security holes happen

2014-03-06 Thread MRAB
On 2014-03-07 01:53, Mark H. Harris wrote: On Thursday, March 6, 2014 6:28:58 PM UTC-6, Dennis Lee Bieber wrote: The 6502 was NOT a Motorola chip (they had the 6800). The 6502 was MOS That's funny... did you not see what I wrote back to MRAB? Here: The MOS 6502 is to the Mot

Re: How security holes happen

2014-03-05 Thread MRAB
On 2014-03-06 01:24, Mark H. Harris wrote: On Wednesday, March 5, 2014 6:24:52 PM UTC-6, Dennis Lee Bieber wrote: I must have had a deprived life... The only "debug" on a home system I ever used was the one in LS-DOS. And even then, it was only because an OS update disk arrived with a bad secto

Re: Proper conversion of timestamp

2014-03-04 Thread MRAB
On 2014-03-05 02:33, Ben Finney wrote: Igor Korot writes: On Tue, Mar 4, 2014 at 4:42 PM, MRAB wrote: >> But this particular question is easy. >> >> What I have is a timestamp which reads: 1289410678L. >> > That's an integer. It looks like the timestamp is a w

Re: How security holes happen

2014-03-04 Thread MRAB
On 2014-03-05 01:57, Roy Smith wrote: In article , Dennis Lee Bieber wrote: On Wed, 05 Mar 2014 00:48:40 +0200, Marko Rauhamaa declaimed the following: >Ethan Furman : > >> Okay, that looks totally cool. Maybe I'll finally get a handle on >> LISP! :) > >Lisp is conceptually simpler than Py

Re: Origin of 'self'

2014-03-04 Thread MRAB
On 2014-03-05 03:45, Rustom Mody wrote: On Tuesday, March 4, 2014 6:17:09 PM UTC+5:30, MRAB wrote: On 2014-03-04 02:09, Dennis Lee Bieber wrote: > On Sun, 2 Mar 2014 22:16:31 -0800 (PST), Westley Martínez declaimed: >> I understand that in an object method the first argument in the

Re: Proper conversion of timestamp

2014-03-04 Thread MRAB
On 2014-03-04 21:55, Igor Korot wrote: Hi, Mark, On Tue, Mar 4, 2014 at 1:44 PM, Mark Lawrence mailto:breamore...@yahoo.co.uk>> wrote: On 04/03/2014 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() functi

Re: Proper conversion of timestamp

2014-03-04 Thread MRAB
On 2014-03-04 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime object. The first hit of Google gives me this: http://stackoverflow.com/questions/12458595/co

Re: Reference

2014-03-04 Thread MRAB
On 2014-03-04 16:02, Chris Angelico wrote: On Wed, Mar 5, 2014 at 2:42 AM, Steven D'Aprano wrote: # I never know when to stop if bool(flag) is True is True is True is True is True is True: ... The banana problem. Speaking of which: The 'right' way to peel a banana http://www.telegraph.co.u

Re: Origin of 'self'

2014-03-04 Thread MRAB
On 2014-03-04 14:27, Steven D'Aprano wrote: On Tue, 04 Mar 2014 12:47:09 +0000, MRAB wrote: In AppleScript a script can refer to the title of a window as "title of window" or "window's title", and it can refer to the title of its own window as "title of wi

Re: Functional programming

2014-03-04 Thread MRAB
On 2014-03-04 15:13, Chris Angelico wrote: On Wed, Mar 5, 2014 at 1:55 AM, Steven D'Aprano wrote: On Tue, 04 Mar 2014 14:05:44 +, Mark Lawrence wrote: Once a statically typed language has been compiled the programmer can head down to the pub. "It compiles? Quick! Ship it!" Well, that c

Re: Idle thread (Polling) python GUI and saving program state

2014-03-04 Thread MRAB
On 2014-03-04 02:41, Rolando wrote:> On Monday, March 3, 2014 6:06:22 PM UTC-8, MRAB wrote: >> On 2014-03-04 01:33, Rolando wrote: >> > I have a GUI with a bunch of cells which is my "View" in the MVC >> > design. The user enters some information in the

Re: find and replace string in binary file

2014-03-04 Thread MRAB
On 2014-03-04 12:27, loial wrote: How do I read a binary file, find/identify a character string and replace it with another character string and write out to another file? Its the finding of the string in a binary file that I am not clear on. Any help appreciated Read it in chunks and search

Re: Origin of 'self'

2014-03-04 Thread MRAB
On 2014-03-04 02:09, Dennis Lee Bieber wrote: On Sun, 2 Mar 2014 22:16:31 -0800 (PST), Westley Martínez declaimed the following: I understand that in an object method the first argument in the object itself, called self. However, it doesn't have to be called self, and can be called anything.

Re: Idle thread (Polling) python GUI and saving program state

2014-03-03 Thread MRAB
On 2014-03-04 01:33, Rolando wrote: > I have a GUI with a bunch of cells which is my "View" in the MVC > design. The user enters some information in the view and I pass this > on to the model so that using the information entered by the user > it(model) can do some processing. > > I have coded up

Re: Password validation security issue

2014-03-03 Thread MRAB
On 2014-03-03 13:55, Chris Angelico wrote: On Tue, Mar 4, 2014 at 12:41 AM, Roy Smith wrote: I used to work at which had a typical big company IT department which enforced all sorts of annoying pseudo-security rules. As far as I could figure out, however, all you needed to get them to reset an

Re: Boxes of O's

2014-03-01 Thread MRAB
On 2014-03-01 19:28, genius...@gmail.com wrote: Well, This is what i got n = int(input("enter number of o: ")) for i in range(n): print("O", end = '') for j in range(n* 2): print("O", end = '') print() From the examples: The first row has n*2 of 'o' There are n-2

Re: Can global variable be passed into Python function?

2014-02-26 Thread MRAB
On 2014-02-26 10:59, Gregory Ewing wrote: Steven D'Aprano wrote: Standard Pascal? Who uses standard Pascal? I'm talking about MacPascal :-) Mac Pascal used @ for getting a pointer to a variable, if I remember rightly. So did Turbo Pascal. Delphi, which is what Turbo Pascal became, is the sam

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread MRAB
On 2014-02-25 23:14, Ben Finney wrote: MRAB writes: On 2014-02-25 21:27, Ben Finney wrote: > Peter Otten <__pete...@web.de> writes: > >> mauro wrote: >> >> > - Dictionaries and sets are both accessed by key >> >> but sets have no values > &g

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread MRAB
On 2014-02-25 21:27, Ben Finney wrote: Peter Otten <__pete...@web.de> writes: mauro wrote: > - Dictionaries and sets are both accessed by key but sets have no values Or rather, sets *only* have values. Dictionaries have keys, sets do not have keys. But a dictionary can have duplicate valu

Re: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'

2014-02-25 Thread MRAB
On 2014-02-25 17:37, nowebdevmy...@gmail.com wrote: HI, I'm also getting this kind of error. This will show when I do the edit function http://screencast.com/t/hGSbe1vt and this when performing the delete "Error: You have an error in your SQL syntax; check the manual that corresponds to your M

Re: Functions help

2014-02-23 Thread MRAB
On 2014-02-24 03:21, Mark Lawrence wrote: On 24/02/2014 02:55, Benjamin Kaplan wrote: On Sun, Feb 23, 2014 at 5:39 PM, alex23 wrote: On 24/02/2014 11:09 AM, Mark Lawrence wrote: On 24/02/2014 00:55, alex23 wrote: for _ in range(5): func() the obvious indentation error above

Re: Error getting REMOTE_USER Environment Variable

2014-02-21 Thread MRAB
On 2014-02-21 22:48, Hobie Audet wrote: How many other environment variables are doubled? All of them? The only other environment variable I have tried is REMOTE_ADDR, and that does not appear to be doubled. Does the problem exist when the Python script is run directly, outside Abyss, or in

Re: The sum of numbers in a line from a file

2014-02-20 Thread MRAB
On 2014-02-20 18:16, kjaku...@gmail.com wrote: What I've got is def stu_scores(): lines = [] with open("file.txt") as f: lines.extend(f.readlines()) return ("".join(lines[11:])) scores = stu_scores() for line in scores: fields = line.split() name = fields[0]

Re: Error getting REMOTE_USER Environment Variable

2014-02-20 Thread MRAB
On 2014-02-20 14:53, Hobie Audet wrote: I'm running the Abyss Web Server X1 (v 2.9.0.1) on a Windows XP Home (SP3) system and am using Python 3.3 for a scripting language. I'm having a problem getting the environment variable "REMOTE_USER". Here's the situation: 1. I have created a user under

Re: Insert variable into text search string

2014-02-19 Thread MRAB
On 2014-02-19 19:39, Kevin Glover wrote: These two lines are from a program that carries out a phrase search of Wikipedia and returns the total number of times that the specific phrase occurs. It is essential that the search contains an apostrophe: results = w.search("\"of the cat's\"", type=A

Re: Import order question

2014-02-18 Thread MRAB
On 2014-02-18 23:28, Rotwang wrote: On 18/02/2014 21:44, Rick Johnson wrote: [...] Are you telling me you're willing to search through a single file containing 3,734 lines of code (yes, Tkinter) looking for a method named "destroy" of a class named "OptionMenu" (of which three other classes con

Re: Google Cloud Platform and GlassSolver Project

2014-02-18 Thread MRAB
On 2014-02-18 03:09, Chris Angelico wrote: On Tue, Feb 18, 2014 at 1:52 PM, Steven D'Aprano wrote: On Mon, 17 Feb 2014 16:57:34 -0800, Physics wrote: Does ANYONE have a clue how to do this? I understand that it is hard but geez... Absolutely no clue what your question is. You seem to assum

Re: How to turn a package into something pip can install

2014-02-16 Thread MRAB
On 2014-02-16 15:06, Mark Lawrence wrote: On 16/02/2014 14:25, Roy Smith wrote: We tend not to upgrade stuff unless there's a good reason to. You never know what will break (looking furtively in the direction of the Python 3.x mafiosi). Yeah, those really unpleasant, nasty, horrible mafiosi

<    12   13   14   15   16   17   18   19   20   21   >