Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread Tim Chase
> If you think that people can routinely detect infinite loops, then > perhaps you would care to tell me whether this is an infinite loop or not: > > i = 1 > while not is_perfect(i): > i += 2 > print "odd perfect number discovered" > > > where is_perfect() returns True if the integer argume

Re: Encapsulation, inheritance and polymorphism

2012-07-19 Thread Tim Chase
On 07/19/12 13:28, Chris Angelico wrote: > On Fri, Jul 20, 2012 at 4:20 AM, Tim Chase > wrote: >> Sure it terminates...If you don't run out of RAM to represent the >> number "i" in question, there's also this "heat death of the >> universe" l

Re: help

2012-07-19 Thread Tim Chase
On 07/19/12 17:31, Miriam Gomez Rios wrote: > Hello, sorry for bothering you, but I have a doubt, > > Is there a way to turn this string into a tuplelist??, I > need it for gurobi > > ('per1','persona1.1','pro1'),('per1','persona1.1','pro2'),('per1','persona1.1','pro3'),...,('per2','persona2.

Re: help

2012-07-19 Thread Tim Chase
On 07/19/12 18:26, Prasad, Ramit wrote: >> ('per1','persona1.1','pro1'),('per1','persona1.1','pro2'),('per1','persona1.1','pro3'),('per1','persona1.1','pro4'),('per1','persona1.1','pro5'),('per2','persona2.1','pro1'),('per2','persona2.1','pro2'),('per2','persona2.1','pro3'),('per2','persona2.1','pr

Re: help

2012-07-19 Thread Tim Chase
On 07/19/12 19:32, Miriam Gomez Rios wrote: s = "('per1','persona1.1','pro1'),('per1','persona1.1','pro2')" >> resulting_tuple_of_tuples = ast.literal_eval(s) > > Traceback (most recent call last): > File "C:\Users\Miriam\scripts\prueba_datos", line 124, in > print resulting_tuple.s

[OT] git and hg in prompt (was: My first ever Python program, comments welcome)

2012-07-24 Thread Tim Delaney
27; -e '/^[^+-]/d' -e 's/+-/*/'`" echo "[${tracking}${uptodate}${branch}:${head}] " return 0 fi return 1 } function git_hg_ps1() { git_ps1 if [ $? -eq 0 ] ; then return 0 fi hg_ps1 return $? } export PS1='$(g

Re: append in IMAP4 from imaplib very slow

2012-07-25 Thread Tim Chase
On 07/25/12 12:47, Simon Pirschel wrote: > I'm currently experimenting with IMAP using Python 2.7.3 and > IMAP4 from imaplib. I noticed the performance to be very bad. I > read 5000 files from a directory and append them to an IMAP > INBOX. The hole procedure of reading and appending is taking > ab

Re: OT: Text editors (was Re: Search and replace text in XML file?)

2012-07-28 Thread Tim Chase
On Sat, Jul 28, 2012 at 6:29 PM, Mark Lawrence wrote: > I highly recommend the use of notepad++. If anyone knows of a > better text editor for Windows please let me know :) I'll advocate for Vim which is crazy-powerful and works nicely on just about any platform I touch. Others will advocate for

Re: Search and replace text in XML file?

2012-07-28 Thread Tim Roberts
or substitution should have been able to do this in two seconds. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Text editors

2012-07-29 Thread Tim Chase
On 07/29/12 05:28, Mark Lawrence wrote: > On 29/07/2012 06:08, Ben Finney wrote: >> Tim Chase writes: >> Learn one of Emacs or Vim well, and you won't need to worry >> about text editors again. > > Point taken, snag being I've never used any nix box in ang

Re: Is Python a commercial proposition ?

2012-07-29 Thread Tim Chase
On 07/29/12 12:13, Michael Hrivnak wrote: > - Operating system installer: http://fedoraproject.org/wiki/Anaconda > - Software repository management: http://pulpproject.org/ > - Software package installation: > http://en.wikipedia.org/wiki/Ubuntu_Software_Center > - Cloud computing: http://en.wikipe

Re: Is Python a commercial proposition ?

2012-07-30 Thread Tim Chase
On 07/29/12 21:31, Rodrick Brown wrote: > Its still not possible to be a pure Python developer and find > gainful employment today. I'm not sure where you get your facts, but unless you define "pure" in a super-narrow way, it's just flat-out wrong. I've been employed doing primarily Python for th

OT: accessibility (was "Re: simplified Python parsing question")

2012-07-30 Thread Tim Chase
On 07/30/12 21:11, Eric S. Johansson wrote: > the ability for multiple people to work on the same document at > the same time is really important. Can't do that with Word or > Libre office. revision tracking in traditional word processors > are unpleasant to work with especially if your hands a

Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString()

2012-08-02 Thread Tim Golden
On 02/08/2012 09:57, rahul wrote: > I am implementing a C extension module, during this I saw that when I > set the global error indicator and error message through > PyErr_SetString() API and return false. > > But it doesn't throw any error when I tried to check the error > through sys.exc_info()

Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString()

2012-08-02 Thread Tim Golden
On 02/08/2012 10:21, rahul wrote: > > Hi TJG, > > The above link also doesn't strictly said that return value should be > NULL only, it only said that usually NULL pointer used. No where I > saw that it is nessasory t > > At http://docs.python.org/c-api/exceptions.html. it is written that > "Mos

Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString()

2012-08-02 Thread Tim Golden
On 02/08/2012 10:50, rahul wrote: > When I use same code base for Python 3.x, then behavior is different. In this > when I return false then also it throws exception but only when any other > statement get executed after this > > like below code: > ... > ... >b = None >try: > a =

Re: dbf.py API question

2012-08-03 Thread Tim Chase
On 08/03/12 08:11, Ethan Furman wrote: > So far all feedback is for the flag, so that's what I'll do. I agree with the flag, though would also be reasonably content with using None for the filename to indicate in-memory rather than on-disk storage. -tkc -- http://mail.python.org/mailman/list

Re: when an iterable object is exhausted or not

2012-08-04 Thread Tim Roberts
esting that it DOESN'T happen in Python 2. The first "i" is of type list, the second "i" is of type string, and both are restartable. What's the type of "i" in the second case in Python 3? -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: On-topic: alternate Python implementations

2012-08-04 Thread Tim Roberts
ramework. IronPython is written in C#. It generates code that runs in the .NET Framework. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: when an iterable object is exhausted or not

2012-08-04 Thread Tim Chase
On 08/04/12 14:20, Franck Ditter wrote: > Two similar iterable objects but with a different behavior : > > $$$ i = range(2,5) > $$$ for x in i : print(x,end=' ') > > 2 3 4 > $$$ for x in i : print(x,end=' ')# i is not exhausted > > 2 3 4 > > - Compare with : > > $$$ i = fi

Re: Intermediate Python user needed help

2012-08-05 Thread Tim Chase
On 08/05/12 15:52, John Mordecai Dildy wrote: > Current Problem at the moment > > Traceback (most recent call last): > File "ex26.py", line 66, in > beans, jars, crates = secret_formula(start-point) > NameError: name 'start' is not defined > > anyone know how to make start defined "start-

Re: Intermediate Python user needed help

2012-08-05 Thread Tim Chase
On 08/05/12 17:00, John Mordecai Dildy wrote: > since when did we start talking about lisp? Though not a lisper, the Python tie-in was my reply: Python (among many other languages) doesn't allow a "-" as a character in identifiers as you appeared to use it in your code. Unlike HTML, XML, CSS, an

Re: Intermediate Python user needed help

2012-08-05 Thread Tim Chase
On 08/05/12 16:32, Roy Smith wrote: > Tim Chase wrote: >> You either mean something like "start_point" (with an underscore >> instead of a minus), or you're performing a subtraction of "start >> minus point", in which case you'd have to ass

Re: Intermediate Python user needed help

2012-08-05 Thread Tim Chase
On 08/05/12 20:15, Dennis Lee Bieber wrote: > On Sun, 05 Aug 2012 19:32:26 -0400, Roy Smith declaimed >>> Though not a lisper, the Python tie-in was my reply: Python (among >>> many other languages) doesn't allow a "-" as a character in >>> identifiers as you appeared to use it in your code. Unl

Re: save dictionary to a file without brackets.

2012-08-09 Thread Tim Chase
On 08/09/12 15:22, Roman Vashkevich wrote: >> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2} >> and i want to print to a file without the brackets comas and semicolon in >> order to obtain something like this? >> 4 5 1 >> 5 4 1 >> 4 4 2 >> 2 3 1 >> 4 3 2 > > for key in dict: > prin

Re: save dictionary to a file without brackets.

2012-08-09 Thread Tim Chase
On 08/09/12 15:41, Roman Vashkevich wrote: > 10.08.2012, в 0:35, Tim Chase написал(а): >> On 08/09/12 15:22, Roman Vashkevich wrote: >>>> {(4, 5): 1, (5, 4): 1, (4, 4): 2, (2, 3): 1, (4, 3): 2} >>>> and i want to print to a file without the brackets comas and s

Re: save dictionary to a file without brackets.

2012-08-09 Thread Tim Chase
On 08/09/12 17:26, Dave Angel wrote: > On 08/09/2012 06:03 PM, Andrew Cooper wrote: > I'm glad you're wrong for CPython's dictionaries. The only time the > lookup would degenerate to O[n] would be if the hash table had only one > slot. CPython sensibly increases the hash table size when it become

Re: save dictionary to a file without brackets.

2012-08-09 Thread Tim Chase
On 08/09/12 18:33, Mark Lawrence wrote: > On 10/08/2012 00:24, Roy Smith wrote: >>> ... you mean, Python lets you make a hash of it? >> >> Only if you order it with spam, spam, spam, spam, spam, spam, and spam. > > Now now gentlemen we're getting slightly off topic here and wouldn't > want to ups

Re: Unable to execute the script

2012-08-10 Thread Tim Chase
On 08/10/12 13:38, Dave Angel wrote: > On 08/10/2012 01:14 PM, Smaran Harihar wrote: >> Hi, >> >> I have set executable permissions for my py script (cgi-script) but for >> some reason rather than executing it, the browser simply downloads the py >> script. >> >> Here is the >> link

Re: Unable to execute the script

2012-08-10 Thread Tim Chase
On 08/10/12 14:14, Smaran Harihar wrote: > If you mean chmod +x > > then yes it has been set. I'm not sure how Ubuntu defaults if you don't specify *who* should receive those +x permissions. I'd make sure they've been set for everybody: $ chmod ugo+x myfile.py You can check this by doing an

Re: Running Python web apps on shared ASO servers?

2012-08-12 Thread Tim Golden
On 12/08/2012 21:52, Gilles wrote: On Sun, 12 Aug 2012 07:56:26 +0200, Dieter Maurer wrote: You should probably read the mentioned forum resources to learn details about the Python support provided by your web site hoster. Yup, but so far, no answer, so I figured someone here might now. Thos

Re: dbf.py API question concerning Index.index_search()

2012-08-15 Thread Tim Chase
On 08/15/12 18:26, Ethan Furman wrote: >.index_search( > match, > start=None, > stop=None, > nearest=False, > partial=False ) > > The defaults are to search the entire index for exact matches and raise > NotFoundError if it can't find anything. > > The question i

Re: dbf.py API question concerning Index.index_search()

2012-08-15 Thread Tim Chase
On 08/15/12 19:21, Ethan Furman wrote: > The well-hidden clue was this line: > > nearest returns where the match should be instead of raising an error > > And my question should have been: > >What should the return value be when nearest == True? Ah, well that's somewhat clearer. Return the

Re: asking

2012-08-22 Thread Tim Chase
On 08/22/12 04:42, alex23 wrote: > On 08/22/2012 03:17 AM, mingqiang hu wrote: >> I mean any of "a","b","c" in string "adfbdfc" makes the statement true,can >> I not use a function? > > any(map(string.__contains__, substrings)) As map()/reduce() vs. list-comprehension discussions are going on in

calling loaded DLL function expecting POINT * argument

2012-08-24 Thread Tim Williams
Hello all, I'm trying to use the ctypes module to call functions in a DLL. I've figured out how to modify my path so the library is found, and I can call LoadLibrary on it, but one of the functions expects an array of POINTS. Here is the prototype from the .h file: TRACKER_API HRESULT Initial

fabric problem with ssh

2012-08-24 Thread Tim Arnold
.7.3 (default, Aug 22 2012, 13:09:20) [GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2 thanks, --Tim Arnold -- http://mail.python.org/mailman/listinfo/python-list

Re: Filter versus comprehension (was Re: something about split()???)

2012-08-25 Thread Tim Golden
On 25/08/2012 13:57, David Robinow wrote: On Fri, Aug 24, 2012 at 3:03 PM, Walter Hurry wrote: On Fri, 24 Aug 2012 14:29:00 -0400, Dennis Lee Bieber wrote: It appears to be a change Google made in the last month or two... My hypothesis is that they are replacing hard EOL found in inbound NNTP

Re: calling loaded DLL function expecting POINT * argument

2012-08-26 Thread Tim Roberts
Tim Williams wrote: >Hello all, > >I'm trying to use the ctypes module to call functions in a DLL. I've >figured out how to modify my path so the library is found, and I can >call LoadLibrary on it, but one of the functions expects an array of > POINTS. Here is th

Python list archives double-gzipped?

2012-08-26 Thread Tim Chase
Playing around with the mbox module, I reached into the archives[1] to grab some real-world data files[2]. To successfully unpack the contents to an mbox file, I had to do the following: bash$ gunzip 2012-July.txt.gz bash$ mv 2012-July.txt 2012-July.txt.gz bash$ gunzip 2012-July.txt.gz So

Re: Extract Text Table From File

2012-08-27 Thread Tim Chase
On 08/27/12 04:53, Huso wrote: > Below is just ONE block of the traffic i have in the log files. There will be > more in them with different data. > > ROUTES TRAFFIC RESULTS, LSR > TRG MP DATE TIME > 37 17 120824 > > R TRAFF NBIDS CCONG NDV ANBLO MHTIME NBANSW > A

Re: Python list archives double-gzipped?

2012-08-27 Thread Tim Chase
On 08/27/12 08:52, Andreas Perstinger wrote: > On 27.08.2012 03:40, Tim Chase wrote: >> So it looks like some python-list@ archiving process is double >> gzip'ing the archives. Can anybody else confirm this and get the >> info the right people? > > If you send the

Re: Python list archives double-gzipped?

2012-08-27 Thread Tim Chase
On 08/27/12 12:21, Ned Deily wrote: > In article <[email protected]>, Tim Chase > wrote: >> To whomever controls the python.org web-server, is it possible >> to tweak Apache so that it doesn't try to gzip *.gz files? It >> may ameliorate th

popen4 - get exit status

2012-08-27 Thread Tim Johnson
In bash I do the following: linus:journal tim$ /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl hiccup -bash: /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl: No such file or directory linus:journal tim$ echo $? 127 In python, use os.popen4 I do the following: >>> fin,fout = os.pope

Re: popen4 - get exit status

2012-08-27 Thread Tim Johnson
ortable between linux->python 2.4 and darwin->python 2.7 thanks -- Tim tim at tee jay forty nine dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list

Re: popen4 - get exit status

2012-08-27 Thread Tim Johnson
* Dave Angel [120827 15:20]: > On 08/27/2012 06:39 PM, Tim Johnson wrote: > > In bash I do the following: > > linus:journal tim$ /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl hiccup > > -bash: /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl: No such file or > >

Re: popen4 - get exit status

2012-08-28 Thread Tim Johnson
* Dennis Lee Bieber [120828 07:11]: > On Mon, 27 Aug 2012 15:43:59 -0800, Tim Johnson > declaimed the following in gmane.comp.python.general: > > > * Benjamin Kaplan [120827 15:20]: > > > The popen* functions are deprecated. You should use the subprocess module >

Re: Sending USB commands with Python

2012-08-28 Thread Tim Roberts
aries can be used to talk to USB devices. There is a Python binding. On Windows, you still need to have a driver, but the libusbx instructions can help you find an install one. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

mailbox.mbox Status/X-Status flags RFC?

2012-08-30 Thread Tim Chase
Playing around with mailbox.mbox, I noticed the flag get split across Status/X-Status headers. I dug into the source and read at [1] to see the *how* but I'm curious as to the *why*. When I pulled up RFC-4155[2] (mbox), it didn't seem to mention anything about the Status/X-Status stuff, and the M

Re: Sending USB commands with Python

2012-08-30 Thread Tim Roberts
sb_setup_async] invalid >endpoint 0x02\n' USB endponts only go in one direction. There will be one endpoint for outoging data, and one endpoint for incoming data. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: thanks! (was "Test message - please ignore")

2012-08-31 Thread Tim Chase
On 08/31/12 09:15, Skip Montanaro wrote: > We just upgraded the Mailman installation on mail.python.org. Part of that > installation includes spam filtering on messages gated from Usenet to the > python- > [email protected] mailing list. This message is a quick test of that function. > > You c

Re: how to get character hex number?

2012-08-31 Thread Tim Chase
On 08/31/12 21:21, contro opinion wrote: for i in "english" : > ... print(hex((ord(i > ... > 0x65 > 0x6e > 0x67 > 0x6c > 0x69 > 0x73 > 0x68 u"english".encode("utf-8") > 'english' u"english".encode("ascii") > 'english' > > how can i get 656e676c697368 in encode method? At leas

Re: how to get character hex number?

2012-08-31 Thread Tim Chase
On 08/31/12 22:41, contro opinion wrote: >> u"english".encode("utf-8") >>> 'english' >> u"english".encode("ascii") >>> 'english' >>> >>> how can i get 656e676c697368 in encode method? >> >> At least in 2.x, you can do: >> >> >>> u"english".encode("hex") >> '656e676c697368' > > how about i

Re: how to get character hex number?

2012-09-01 Thread Tim Chase
On 09/01/12 03:49, Mark Lawrence wrote: > On 01/09/2012 04:50, Tim Chase wrote: >> Well, in 3.1.3 at least, using the u"..." notation dies on me with >> an invalid syntax. > > The u"..." notation has been reintroducd for Python 3.3 Nice to know--it makes

Re: calling loaded DLL function expecting POINT * argument

2012-09-04 Thread Tim Williams
On Sunday, August 26, 2012 9:23:49 PM UTC-4, Tim Roberts wrote: > Tim Williams wrote: > > > > >Hello all, > > > > > >I'm trying to use the ctypes module to call functions in a DLL. I've > > >figured out how to modify my path so the li

Re: calling loaded DLL function expecting POINT * argument

2012-09-04 Thread Tim Williams
On Tuesday, September 4, 2012 8:16:33 AM UTC-4, Tim Williams wrote: > On Sunday, August 26, 2012 9:23:49 PM UTC-4, Tim Roberts wrote: > > > Tim Williams wrote: > > > > > > > > > > > > >Hello all, > > > > > > > &g

Re: Extract Text Table From File

2012-09-05 Thread Tim Chase
[trimming out a bunch of superfluous text so the thread is actually readable] On 09/05/12 08:08, Ramchandra Apte wrote: > On Monday, 27 August 2012 15:42:14 UTC+5:30, Laszlo Nagy wrote: >> On 2012-08-27 11:53, Huso wrote: >>> I am trying to extract some text table data from a log file >> >> fin =

Re: is implemented with id ?

2012-09-05 Thread Tim Chase
On 09/05/12 08:46, Dave Angel wrote: > It's id() which is superfluous. But it's useful for debugging, > and for understanding. While I assiduously work to eschew shadowing most built-in names such as "list" or "str", I do make an exception for "id" because it's *so* useful in code, and the built-

Re: The opener parameter of Python 3 open() built-in

2012-09-05 Thread Tim Delaney
gt; that there is more risk of breakage just because one function is called > from a thread. > > Obviously monkey-patching the builtin module itself is much riskier, > because it doesn't just effect code in my module, it affects *everything*. It's not as though the op

Re: Accessing dll

2012-09-06 Thread Tim Williams
On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > I am a complete novice to Python. I wish to access a dll that has > > been written to be compatible with C and VB6. I have been told that > > after running Python I should enter "from ctypes import *" which > > allows P

Re: Accessing dll

2012-09-06 Thread Tim Williams
On Thursday, September 6, 2012 4:21:56 PM UTC-4, Tim Williams wrote: > On Thursday, September 6, 2012 11:07:07 AM UTC-4, Helpful person wrote: > > > I am a complete novice to Python. I wish to access a dll that has > > > > > > been written to be compatible wit

Re: simple client data base

2012-09-09 Thread Tim Chase
On 09/08/12 14:47, Mark R Rivet wrote: > Well I have to say that this is most discouraging. I should give > up learning to program. I don't have a chance at all. Thanks. I think the intent is not to deter you from learning to program, but rather to urge you in a direction less fraught with peril.

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-09-11 Thread Tim Golden
On 11/09/2012 04:46, Steven D'Aprano wrote: > On Mon, 10 Sep 2012 15:22:05 -0700, ruck wrote: > >> On Monday, September 10, 2012 1:16:13 PM UTC-7, Steven D'Aprano wrote: > [...] >>> That's not so much a workaround as the officially supported API for >>> dealing with the situation you are in. Why d

Re: Single leading dash in member variable names?

2012-09-12 Thread Tim Chase
On 09/12/12 00:10, Dwight Hutto wrote: > Not to jump in with another question(this seems somewhat relevant > to the conversation, maybe not), but is this similar to a > private,public, or protected class similar to the C type langs? Close, but C-like languages tend to strictly enforce it, while in

Re: Boolean function on variable-length lists

2012-09-12 Thread Tim Chase
On 09/12/12 08:02, Jussi Piitulainen wrote: > Libra writes: >> For example, I may have a list L = [1, 2, 3, 4] and the following >> constraints: >> L[0] >= 1 >> L[1] <= 3 >> L[2] == 2 >> L[3] >= 3 > > So you would associate each constraint with an index. You could > maintain a list of constraints

Re: avoid the redefinition of a function

2012-09-12 Thread Tim Chase
On 09/12/12 11:56, Jabba Laci wrote: >> For example: >> >> def install_java(): >>pass >> >> def install_tomcat(): >>pass > > Thanks for the answers. I decided to use numbers in the name of the > functions to facilitate function calls. Now if you have this menu > option for instance: > > (

Re: avoid the redefinition of a function

2012-09-12 Thread Tim Chase
On 09/12/12 16:47, D'Arcy Cain wrote: > On Wed, 12 Sep 2012 16:37:11 -0400 > Terry Reedy wrote: >> assures one that the test is being run. (I don't always test first, but >> I once discovered a test not being run when I modified it in a way that >> should have made it fail, but it didn't.) > >

Python2.4 on Win32 suddenly started crashing last night

2012-09-13 Thread Tim Chase
I'm not sure if this is some Win32 update that was silently applied by our netadmin, but when I simply "import socket" at the command line, it's crashing (with the "Do you want to send this information to Microsoft" debug/crash dialog). It was working as of last night, and to the best of my knowle

Re: Python2.4 on Win32 suddenly started crashing last night

2012-09-13 Thread Tim Chase
On 09/13/12 07:42, Tim Chase wrote: > It was working as of last night, and to the best of my knowledge, > nothing was changed on the system. It took a while to track it > down, but it came from importing smtplib which in turn imports socket. > > I've tried "import so

Re: Python2.4 on Win32 suddenly started crashing last night

2012-09-13 Thread Tim Chase
On 09/13/12 08:12, MRAB wrote: > I've just downloaded, installed and tested Python 2.4.4. No crash. > > This is with Windows XP Pro (32-bit). Could I get the MD5 of your $PYTHONDIR\DLLs\_socket.pyd to see if it matches mine? >>> data = file('_socket.pyd', 'rb').read() >>> import md5 >>> md5.md5(

Re: [SOLVED] Python2.4 on Win32 suddenly started crashing last night

2012-09-13 Thread Tim Chase
On 09/13/12 08:51, MRAB wrote: > I get this: > > Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> data = file(r'C:\Python24\DLLs\_socket.pyd', 'rb').read() > >>> import md5 > >>> md5.

Least-lossy string.encode to us-ascii?

2012-09-13 Thread Tim Chase
I've got a bunch of text in Portuguese and to transmit them, need to have them in us-ascii (7-bit). I'd like to keep as much information as possible, just stripping accents, cedillas, tildes, etc. So "serviço móvil" becomes "servico movil". Is there anything stock that I've missed? I can do mys

Re: [SOLVED] Least-lossy string.encode to us-ascii?

2012-09-13 Thread Tim Chase
On 09/13/12 16:44, Vlastimil Brom wrote: > >>> import unicodedata > >>> unicodedata.normalize("NFD", u"serviço móvil").encode("ascii", > >>> "ignore").decode("ascii") > u'servico movil' Works well for all the test-cases I threw at it. Thanks! -tkc -- http://mail.python.org/mailman/listinfo/p

Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Tim Chase
On 09/13/12 18:36, Terry Reedy wrote: > On 9/13/2012 5:26 PM, Tim Chase wrote: >> I've got a bunch of text in Portuguese and to transmit them, need to >> have them in us-ascii (7-bit). I'd like to keep as much information >> as possible,just stripping accents, cedil

Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Tim Chase
On 09/13/12 21:09, Mark Tolonen wrote: > On Thursday, September 13, 2012 4:53:13 PM UTC-7, Tim Chase wrote: >> Vlastimil's solution kept the characters but stripped them of their >> accents/tildes/cedillas/etc, doing just what I wanted, all using the >> stdlib. H

Re: Decorators not worth the effort

2012-09-14 Thread Tim Chase
On 09/14/12 07:01, Steven D'Aprano wrote: > [snip timeout class] > > Holy over-engineering Batman!!! > > No wonder you don't think much of decorators, [snip] > Most of my decorator functions are under a dozen lines. And that's the > complicated ones! As are mine, and a sizable chunk of those

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Tim Roberts
sys.exit( {'Cope':1,'Perform':2}.get(sR,3) ) The best way to convert a batch file to Python is to convert the whole file to a Python script. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-19 Thread Tim Roberts
nts ( 3/4 string arguments, containing whitespaces like spaces, etc ) >to a python script, remote.py running on 'remote' (the remote machine). You haven't provided very many details, so it's possible ssh is the low-impact solution, but don't discard the possibility of usi

Re: technologies synergistic with Python

2012-09-21 Thread Tim Chase
On 09/21/12 17:33, Rodrick Brown wrote: >> What is the consensus... okay, okay -- what are some wide >> ranging opinions on technologies that I should know if my dream >> job is one that consists mostly of Python, and might allow >> telecommuting? > > Django, JavaScript, HTML 5, JQuery, , SQL, Red

Re: How to limit CPU usage in Python

2012-09-22 Thread Tim Roberts
You will not find generic mechanisms wrapping them. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exact integer-valued floats

2012-09-22 Thread Tim Roberts
Control Data 6000/Cyber series had sign bit and 11-bit exponent, with either a 48-bit mantissa or a 96-bit mantissa, packed into one or two 60-bit words. Values were not automatically normalized, so there was no assumed 1 bit, as in IEEE-754. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exact integer-valued floats

2012-09-22 Thread Tim Roberts
for top-posting. My Xoom makes bottom-posting awkward. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. Dave Angel wrote: On 09/22/2012 05:05 PM, Tim Roberts wrote: > Dennis Lee Bieber wrote: >> On 22 Sep 2012 01:36:59 GMT, Steven D'Aprano wrote: >>> For

Re: Capitalization for variable that holds a class

2012-09-23 Thread Tim Chase
On 09/23/12 11:12, Chris Angelico wrote: > On Mon, Sep 24, 2012 at 1:48 AM, Joshua Landau > wrote: >> Simple question: >> >> [myClass() for myClass in myClasses] >> vs >> [MyClass() for MyClass in myClasses] > > Since there's no difference between a "class" and a "variable > containing a class" or

Re: For Counter Variable

2012-09-23 Thread Tim Chase
On 09/23/12 17:54, Steven D'Aprano wrote: > On Sun, 23 Sep 2012 10:45:53 -0700, jimbo1qaz wrote: >> On Sunday, September 23, 2012 9:36:19 AM UTC-7, jimbo1qaz wrote: >>> Am I missing something obvious, or do I have to manually put in a >>> counter in the for loops? That's a very basic request, but I

Re: For Counter Variable

2012-09-23 Thread Tim Chase
On 09/23/12 18:52, Alec Taylor wrote: > You can always use a counter if you don't like our fancy for-each loops; > > foolist = [1,24,24,234,23,423,4] > for i in xrange(len(foolist)): > print foolist[i] http://www.seas.upenn.edu/~lignos/py_antipatterns.html The first one on the list of anti-p

Re: Memory usage per top 10x usage per heapy

2012-09-24 Thread Tim Chase
On 09/24/12 16:59, MrsEntity wrote: > I'm working on some code that parses a 500kb, 2M line file line > by line and saves, per line, some derived strings into various > data structures. I thus expect that memory use should > monotonically increase. Currently, the program is taking up so > much memo

Re: How to limit CPU usage in Python

2012-09-24 Thread Tim Roberts
Paul Rubin wrote: > >Tim Roberts: reasons to want to do this might involve a shared host >where excessive cpu usage affects other users; That's what priorities are for. >...or a computer with >limited power consumption, where prolonged high cpu activity causes >thermal or

Re: Who's laughing at my responses, and who's not?

2012-09-24 Thread Tim Roberts
ds of thousands of people reading this forum. A few of those people probably don't like you. So what? Illegitemi non carborondum -- don't let the bastards wear you down. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Tim Chase
On 09/24/12 23:41, Dennis Lee Bieber wrote: > On Mon, 24 Sep 2012 14:59:47 -0700 (PDT), MrsEntity > declaimed the following in > gmane.comp.python.general: > >> Hi all, >> >> I'm working on some code that parses a 500kb, 2M line file line by line and >> saves, per line, some derived strings > >

Re: For Counter Variable

2012-09-25 Thread Tim Chase
On 09/25/12 00:53, Thomas Rachel wrote: > Am 25.09.2012 01:39 schrieb Dwight Hutto: >> You don't always know all the built-ins, so the builtin is >> simpler, but knowing how to code it yourself is the priority of >> learning to code in a higher level language, which should be >> simpler to the user

Re: gracious responses (was: Memory usage per top 10x usage per heapy)

2012-09-25 Thread Tim Chase
On 09/25/12 06:10, Mark Lawrence wrote: > On 25/09/2012 11:51, Tim Chase wrote: >> If only other unnamed persons on the list were so gracious rather >> than turning the flame-dial to 11. >> > > Oh heck what have I said this time? You'd *like* to take credit?

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Tim Chase
On 09/25/12 16:17, Oscar Benjamin wrote: > I don't know whether it would be better or worse but it might be > worth seeing what happens if you replace the FileContext objects > with tuples. If tuples provide a savings but you find them opaque, you might also consider named-tuples for clarity. -tk

Re: Memory usage per top 10x usage per heapy

2012-09-25 Thread Tim Chase
On 09/25/12 17:55, Oscar Benjamin wrote: > On 25 September 2012 23:10, Tim Chase wrote: >> If tuples provide a savings but you find them opaque, you might also >> consider named-tuples for clarity. > > Do they have the same memory usage? > > Since tuples don't h

Re: using "*" to make a list of lists with repeated (and independent) elements

2012-09-26 Thread Tim Chase
On 09/26/12 17:28, 8 Dihedral wrote: > 8 Dihedral於 2012年9月27日星期四UTC+8上午6時07分35秒寫道: In these conditions, how to make this list [[0,0,0],[0,0,0]] with "*" without this behavior? >>> >>> a = [[0]*3 for i in xrange(2)] >>> >>> a[0][0]=2 >>> >>> a >>> [[2, 0, 0], [0, 0

Ordering of mailbox.mbox contents?

2012-09-27 Thread Tim Chase
Reading through the docs[1] and the source, I'm trying to discern if there's any guarantee that the contents of a mbox file remain in a consistent ordering across add/delete calls. As best I can tell from the source, it _looks_ like the code keeps an existing file in the same order, deletions remo

Re: howto handle nested for

2012-09-28 Thread Tim Chase
On 09/28/12 09:39, Neal Becker wrote: > I know this should be a fairly basic question, but I'm drawing a blank. > > I have code that looks like: > > for s0 in xrange (n_syms): > for s1 in xrange (n_syms): > for s2 in xrange (n_syms): > for s3 in xrange (n_sy

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 19:31, iMath wrote: > write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Okay, that was pretty easy. Thanks for the challenge :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 20:58, Mark Lawrence wrote: > On 29/09/2012 02:35, Tim Chase wrote: >> On 09/28/12 19:31, iMath wrote: >>> write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. >> >> Okay, that was pretty easy. Thanks for the challenge :-) > >

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 22:25, Ian Kelly wrote: > On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase >>>> On 09/28/12 19:31, iMath wrote: >>>>> write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. >> >> r = re.compile( >> "800-5

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 22:30, Steven D'Aprano wrote: > On Fri, 28 Sep 2012 21:25:35 -0600, Ian Kelly wrote: > >> Mine is simpler and faster. >> >> r = re.compile("") > > The OP doesn't say that you have to compile it, so just: > > '' > > wins. OP doesn't say it even has to be a string, so I guess wins

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-29 Thread Tim Delaney
miter, but it was voted down as "not Pythonic" enough. I'm sure they were using that as a euphamism for "Python*ish*" though. [1] https://en.wikipedia.org/wiki/Inland_Taipan [2] It's is so pretty: https://upload.wikimedia.org/wikipedia/commons/f/fe/Fierce_Snake-Oxyuranus_microlepidotus.jpg Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >