Re: How to search this newsgroup by a python script.

2009-07-16 Thread Chris Rebert
On Thu, Jul 16, 2009 at 2:12 AM, Helmut Jarauschjarau...@igpm.rwth-aachen.de wrote: Hi, I haven't found anything with Google's group search, so let me ask it (again?). How can I search this newsgroup from within a Python script. (Perhaps by searching Google Groups or Gmane by some Python

Re: TypeError: unbound method

2009-07-16 Thread Chris Rebert
On Thu, Jul 16, 2009 at 5:57 PM, Ronn Rossronn.r...@gmail.com wrote: Hello all, Created a python file that has a class and three methods. When I jump into interactive mode I import like so: from file import class Now when I try to use a method from the class: var1 = class.method() It

Re: Einstein summation notation (was: question of style)

2009-07-17 Thread Chris Rebert
On Thu, Jul 16, 2009 at 11:13 PM, koranthalakoranth...@gmail.com wrote: That test was designed to treat None as a boolean False, without noticing that numeric 0 is also treated as False and could make the test do the wrong thing.  This is an extremely common type of error. Actually, I felt

Re: Writing a single list of numbers to a .m (matlab) file

2009-07-17 Thread Chris Rebert
On Fri, Jul 17, 2009 at 11:06 AM, Hanna Michelsenhannaro...@gmail.com wrote: Hi, I was wondering if I could get some suggestions on how to write a single list of numbers to a .m file (for matlab) so that I can create a matlab vector out of the list of numbers from my python program. I have

Re: how two join and arrange two files together

2009-07-18 Thread Chris Rebert
On Sat, Jul 18, 2009 at 12:09 AM, amr...@iisermohali.ac.in wrote: Hi, I have two files having entries like:-- fileA 8  ALA H = 7.85 N = 123.95 CA = 54.67 HA = 2.98 C = 179.39 15 ALA H = 8.05 N = 119.31 CA = 52.18 HA = 4.52 C = 177.18 23 ALA H = 8.78 N = 120.16 CA = 55.84 HA = 4.14 C =

Re: python command running old version

2009-07-18 Thread Chris Rebert
On Sat, Jul 18, 2009 at 10:25 AM, Tim Edwardstimphoto...@gmail.com wrote: My brain is running in n00b mode this morning...must find coffee. I upgraded python this morning and entering python from the command line runs the old version. Which OS? How did you install it? Cheers, Chris --

Re: Auto Send URL

2009-07-18 Thread Chris Rebert
On Fri, Jul 17, 2009 at 6:02 AM, Victor Subervivictorsube...@gmail.com wrote: Hi; I am trying to script code that automatically sends a Web site visitor to an URL. Specifically, when they enter a value in a search box, I have that form sent to a script that writes an URL acceptable to Google,

Re: uniicode and executing a process with subprocess.call, or os.system

2009-07-18 Thread Chris Rebert
On Sat, Jul 18, 2009 at 3:30 PM, Rick Kingrickbk...@comcast.net wrote: Hello, I want to copy files using subprocess.call or os.system where the file names are non-ascii, e.g. Serbian(latin), c's and s's with hacheks,etc. Windows stores all the file names in unicode so they are displayed ok in

Re: question on input function

2009-07-19 Thread Chris Rebert
On Sun, Jul 19, 2009 at 7:07 PM, Richel Satumbagarlsatumb...@yahoo.com wrote: I am just learning python then I encountered an certain point in terms of using the input function of python. the source code:    eq = input(enter an equation:);    print the

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Chris Rebert
On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrump...@cs.uu.nl wrote: Duncan Booth duncan.bo...@invalid.invalid (DB) wrote: DB Phillip B Oldham phillip.old...@gmail.com wrote: This make a lot more sense to us, and follows the convention from other languages. It would also mean chaining methods

Re: doted filenames in import statements

2009-07-21 Thread Chris Rebert
On Tue, Jul 21, 2009 at 2:42 PM, Jean-Michel Pichavantjeanmic...@sequans.com wrote: Hi fellows, I'd like to use the dynamic __import__ statement. It works pretty well with non dotted names, but I cannot figure how to make it work with dotted file paths. example: file = /home/dsp/test.py

Re: plotting graph from another file

2009-07-22 Thread Chris Rebert
On Tue, Jul 21, 2009 at 11:28 PM, jhinak senjhinak@gmail.com wrote: hello.. i want to plot a distribution graph for following data: elements:   number of occurance:    a                            2    b    4    c    1    d

Re: how two join and arrange two files together

2009-07-23 Thread Chris Rebert
On Thu, Jul 23, 2009 at 12:22 AM, amr...@iisermohali.ac.in wrote: Hi, I have two large files: FileA 15 ALA H = 8.05 N = 119.31 CA = 52.18 HA = 4.52 C = 21 ALA H = 7.66 N = 123.58 CA = 54.33 HA = C = 179.35 23 ALA H = 8.78 N =  CA =  HA = C = 179.93. and FileB 21 ALA  

Re: Creating xml

2009-07-23 Thread Chris Rebert
On Thu, Jul 23, 2009 at 12:30 PM, Greg Lindstromgslindst...@gmail.com wrote: snip How about if I need/want to parse or process an XML file? xml.etree.ElementTree in the standard library: http://docs.python.org/library/xml.etree.elementtree.html Cheers, Chris -- http://blog.rebertia.com --

effbot.org broken (WAS: Problems in commands.getoutput(cmd) with sox)

2009-07-23 Thread Chris Rebert
On Thu, Jul 23, 2009 at 12:42 PM, Chris Rebertc...@rebertia.com wrote: You can use tabnanny to help diagnose the problem: http://74.125.155.132/search?q=cache:QtxvZm3QDLsJ:effbot.org/librarybook/tabnanny.htm+tabnannycd=3hl=enct=clnkgl=usclient=firefox-a Anyone know what's the deal with

Re: effbot.org broken (WAS: Problems in commands.getoutput(cmd) with sox)

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 2:38 AM, Piet van Oostrump...@cs.uu.nl wrote: Chris Rebert c...@rebertia.com (CR) wrote: CR On Thu, Jul 23, 2009 at 12:42 PM, Chris Rebertc...@rebertia.com wrote: You can use tabnanny to help diagnose the problem: http://74.125.155.132/search?q

Re: Popen

2009-07-24 Thread Chris Rebert
--- On Fri, 7/24/09, Diez B. Roggisch de...@nospam.web.de wrote: From: Diez B. Roggisch de...@nospam.web.de Subject: Re: Popen To: python-list@python.org Date: Friday, July 24, 2009, 12:35 PM Tim schrieb: Thanks! Yes I mean subprocess.Popen. I was wondering the meaning of

Re: trouble with wrapping a c program

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 5:34 AM, Sanne Korzecsa...@kortec.nl wrote: Hi Mailing, I am using a c program, which first initializes for some seconds and then waits for user input (keyboard) to type something. When enter is pressed the c program continues. snip Using the keyboard and then enter

Re: Re: len() should always return something

2009-07-24 Thread Chris Rebert
Jul 24, 2009 07:02:29 AM, c...@rebertia.com wrote: On Thu, Jul 23, 2009 at 11:35 PM, Dr. Phillip M. Feldmanpfeld...@verizon.net wrote: Some aspects of the Python design are remarkably clever, while others leave me perplexed. Here's an example of the latter: Why does len() give an error

Re: len() should always return something

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 12:05 PM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Fri, 24 Jul 2009 00:02:28 -0700, Chris Rebert wrote: On Thu, Jul 23, 2009 at 11:35 PM, Dr. Phillip M. Feldmanpfeld...@verizon.net wrote: Some aspects of the Python design are remarkably clever

Re: len() should always return something

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 1:30 PM, Tim Chasepython.l...@tim.thechases.com wrote: Marcus Wanner wrote: First one to correctly decompress the value 0 into an ASCII character wins the title of the world's most capable hacker :p Bah...uncompressing the value 0 into *an* ASCII character is easy.  

Re: len() should always return something

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 7:50 PM, Dr. Phillip M. Feldmanpfeld...@verizon.net wrote: Here's a simple-minded example: def dumbfunc(xs):   for x in xs:      print x This function works fine if xs is a list of floats, but not if it is single float.  It can be made to work as follows: def

Re: len() should always return something

2009-07-25 Thread Chris Rebert
On Sat, Jul 25, 2009 at 4:21 PM, Erik Max Francism...@alcyone.com wrote: Steven D'Aprano wrote: But it's not practically every function. It's hardly any function at all -- in my code, I don't think I've ever wanted this behavior. I would consider it an error for function(42) and

Re: len() should always return something

2009-07-25 Thread Chris Rebert
On Sat, Jul 25, 2009 at 6:47 PM, Erik Max Francism...@alcyone.com wrote: Chris Rebert wrote: On Sat, Jul 25, 2009 at 4:21 PM, Erik Max Francism...@alcyone.com wrote: Steven D'Aprano wrote: But it's not practically every function. It's hardly any function at all -- in my code, I don't

Re: code debugging

2009-07-26 Thread Chris Rebert
On Sat, Jul 25, 2009 at 11:23 PM, golubhardwajjaye...@gmail.com wrote: here is a code which crawls links sent to it. theres some problem with the retrieve_url function ,plz help me out in debugging the fuction retrive_url. This function retrives pages and saves them in file Please specify

Re: I am trying to compile python 2.6.2 on my Mac

2009-07-26 Thread Chris Rebert
On Sun, Jul 26, 2009 at 1:12 AM, Jessica R Smithjessica.1980.sm...@gmail.com wrote: Hello, I am trying to compile Python 2.6.2 on my Mac which has os/x 10.5.7 I downloaded python 2.6.2 from here:  - http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2 I unpacked it. I ran these

Re: How to comment constant values?

2009-07-26 Thread Chris Rebert
On Sun, Jul 26, 2009 at 2:49 PM, Erwin Muellerdev...@deventm.org wrote: Hello, I'm new to Python (using it for two months) and I wonder how can I comment the const. values with the doc-strings. I.e. if I have code: FRACTION_MIN = 1 FRACTION_MAX = 10 class Fraction(collections.MutableSequence):

Re: Working with platform.system()

2009-07-29 Thread Chris Rebert
On Wed, Jul 29, 2009 at 6:10 AM, v1d4l0k4v1d4l...@gmail.com wrote: Hi! I want to know how I can get different expected return values by platform.system() method. I want to sniff some systems (Linux, Windows, Mac, BSD, Solaris) and I don't know how I can check them correctly. Could you give

Re: gamma approximation : what is module cmath and where is it located ?

2009-07-29 Thread Chris Rebert
On Wed, Jul 29, 2009 at 9:24 PM, pdlem...@earthlink.net wrote: snip But I can't figure out where it gets cmath.    Searching the Python directory reveals no more than a test_cmath.  The only cmath I can find is a header file in another directory  turboc++\Borland\include\ dir(cmath) reveals

Re: Confessions of a Python fanboy

2009-07-29 Thread Chris Rebert
On Wed, Jul 29, 2009 at 9:04 PM, alex23wuwe...@gmail.com wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will

Re: gamma approximation : what is module cmath and where is it located ?

2009-07-30 Thread Chris Rebert
On Wed, Jul 29, 2009 at 11:41 PM, Peter Otten__pete...@web.de wrote: pdlem...@earthlink.net wrote: I've used python a few months and expected to find cmath seperately sort of as a header file.  A text search failed.  I now understand its in the Python Standard Library, which I assume is that

Re: gamma approximation : what is module cmath and where is it located ?

2009-07-30 Thread Chris Rebert
On Thu, Jul 30, 2009 at 3:10 AM, Steven D'Apranoste...@remove.this.cybersource.com.au wrote: On Wed, 29 Jul 2009 21:34:07 -0700, Chris Rebert wrote: The difference is that it handles complex numbers, whereas the plain math module doesn't. I would guess the reason there are separate modules

Re: Run pyc file without specifying python path ?

2009-07-30 Thread Chris Rebert
On Thu, Jul 30, 2009 at 3:42 AM, Barak, Ronron.ba...@lsi.com wrote: From: PythonAB [mailto:pyt...@rgbaz.eu] Sent: Thursday, July 30, 2009 12:18 To: Barak, Ron Cc: 'Dave Angel'; 'python-list@python.org' Subject: Re: Run pyc file without specifying python

Re: Python processors? : WAS Re: Does python have the capability for driver development ?

2009-07-30 Thread Chris Rebert
On Thu, Jul 30, 2009 at 3:49 AM, Francesco Bochicchiobieff...@gmail.com wrote: On Jul 30, 11:10 am, Christian Heimes li...@cheimes.de wrote: Martin P. Hellwig wrote: Well the pyc, which I thought was the Python bytecode, is then interpreted by the VM. Python is often referred as byte-code

Re: problem on socket programming

2009-07-31 Thread Chris Rebert
On Fri, Jul 31, 2009 at 1:02 AM, MalC0demalc0de.encr...@gmail.com wrote: now I've been encountered to some errors with this snippet : And these errors are? Provide error messages and full tracebacks. Cheers, Chris -- http://blog.rebertia.com --

Re: Confessions of a Python fanboy

2009-07-31 Thread Chris Rebert
On Fri, Jul 31, 2009 at 1:21 AM, Xavier Hocont...@xavierho.com wrote: On Fri, Jul 31, 2009 at 6:08 PM, Masklinn maskl...@masklinn.net wrote: snip... but since Python doesn't have anonymous functions that usage tends to be a bit too verbose ... snip Sorry to interrupt, but wouldn't lambda in

Re: Confessions of a Python fanboy

2009-07-31 Thread Chris Rebert
On Fri, Jul 31, 2009 at 1:31 AM, Xavier Hocont...@xavierho.com wrote: On Fri, Jul 31, 2009 at 6:25 PM, Chris Rebert c...@rebertia.com wrote: I believe full anonymous functions was intended by the author. lambdas are limited to a single expression. Full anonymous functions would be allowed

Re: file comparison

2009-07-31 Thread Chris Rebert
On Fri, Jul 31, 2009 at 2:25 AM, learner learnerpyvault...@gmail.com wrote: Hi all, I want to compare two text files line by line and eliminate the matching/repeated line and store the unmatched/leftout lines into a third file or overwrite into one of them. See the `difflib` module:

Re: Custom namespaces

2009-08-01 Thread Chris Rebert
On Sat, Aug 1, 2009 at 6:06 PM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: I was playing around with a custom mapping type, and I wanted to use it as a namespace, so I tried to use it as my module __dict__: import __main__ __main__.__dict__ = MyNamespace() Traceback (most

Re: Custom namespaces

2009-08-02 Thread Chris Rebert
On Sun, Aug 2, 2009 at 12:18 AM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Sat, 01 Aug 2009 21:46:35 -0700, Chris Rebert wrote: Is there any way to install a custom type as a namespace? For classes/objects, yes, using metaclasses. See the __prepare__() method in PEP 3115

Re: Skipping a superclass

2009-08-02 Thread Chris Rebert
On Sun, Aug 2, 2009 at 5:36 AM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: I have a series of subclasses like this: class A(object):    def method(self, *args):        print Lots of work gets done here in the base class class B(A):    def method(self, *args):        print

Re: Python docs disappointing

2009-08-02 Thread Chris Rebert
On Fri, Jul 31, 2009 at 1:10 PM, kj no.em...@please.post wrote: I'm pretty new to Python, and I like a lot overall, but I find the documentation for Python rather poor, overall. I'm sure that Python experts don't have this problem: they have internalized some good ways to access the

Re: Ordering of dict keys values

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 1:47 PM, Wells Oliverwe...@submute.net wrote: I understand that the keys in a dictionary are ordered not randomly but something practically close to it, but if I create a SQL query like so: query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()),

Re: no-clobber dicts?

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 2:47 PM, rrt8...@gmail.com wrote: On Aug 3, 4:07 pm, kj no.em...@please.post wrote: I use the term no-clobber dict to refer to a dictionary D with the especial property that if K is in D, then   D[K] = V will raise an exception unless V == D[K].  In other words, D[K]

Re: no-clobber dicts?

2009-08-04 Thread Chris Rebert
On Tue, Aug 4, 2009 at 12:30 PM, kjno.em...@please.post wrote: In mailman.4183.1249336823.8015.python-l...@python.org Chris Rebert c...@rebertia.com writes: On Mon, Aug 3, 2009 at 2:47 PM, rrt8...@gmail.com wrote: On Aug 3, 4:07=C2=A0pm, kj no.em...@please.post wrote: I use the term

Re: os.walk()

2009-08-04 Thread Chris Rebert
On Tue, Aug 4, 2009 at 7:06 PM, Michael Savaresegeomajo...@gmail.com wrote: Greetings Python newbie here, and thanks to all who have helped me previously. Is there a way of grabbing file attributes while traversing with os.walk()? It would be advantageous to have date modified and file size

Re: trouble with complex numbers

2009-08-05 Thread Chris Rebert
On Tue, Aug 4, 2009 at 11:28 PM, Dr. Phillip M. Feldmanpfeld...@verizon.net wrote: When I try to compute the phase of a complex number, I get an error message: In [3]: from cmath import * In [4]: x=1+1J In [5]: phase(x) snip NameError: name 'phase' is not defined snip AttributeError:

Re: Launch my application if its not running

2009-08-05 Thread Chris Rebert
On Wed, Aug 5, 2009 at 2:03 AM, sanju pssanu1...@gmail.com wrote: How to check whether my gui application is running or not.If its already running i have to quit my program other wise i need to launch my program. Can anybody suggest a solution to this Use a lock file?

Re: intricated functions: how to share a variable

2009-08-05 Thread Chris Rebert
On Wed, Aug 5, 2009 at 3:13 AM, TPtribulati...@paralleles.invalid wrote: Hi everybody, See the following example: # def tutu():    def toto(): nonlocal a #note: this requires a rather recent version of python        print a        a = 4        print a    a=2    toto()

Re: os.walk()

2009-08-06 Thread Chris Rebert
On Tue, Aug 4, 2009 at 10:48 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Aug 4, 2009 at 7:06 PM, Michael Savaresegeomajo...@gmail.com wrote: Greetings Python newbie here, and thanks to all who have helped me previously. Is there a way of grabbing file attributes while traversing

Re: How to write replace string for object which will be substituted? [regexp]

2009-08-06 Thread Chris Rebert
On Thu, Aug 6, 2009 at 2:03 PM, Ryniek90rynie...@gmail.com wrote: 2) If you really want to learn regexes, get a copy of _Mastering Regular Expressions_ by Friedl (either 2nd or 3rd edition) I made preview of that book, but some pages are disabled from preview. Has that book topics about

Re: XML flaw

2009-08-06 Thread Chris Rebert
On Thu, Aug 6, 2009 at 3:05 PM, MRABpyt...@mrabarnett.plus.com wrote: Hi all, I've just read this article, which mentions Python: XML flaw threatens millions of apps with DoS attacks http://infoworld.com/print/86340 Something to worry about? More detailed article:

Re: Why all the __double_underscored_vars__?

2009-08-07 Thread Chris Rebert
On Fri, Aug 7, 2009 at 5:51 PM, kjno.em...@please.post wrote: Python is chock-full of identifiers beginning and ending with double underscores, such as __builtin__, __contains__, and __coerce__. Using underscores to signal that an identifier is somehow private to an implementation is pretty

Re: How to address a global variable in a function

2009-08-07 Thread Chris Rebert
On Fri, Aug 7, 2009 at 11:29 PM, n179911n179...@gmail.com wrote: HI, I have a global variable // line 8 tx  = 0 and then I have this function (start in line 12): def handleTranslate(result):        print line        txStr, tyStr = result.group(1), result.group(2)        print txStr,

Re: create shell history with python

2009-08-11 Thread Chris Rebert
On Tue, Aug 11, 2009 at 6:09 PM, Joel Juvenal Rivera Riverajoel...@gmail.com wrote: I been thinking how to make a 'bash like history shell' in python, i don't know if with stdin and stdout i can accomplish this or do i need something like curses and stuff like that, anyway im start to figure

Re: getting a simple program to work

2009-08-11 Thread Chris Rebert
On Sun, Aug 9, 2009 at 8:42 PM, John Haggertybouncy...@gmail.com wrote: ok so I know this is one of those weird requests but here me out. So far I have an issue with a package for python called libgmail which is basically a gmail interface for python to send messages remoetly. Works ok except

Re: hashability

2009-08-11 Thread Chris Rebert
2009/8/11 Asun Friere afri...@yahoo.co.uk: On Aug 12, 12:15 pm, James Stroud jstr...@mbi.ucla.edu wrote: I realize I left out my use. The intent of the function is to flag objects that will make useful keys for a persistent dictionary. The {C():4}[C()] example demonstrates why I want to avoid

Re: hashability

2009-08-12 Thread Chris Rebert
2009/8/11 Asun Friere afri...@yahoo.co.uk: On Aug 12, 12:15 pm, James Stroud jstr...@mbi.ucla.edu wrote: I realize I left out my use. The intent of the function is to flag objects that will make useful keys for a persistent dictionary. The {C():4}[C()] example demonstrates why I want to avoid

Re: hashability

2009-08-12 Thread Chris Rebert
On Wed, Aug 12, 2009 at 2:25 AM, Chris Rebertc...@rebertia.com wrote: 2009/8/11 Asun Friere afri...@yahoo.co.uk: On Aug 12, 12:15 pm, James Stroud jstr...@mbi.ucla.edu wrote: Apologies for the possible repeated post. Gmail failed to mark the draft as sent for some reason. - Chris --

Re: hashability

2009-08-12 Thread Chris Rebert
On Wed, Aug 12, 2009 at 1:37 PM, James Stroudjstr...@mbi.ucla.edu wrote: Steven D'Aprano wrote: Well there you go -- why on earth would you prohibit None as a dictionary key??? That's a serious failure. roentgen 1% python Python 2.5 (r25:51908, Sep 20 2006, 17:36:21) [GCC 3.4.2] on linux2

Re: Format Code Repeat Counts?

2009-08-12 Thread Chris Rebert
On Wed, Aug 12, 2009 at 4:34 PM, jschwabjsch...@gmail.com wrote: snip As a more concrete example, say I have several sets of letters in a list of strings     letters = [aeiou, hnopty, egs, amsp] and I wanted to build a regular expression string out of them like     re_str ==

Re: Nice copy in interactive terminal

2009-08-12 Thread Chris Rebert
On Thu, Aug 13, 2009 at 12:15 AM, casebashwalkr...@gmail.com wrote: Hello fellow Python Users, I've been wondering for a while if there exists an interactive terminal which has nice copy feature (ie. I can copy code without getting the in front of every line). Not quite answering your exact

Re: csv.DictWriter.write_header()

2009-08-13 Thread Chris Rebert
On Wed, Aug 12, 2009 at 4:45 PM, Alan G Isaacalan.is...@gmail.com wrote: Given a csv.DictWriter instance `dw` I think it would be nice to be able to say dw.write_header() instead of dw.writer.writerow(dw.fieldnames) Good idea? Maybe. You could file a bug: http://bugs.python.org/ Cheers,

Re: coding for multiple versions of python

2009-08-13 Thread Chris Rebert
On Thu, Aug 13, 2009 at 12:57 PM, Tim Arnoldtim.arn...@sas.com wrote: Hi, I've got a python based system that has to run on hp unix and red hat linux. The Python version on the HP is 2.4 and the version on the Linux box is 2.6. There's nothing I can do about that. I think that means I must

Re: Any way to adjust difflib algorithm?

2009-08-14 Thread Chris Rebert
On Fri, Aug 14, 2009 at 2:38 PM, Grant Edwardsinva...@invalid wrote: I'm trying to use difflib to compare two files, and it's not producing very useful results.  When comparing two lines where only a few characters have changed, it usually seems to decide that a line was

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Chris Rebert
On Sat, Aug 15, 2009 at 4:47 AM, Hendrik van Rooyenhend...@microcorp.co.za wrote: On Friday 14 August 2009 18:11:52 Steven D'Aprano wrote: On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: I saw `cout' being shifted Hello world times to the left and stopped right there.  --Steve Gonedes

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Chris Rebert
On Sat, Aug 15, 2009 at 8:09 AM, Xavier Hocont...@xavierho.com wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Chris Rebert
On Sat, Aug 15, 2009 at 1:06 PM, Mark Lawrencebreamore...@yahoo.co.uk wrote: Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six

Re: random.gauss vs. random.normalvariate

2009-08-16 Thread Chris Rebert
On Sat, Aug 15, 2009 at 10:18 PM, Paul Rubin http://phr...@nospam.invalid wrote: Dennis Lee Bieber wlfr...@ix.netcom.com writes:       No language can guard against independent access of a shared/global object by multiple threads... Erlang? On Sun, Aug 16, 2009 at 12:23 AM, John

Re: flatten a list of list

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 5:47 AM, Terryterry.yin...@gmail.com wrote: Hi, Is there a simple way (the pythonic way) to flatten a list of list? rather than my current solution: new_list=[] for l in list_of_list:    new_list.extend(l) or, new_list=reduce(lambda x,y:x.extend(y),

Re: How to find out in which module an instance of a class is created?

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 6:25 AM, Johannes Janssenm...@johannes-janssen.de wrote: Gabriel Genellina schrieb: The try/except around sys._getframe(1) is because that function is not mandatory/available on all Python implementations (that's the case for jython which doesn't provide it). Thanks,

Re: flatten a list of list

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 6:49 AM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Sun, 16 Aug 2009 05:55:48 -0400, Chris Rebert wrote: On Sun, Aug 16, 2009 at 5:47 AM, Terryterry.yin...@gmail.com wrote: Hi, Is there a simple way (the pythonic way) to flatten a list of list

Re: flatten a list of list

2009-08-16 Thread Chris Rebert
On Sun, Aug 16, 2009 at 7:31 AM, Steven D'Apranost...@remove-this-cybersource.com.au wrote: On Sun, 16 Aug 2009 06:59:52 -0400, Chris Rebert wrote: Surely that's going to be O(N**2)? The OP asked for simple, not best, most proper, or fastest. My comment was intended to mean that the code

Re: Diversity in Python (was Re: Need cleanup advice for multiline string)

2009-08-17 Thread Chris Rebert
On Mon, Aug 17, 2009 at 2:12 PM, Carl Bankspavlovevide...@gmail.com wrote: On Aug 17, 8:44 am, a...@pythoncraft.com (Aahz) wrote: In article 461cc6f1-fc23-4bc7-a719-6f29babf8...@o15g2000yqm.googlegroups.com, Robert Dailey  rcdai...@gmail.com wrote: It's a figure of speech. And besides, why

Re: New to python

2009-08-17 Thread Chris Rebert
On Mon, Aug 17, 2009 at 7:49 PM, Allan Fongaf2...@gmail.com wrote: Hi! I'm fairly new to Python.  I understand the basics basics but I'm been trying to write a simple python code that will let me read input data from my USB drive and write it in a text file and I am so lost.  Can anyone help

Re: Text lost when I write file

2009-08-17 Thread Chris Rebert
On Mon, Aug 17, 2009 at 8:45 PM, roy...@gmail.comroy...@gmail.com wrote: Dear All, I try to write text into a file but some text lost when the size of the text content is over 32K. Is that relate to the buffer of the python and any setting can solve this problem??. Please show us the code

Re: conversion of Python object to perl object

2009-08-18 Thread Chris Rebert
On Mon, Aug 17, 2009 at 3:47 AM, srinivasan srinivassri_anna...@yahoo.co.in wrote: Hi, I have to call a perl method which takes a hash as its argument from a python module. Is there a way to convert python dictionary to perl hash ( not hash ref)? How are you calling the Perl method from

Re: How to create functors?

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 1:32 PM, Robert Daileyrcdai...@gmail.com wrote: On Aug 18, 3:31 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Robert Dailey rcdai...@gmail.com wrote: Hello, I want to simply wrap a function up into an object so it can be called with no parameters. The

Re: Identifying a class type - bad practice?

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 10:09 AM, James Harrisjames.harri...@googlemail.com wrote: I am writing some code to form a tree of nodes of different types. The idea is to define one class per node type such as class node_type_1(node):  specific properties by name including other node types class

Re: Editing a wiki

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 2:02 PM, KillSwitchgu.yakahug...@gmail.com wrote: Hey guys, Is it possible to edit a wiki page with python, including logging in to edit the page, and inserting text into the edit box, etc. Depends on the wiki. For Mediawiki, yes: http://pywikipediabot.sourceforge.net/

Re: Scope and classes

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 3:47 PM, Daviddavidsh...@googlemail.com wrote: Hi all, I'm trying to understand how scopes work within a class definition. I'll quickly illustrate with an example. Say I had the following class definition: class Abc:    message = 'Hello World'    def

Re: Python on the web, how to?

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 4:06 PM, Atul.atulskulka...@gmail.com wrote: Hello All, Needless to say I am new to python and web programming. I am looking for a quick Python-101 course / tutorial for using python to implement dynamic content on web under some web server. Any pointers what should I

Re: Raw Strings with Variables

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 5:09 PM, WilsonOfCanadaw...@sfu.ca wrote: You're right, but the moment I append it onto a list, it would become C:\\moo. arrPlaces = [] intPoint =0 while (len(testline)):        testline = fileName.readline()        print testline        

Re: Raw Strings with Variables

2009-08-18 Thread Chris Rebert
On Tue, Aug 18, 2009 at 5:51 PM, WilsonOfCanadaw...@sfu.ca wrote: However, when I send the list over as a dictionary for HTML: d[places] = arrPlaces return render_to_response('rentSearch.html', d) the HTML using Django has: {{ places }} but returns ['C:\\moo', 'C:\\supermoo'] As we've

Re: First program

2010-06-12 Thread Chris Rebert
On Sat, Jun 12, 2010 at 2:03 AM, Phil H skilp...@gmail.co.za wrote: Hi, Trying my hand with Python but have had a small hiccup. Reading  'A byte of Python' and created helloworld.py as directed. #!/usr/bin/python # filename : helloworld.py print 'Hello World' At the terminal prompt cd to

Re: Serializing functions

2010-06-17 Thread Chris Rebert
2010/6/17 Andreas Löscher andreas.loesc...@s2005.tu-chemnitz.de: Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: Matteo Landi landima...@gmail.com writes: I could be wrong, but it seems functions are not

Re: process cannot access the file because it is being used by other process

2010-06-21 Thread Chris Rebert
On Mon, Jun 21, 2010 at 6:44 AM, Felipe Vinturini felipe.vintur...@gmail.com wrote: snip Your problem seems to be with stdout redirect to the same file: YourOutput1.txt. Windows is not like Unix like systems! You can try, instead of redirecting to the same file, redirect each to a separate

Re: Problem using pbzip2 with bz2.BZ2File().read()

2010-06-21 Thread Chris Rebert
On Mon, Jun 21, 2010 at 5:32 PM, Ameet Nanda ameet.na...@gmail.com wrote: When I compress a file with bzip2 from command line and read it with uncomp_data = bz2.BZ2File(fname).read() , it reads the whole file into uncomp_data. However when I compress the file with pbzip2 from command line and

Re: Pythonic Idiom For Searching An Include Path

2010-06-23 Thread Chris Rebert
On Wed, Jun 23, 2010 at 3:27 PM, Tim Daneliuk tun...@tundraware.com wrote: Given a program 'foo' that takes a command line argument '-I includefile', I want to be able to look for 'includefile' in a path specified in an environment variable, 'FOOPATH'. I'd like a semantic that says:  If

Re: How to get the date format from the users locale?

2010-06-25 Thread Chris Rebert
On Fri, Jun 25, 2010 at 4:39 AM, Fabio Zadrozny fabi...@gmail.com wrote: I'm trying to get the locale-aware date format but it doesn't seem to be available through nl_langinfo in python 2.5.4 (windows vista). There is the %x format specifier in the time module, but it doesn't actually tell you

Re: I strongly dislike Python 3

2010-06-26 Thread Chris Rebert
On Sat, Jun 26, 2010 at 11:55 AM, Peter Kleiweg p.c.j.klei...@rug.nl wrote: Stephen Hansen schreef op de 26e dag van de zomermaand van het jaar 2010: There were various serious problems with Python 2 which could not be fixed in a backwards compatible way; we've been living with them for years

Re: Python dynamic attribute creation

2010-06-26 Thread Chris Rebert
On Sat, Jun 26, 2010 at 6:06 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: snip CPython is a fairly plodding implementation. But that's due to the conservativeness of CPython: Unladen Swallow is faster, and PyPI is faster still, and the PyPI people expect to eventually be

Re: Why Is Escaping Data Considered So Magical?

2010-06-26 Thread Chris Rebert
On Sat, Jun 26, 2010 at 7:21 PM, Lawrence D'Oliveiro wrote: In message mailman.2123.1277522976.32709.python-l...@python.org, Tim Chase wrote: On 06/25/2010 07:49 PM, Lawrence D'Oliveiro wrote: ... I see that you published my unobfuscated e-mail address on USENET for all to see. I

Re: Need instruction on how to use isinstance

2010-06-27 Thread Chris Rebert
On Sun, Jun 27, 2010 at 9:30 PM, alex23 wuwe...@gmail.com wrote: Stephen Hansen me+list/pyt...@ixokai.io wrote: P.S. The removal of callable is something I don't understand in Python 3: while generally speaking I do really believe and use duck typing, I too have on occassion wanted to dispatch

Re: I wander which is better? JSP or Python? And is there a place for JSP?

2010-06-27 Thread Chris Rebert
On Sun, Jun 27, 2010 at 9:49 PM, Roger rogerda...@gmail.com wrote: As I plan to study JSP, I find it extremly complicated and a part of J2EE. I did not attend to get the whole of J2EE. I hope anybody can describe the future of JSP. Is there a place for JSP? This is

Re: Need instruction on how to use isinstance

2010-06-27 Thread Chris Rebert
On Sun, Jun 27, 2010 at 9:54 PM, Stephen Hansen me+list/pyt...@ixokai.io wrote: On 6/27/10 9:30 PM, alex23 wrote: Stephen Hansenme+list/pyt...@ixokai.io  wrote: P.S. The removal of callable is something I don't understand in Python 3: while generally speaking I do really believe and use duck

Re: 回复: I wander which is better? JSP or Pytho n? And is there a place for JSP?

2010-06-28 Thread Chris Rebert
-- 原始邮件 -- 发件人: Chris Rebertc...@rebertia.com; 发送时间: 2010年6月28日(星期一) 中午1:09 收件人: Rogerrogerda...@gmail.com; 主题: Re: I wander which is better? JSP or Python? And is there a place for JSP? On Sun, Jun 27, 2010 at 9:49 PM, Roger rogerda...@gmail.com wrote: As

Re: dynamically modify help text

2010-06-28 Thread Chris Rebert
On Mon, Jun 28, 2010 at 11:13 AM, Brian Blais bbl...@bryant.edu wrote: On Jun 27, 2010, at 22:37 , Red Forks wrote: Read you doc file and set the __doc__ attr of the object you want to change. On Monday, June 28, 2010, Brian Blais bbl...@bryant.edu wrote: I know that the help text for an

Re: I strongly dislike Python 3

2010-06-28 Thread Chris Rebert
On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk f...@green.rahul.net wrote: In article mailman.2270.1277736664.32709.python-l...@python.org, Stephen Hansen  me+list/pyt...@ixokai.io wrote: No one said otherwise, or that print was useless and never used in such contexts. I was responding to

Re: Python dynamic attribute creation

2010-06-29 Thread Chris Rebert
On Tue, Jun 29, 2010 at 9:48 AM, WANG Cong xiyou.wangc...@gmail.com wrote: On 06/27/10 12:01, Carl Banks pavlovevide...@gmail.com wrote: On Jun 25, 8:24 pm, WANG Cong xiyou.wangc...@gmail.com wrote: Understand, but please consider my proposal again, if we switched to: setattr(foo, 'new_attr',

<    6   7   8   9   10   11   12   13   14   15   >