Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Chris Rebert
On Wed, Jan 13, 2010 at 2:41 AM, Chris Rebert c...@rebertia.com wrote: On Tue, Jan 12, 2010 at 11:45 PM, Nico Grubert nicogrub...@gmail.com wrote: Hi there I have the following list 'mylist' that contains some dictionaries: mylist = [{'title':'the Fog', 'id':1},          {'title':'The Storm

Re: Writing a string.ishex function

2010-01-14 Thread Chris Rebert
On Thu, Jan 14, 2010 at 8:14 AM, Iain King iaink...@gmail.com wrote: On Jan 14, 3:52 pm, chandra chyav...@gmail.com wrote: Folks, I am new to Python and could not find a function along the lines of string.ishex in Python. There is however, a string.hexdigits constant in the string module. I

Re: Changing Lutz's mydir from Edition 2, Learning Python

2010-01-17 Thread Chris Rebert
On Sun, Jan 17, 2010 at 12:11 PM, W. eWatson wolftra...@invalid.com wrote: See Subject. The code is below with a few changes I made at the bottom by inserting    import string    import numpy    module = raw_input(Enter module name: )    listing(module) As the error says, strings have no

Re: IDLE Namespace Toolbox? Windows.

2010-01-17 Thread Chris Rebert
On Sun, Jan 17, 2010 at 2:22 PM, W. eWatson wolftra...@invalid.com wrote: This is a follow up to my post Changing Lutz's mydir.  It would seem there should be some sort of toolbox that allows one to do things like mydir, and perhaps a lot more. Maybe something like it exists in Linux. Indeed;

Re: IDLE Namespace Toolbox? Windows.

2010-01-17 Thread Chris Rebert
On Sun, Jan 17, 2010 at 3:09 PM, Chris Rebert c...@rebertia.com wrote: On Sun, Jan 17, 2010 at 2:22 PM, W. eWatson wolftra...@invalid.com wrote: This is a follow up to my post Changing Lutz's mydir.  It would seem there should be some sort of toolbox that allows one to do things like mydir

Re: IDLE Namespace Toolbox? Windows.

2010-01-17 Thread Chris Rebert
On Sun, Jan 17, 2010 at 4:11 PM, W. eWatson wolftra...@invalid.com wrote: John Bokma wrote: W. eWatson wolftra...@invalid.com writes: This is a follow up to my post Changing Lutz's mydir.  It would seem there should be some sort of toolbox that allows one to do things like mydir, and perhaps

Re: Arrrrgh! Another module broken

2010-01-17 Thread Chris Rebert
On Sun, Jan 17, 2010 at 5:25 PM, Jive Dadson notonthe...@noisp.com wrote: I just found another module that broke when I went to 2.6.  Gnuplot. Apparently one of its routines has a parameter named with.  That used to be okay, and now it's not. Once I get everything to work under 2.6, I am

Re: Arrrrgh! Another module broken

2010-01-17 Thread Chris Rebert
On Sun, Jan 17, 2010 at 9:44 PM, Jive Dadson notonthe...@noisp.com wrote: Matt Newville wrote: On Jan 17, 7:25 pm, Jive Dadson notonthe...@noisp.com wrote: I just found another module that broke when I went to 2.6. Gnuplot.  Apparently one of its routines has a parameter named with.  That

Re: syntax

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 4:53 PM, marlowe marlowequ...@hotmail.com wrote: I wrote this program, but i have a feeling like there might be a more practical way of writing it. Can someone give me an idea of how to simplify this? Here is an example of the csv file i am using. This program

Re: syntax

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 5:23 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 18, 2010 at 4:53 PM, marlowe marlowequ...@hotmail.com wrote: snip L=float(data[40][3])+float(data[41][3])+float(data[42][3])+float(data [43][3])\ +float(data[44][3])+float(data[45][3])+float(data[46][3])+float

Re: python replace/sub/wildcard/regex issue

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 8:04 PM, tom badoug...@gmail.com wrote: hi... trying to figure out how to solve what should be an easy python/regex/ wildcard/replace issue. i've tried a number of different approaches.. so i must be missing something... my initial sample text are: Soo

Re: python replace/sub/wildcard/regex issue

2010-01-18 Thread Chris Rebert
On Mon, Jan 18, 2010 at 8:31 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 18, 2010 at 8:04 PM, tom badoug...@gmail.com wrote: hi... trying to figure out how to solve what should be an easy python/regex/ wildcard/replace issue. i've tried a number of different approaches.. so i must

Re: why the super class can access the subclass's attribute

2010-01-20 Thread Chris Rebert
On Wed, Jan 20, 2010 at 8:56 PM, yousay qq263020...@gmail.com wrote: I have sees aprogram like this ,i confusing why super class can access the subclass's attribute To make this easy to understand, I'm going to ***drastically*** oversimplify. With that disclaimer out of the way... When you

Re: Sorted dictionary

2010-01-20 Thread Chris Rebert
On Wed, Jan 20, 2010 at 5:50 PM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Thu, 21 Jan 2010 02:02:02 +0100, Jan Kaliszewski wrote: Hello, Inspired by some my needs as well as some discussions in the net, I've implemented a sorted dictionary (i.e. a dict that returns

Re: list.pop(0) vs. collections.dequeue

2010-01-22 Thread Chris Rebert
On Fri, Jan 22, 2010 at 11:14 AM, Steve Howell showel...@yahoo.com wrote: The v2.6.4 version of the tutorial says this: ''' It is also possible to use a list as a queue, where the first element added is the first element retrieved (“first-in, first-out”); however, lists are not efficient for

Re: py2exe deal with python command line inside a program

2010-01-24 Thread Chris Rebert
On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create a python subprogress, like this: myProcess = subprocess.Popen([sys.executable, 'C:\myscript.py'],                                        env=env,

Re: ctypes for AIX

2010-01-24 Thread Chris Rebert
On Sun, Jan 24, 2010 at 5:54 AM, Waddle, Jim jim.wad...@boeing.com wrote: I need to use ctypes with python running on AIX. According to the ctypes readme, ctypes is based on libffi, which according to its website, supports AIX for PowerPC64. So, perhaps you could state what the actual error or

Re: py2exe deal with python command line inside a program

2010-01-24 Thread Chris Rebert
On Sun, Jan 24, 2010 at 10:25 AM, im_smialing susan_kij...@yahoo.ca wrote: On Jan 24, 6:35 am, Chris Rebert c...@rebertia.com wrote: On Sun, Jan 24, 2010 at 3:28 AM, Jonathan Hartley tart...@tartley.com wrote: On Jan 22, 7:35 pm, susan_kij...@yahoo.ca wrote: Hi, I need to create

Re: Accessing the name of an actual parameter

2010-01-26 Thread Chris Rebert
On Tue, Jan 26, 2010 at 3:48 AM, Hellmut Weber m...@hellmutweber.de wrote: Hi, consider the following piece of code, please - - def f(param):  nameOfParam = ???  # here I want to access the name of the variable  # which was given as parameter to the function  print nameOfParam,

Re: Python or Ant

2010-01-26 Thread Chris Rebert
On Tue, Jan 26, 2010 at 10:58 AM, gslindst...@gmail.com wrote: My company is looking at creating a tool to allow us to define and manage a process for each job we run (a typical job may be look on a customers ftp site for a file, download it, decrypt it and load it into our database). We

Re: Just drawing lines and plotting points?

2010-01-26 Thread Chris Rebert
On Tue, Jan 26, 2010 at 4:36 PM, Someone Something fordhai...@gmail.com wrote: Hello, I need a python library that makes drawing lines and plotting points (these two things are the only things I need to do) easy. Or, how can I do something like this with pygame? Basically, what I want to do

Re: Why am I getting this Error message

2010-01-28 Thread Chris Rebert
On Thu, Jan 28, 2010 at 11:57 AM, Ray Holt mrhol...@sbcglobal.net wrote: Why am I getting the following error message. Area has been declared as an attribute of Circle. Thanks, Ray class Circle:  def __init__(self): self.radius = 1  def area(self): return self.radius *

Re: [OT] Perl 6 [was Re: myths about python 3]

2010-01-28 Thread Chris Rebert
On Thu, Jan 28, 2010 at 9:34 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Thu, 28 Jan 2010 21:21:05 -0800, Tim Roberts wrote: Perl 6, on the other hand, is still fantasyware a decade after its announcement. It is, for the most part, THE canonical example of the wrong

Re: Wrap a function

2010-01-28 Thread Chris Rebert
On Thu, Jan 28, 2010 at 9:44 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Thu, 28 Jan 2010 11:24:28 -0800 (PST), Joan Miller pelok...@gmail.com declaimed the following in gmane.comp.python.general: On 28 ene, 19:16, Josh Holland j...@joshh.co.uk wrote: On 2010-01-28, Joan Miller

Re: Function name unchanged in error message

2010-01-29 Thread Chris Rebert
On Fri, Jan 29, 2010 at 5:30 AM, andrew cooke and...@acooke.org wrote: Is there any way to change the name of the function in an error message?  In the example below I'd like the error to refer to bar(), for example (the motivation is related function decorators - I'd like the wrapper function

Re: Python 3.1 simplejson install

2010-01-29 Thread Chris Rebert
On Fri, Jan 29, 2010 at 6:33 AM, Peter Otten __pete...@web.de wrote: dirknbr wrote: I am trying to install simplejson on Python 3.1 on Windows. When I do 'python setup.py install' I get 'except DisutilsPlatformError, x: SyntaxError' with a dash under the comma. You are trying to install a

Re: ftp.storlines error

2010-01-31 Thread Chris Rebert
On Sun, Jan 31, 2010 at 2:07 PM, Mik0b0 new...@gmail.com wrote: Good day/night/etc. I am rather a newb in Python (learning Python 3). I am trying to create a small script for FTP file uploads  on my home network. The script looks like this: from ftplib import FTP ftp=FTP('10.0.0.1')

Re: Python and Ruby

2010-01-31 Thread Chris Rebert
On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote: In most functional languages you just name a function to access it and you do it ALL the time. for example, in if you have a function 'f' which

Re: Python and Ruby

2010-01-31 Thread Chris Rebert
On Sun, Jan 31, 2010 at 4:25 PM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote: On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote

Re: Python and Ruby

2010-01-31 Thread Chris Rebert
On Sun, Jan 31, 2010 at 5:22 PM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Sun, 31 Jan 2010 16:50:50 -0800, Chris Rebert wrote: How do you call a function of no arguments? It's not really a function in that case, it's just a named constant. (Recall that functions don't

Re: A performance issue when using default value

2010-01-31 Thread Chris Rebert
On Sun, Jan 31, 2010 at 8:58 PM, keakon kea...@gmail.com wrote: I've found strange performance issue when using default value, the test code is list below: from timeit import Timer def f(x):  y = x  y.append(1)  return y def g(x=[]):  y = []  y.append(1)  return y def h(x=[]):  y

Re: Python and Ruby

2010-01-31 Thread Chris Rebert
On Sun, Jan 31, 2010 at 10:05 PM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Sun, 31 Jan 2010 20:22:36 -0800, Paul Rubin wrote: Terry Reedy tjre...@udel.edu writes: Three of you gave essentially identical answers, but I still do not see how given something like def f():

Re: how long a Str can be used in this python code segment?

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu 54wut...@gmail.com wrote: tmp=file.read() (very huge file) if targetStr in tmp:    print find it else:    print not find file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some certain information

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 12:06 PM, Oltmans rolf.oltm...@gmail.com wrote: Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase):    def

Re: Python and Ruby

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 2:28 PM, Jonathan Gardner jgard...@jonathangardner.net wrote: On Jan 31, 3:01 am, rantingrick rantingr...@gmail.com wrote: On Jan 30, 10:43 am, Nobody nob...@nowhere.com wrote: That's also true for most functional languages, e.g. Haskell and ML, as well as e.g. Tcl and

Re: Python and Ruby

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 6:14 PM, MRAB pyt...@mrabarnett.plus.com wrote: Nobody wrote: On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use:  f 2 3 If you want the

Re: How to guard against bugs like this one?

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 6:34 PM, kj no.em...@please.post wrote: I just spent about 1-1/2 hours tracking down a bug. snip Through a *lot* of trial an error I finally discovered that the root cause of the problem was the fact that, in the same directory as buggy.py, there is *another* innocuous

Re: unable to catch this exception

2010-02-02 Thread Chris Rebert
On Tue, Feb 2, 2010 at 3:20 AM, mk mrk...@gmail.com wrote: Exception in thread Thread-9 (most likely raised during interpreter shutdown): Traceback (most recent call last):  File /usr/local/lib/python2.6/threading.py, line 522, in __bootstrap_inner  File /var/www/html/cssh.py, line 875, in

Re: passing string for editing in input()

2010-02-02 Thread Chris Rebert
On Tue, Feb 2, 2010 at 5:24 AM, mk mrk...@gmail.com wrote: Hello, Is there an easy way to get an editing (readline) in Python that would contain string for editing and would not just be empty? I googled but found nothing. Er...: http://docs.python.org/library/readline.html It's the third

Re: Common area of circles

2010-02-04 Thread Chris Rebert
On Thu, Feb 4, 2010 at 2:39 AM, Shashwat Anand anand.shash...@gmail.com wrote: Given 'n' circles and the co-ordinates of their center, and the radius of all being equal i.e. 'one', How can I take out the intersection of their area. How is this at all specific to Python? This also sounds

Re: method names nounVerb or verbNoun

2010-02-05 Thread Chris Rebert
On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wande...@dialup4less.com wrote: Which is the more accepted way to compose method names nounVerb or verbNoun? For example voltageGet or getVoltage? getVoltage sounds more normal, but voltageGet is more like voltage.Get. I seem to mix them and I should

Re: method names nounVerb or verbNoun

2010-02-05 Thread Chris Rebert
On Fri, Feb 5, 2010 at 1:49 PM, Wanderer wande...@dialup4less.com wrote: On Feb 5, 3:26 pm, Chris Rebert c...@rebertia.com wrote: On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wande...@dialup4less.com wrote: Which is the more accepted way to compose method names nounVerb or verbNoun

Re: method names nounVerb or verbNoun

2010-02-05 Thread Chris Rebert
On Fri, Feb 5, 2010 at 2:45 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 05 Feb 2010 12:26:38 -0800, Chris Rebert wrote: On Fri, Feb 5, 2010 at 11:53 AM, Wanderer wande...@dialup4less.com wrote: Which is the more accepted way to compose method names nounVerb

Re: passing string for editing in input()

2010-02-07 Thread Chris Rebert
On Sun, Feb 7, 2010 at 8:24 AM, Aahz a...@pythoncraft.com wrote: In article mailman.1787.1265117353.28905.python-l...@python.org, Chris Rebert  c...@rebertia.com wrote: On Tue, Feb 2, 2010 at 5:24 AM, mk mrk...@gmail.com wrote: Is there an easy way to get an editing (readline) in Python

Re: Modifying Class Object

2010-02-07 Thread Chris Rebert
On Sun, Feb 7, 2010 at 5:05 PM, T misceveryth...@gmail.com wrote: Ok, just looking for a sanity check here, or maybe something I'm missing.  I have a class Test, for example: class Test:    def __init__(self, param1, param2, param3):        self.param1 = param1        self.param2 = param2  

Re: Python 2.4 and list of dictionary issues

2010-02-07 Thread Chris Rebert
On Sun, Feb 7, 2010 at 9:08 PM, Chris Stevens cjstev...@gmail.com wrote: Hi all, I'm a python newbie so please excuse me if I am missing something simple here. I am writing a script which requires a list of dictionaries (originally a dictionary of dictionaries, but I changed it to a list to

Re: Create a backslash-escaped version of a string?

2010-02-08 Thread Chris Rebert
On Mon, Feb 8, 2010 at 3:14 AM, boblatest boblat...@googlemail.com wrote: Hello, I'd like to have control characters in a string to be converted to their backslash-escaped counterparts. I looked in the encoders section of the string module but couldn't find anything appropriate. I could

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Chris Rebert
On Tue, Feb 9, 2010 at 4:38 AM, Steve Holden st...@holdenweb.com wrote: Phlip wrote: Carl Banks wrote: I don't know if it was the reason it was rejected, but a seriously divisive question is whether the path should be a subset of string. OMG that's nothing but the OO circle vs ellipse

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Chris Rebert
On Tue, Feb 9, 2010 at 6:00 AM, Phlip phlip2...@gmail.com wrote: snip Ah, now we get down to the root of the problem. Because Python is so stuck on the one best way to do it mentality, language bigotry prevented the Committee from picking from among several equally valid but non-best options.

Re: Creating formatted output using picture strings

2010-02-10 Thread Chris Rebert
On Wed, Feb 10, 2010 at 12:19 PM, sstein...@gmail.com sstein...@gmail.com wrote: On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote: On 2010-02-10, pyt...@bdurham.com pyt...@bdurham.com wrote: [regardning picture output format specifiers] I was thinking that there was a built-in function for

Re: Need debugging knowhow for my creeping Unicodephobia

2010-02-10 Thread Chris Rebert
On Wed, Feb 10, 2010 at 1:03 PM, kj no.em...@please.post wrote: In 402ac982-0750-4977-adb2-602b19149...@m24g2000prn.googlegroups.com Jonathan Gardner jgard...@jonathangardner.net writes: huge snip It sounds like someone, probably beautiful soup, is trying to turn your strings into unicode. A full

Re: question on storing dates in a tuple

2010-02-10 Thread Chris Rebert
On Wed, Feb 10, 2010 at 5:17 PM, m_ahlenius ahleni...@gmail.com wrote: Hi, I have a weird question about tuples.  I am getting some dates from a mysql db, using the mysqldb interface.  I am doing a standard query with several of the fields are datetime format in mysql. When I retrieve and

Re: Python version of perl's if (-T ..) and if (-B ...)?

2010-02-12 Thread Chris Rebert
On Fri, Feb 12, 2010 at 6:01 AM, Lloyd Zusman l...@asfast.com wrote: Perl has the following constructs to check whether a file is considered to contain text or binary data: if (-T $filename) { print file contains 'text' characters\n; } if (-B $filename) { print file contains 'binary'

Re: Py3: Terminal or browser output?

2010-02-13 Thread Chris Rebert
On Sat, Feb 13, 2010 at 11:46 AM, Gnarlodious gnarlodi...@gmail.com wrote: Hello, searched all over but no success. I want to have a script output HTML if run in a browser and plain text if run in a Terminal. In Python 2, I just said this: if len(sys.argv)==True: That line doesn't make sense

Re: working with laptop battery

2010-02-13 Thread Chris Rebert
On Sat, Feb 13, 2010 at 4:48 PM, Daniel Dalton d.dal...@iinet.net.au wrote: Hi, I'm constantly working in the command line and need to write a program to give me alerts on my battery. Can someone please tell me what module I should use to access battery information? Looking for something that

Re: Using class attributes

2010-02-15 Thread Chris Rebert
On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart l...@lspace.org wrote: I have a base class Foo with a number of derived classes FooA, FooB, FooC, etc. Each of these derived classes needs to read (upon initialisation) text from an associated template file FooA.tmpl, FooB.tmpl, FooC.tmpl, etc.

Re: Talking with ebay using Python

2010-02-15 Thread Chris Rebert
On Mon, Feb 15, 2010 at 6:10 AM, starglider develop starglider@gmail.com wrote: Hi, I need a way of talking with the eBay API: Made search, Ask for item status. What can it be done, and where can I get the info. In the future, search Google and PyPI (http://pypi.python.org/pypi). (PyPI

Re: Talking with ebay using Python

2010-02-15 Thread Chris Rebert
On 15 February 2010 20:04, Chris Rebert c...@rebertia.com wrote: On Mon, Feb 15, 2010 at 6:10 AM, starglider develop starglider@gmail.com wrote: Hi, I need a way of talking with the eBay API: Made search, Ask for item status. What can it be done, and where can I get the info

Re: Python library for working with simple equations

2010-02-18 Thread Chris Rebert
On Thu, Feb 18, 2010 at 1:09 AM, lallous lall...@lgwm.org wrote: Hello Is there is any Python library that allow such things: Given a string expression as: x + 5 + x * (y + 2), any library that can develop the equation for example. Or if we say factor with x then it renders the expression

Re: The future of frozen types as the number of CPU cores increases

2010-02-18 Thread Chris Rebert
On Thu, Feb 18, 2010 at 11:58 AM, John Nagle na...@animats.com wrote: snip   On that note, I went to a talk at Stanford yesterday by one of the designers of Intel's Nelahem core.  The four-core, eight thread version is out now.  The six-core, twelve thread version is working; the speaker has

Re: Constraints on __sub__, __eq__, etc.

2010-02-19 Thread Chris Rebert
On Fri, Feb 19, 2010 at 2:30 AM, Roald de Vries r...@roalddevries.nl wrote: On Feb 18, 2010, at 5:28 PM, Stephen Hansen wrote: On Thu, Feb 18, 2010 at 8:19 AM, Andrey Fedorov anfedo...@gmail.comwrote: It seems intuitive to me that the magic methods for overriding the +, -, , ==, , etc.

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Chris Rebert
On Fri, Feb 19, 2010 at 1:48 PM, MattB mattbar...@gmail.com wrote: Hey all, I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable to open the website, returning the 'errno

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Chris Rebert
On Fri, Feb 19, 2010 at 5:06 PM, MattB mattbar...@gmail.com wrote: On Feb 19, 7:20 pm, MattB mattbar...@gmail.com wrote: On Feb 19, 6:02 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 02/19/10 21:48, MattB wrote: Hey all, I've been working on a program that accesses my

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-20 Thread Chris Rebert
On Fri, Feb 19, 2010 at 11:17 PM, sjdevn...@yahoo.com sjdevn...@yahoo.com wrote: On Feb 20, 1:30 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: If Python doesn’t distinguish between procedures and functions, why should it distinguish between statements and expressions?

Re: calculating a string equation

2010-02-20 Thread Chris Rebert
On Sat, Feb 20, 2010 at 3:07 PM, Astan Chee astan.c...@al.com.au wrote: Arnaud Delobelle wrote: Astan Chee astan.c...@al.com.au writes: Hi, I have some variables in my script that looks like this: vars = {'var_a':'10','var_b':'4'} eqat = (var_a/2.0) = var_b result = (var_a+var_b)/7 What

Re: lists of variables

2010-02-20 Thread Chris Rebert
On Sat, Feb 20, 2010 at 7:25 PM, Michael Pardee python-l...@open-sense.com wrote: I'm relatively new to python and I was very surprised by the following behavior: a=1 b=2 mylist=[a,b] print mylist [1, 2] a=3 print mylist [1, 2] Whoah!  Are python lists only for literals?  Nope:

Re: How would I do a continuous write over a pipe in the following code...

2010-02-21 Thread Chris Rebert
On Sun, Feb 21, 2010 at 1:09 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sat, 20 Feb 2010 12:46:24 -0800 (PST), chad cdal...@gmail.com declaimed the following in comp.lang.python: Given the following #!/usr/bin/python import subprocess as s broadcast = s.Popen(echo test |

Re: with statement and standard library

2010-02-21 Thread Chris Rebert
On Sun, Feb 21, 2010 at 3:21 PM, John Nagle na...@animats.com wrote: nobrowser wrote: Hi.  The with statement is certainly nifty.  The trouble is, the *only* two documented examples how it can be used with the library classes are file objects (which I use all the time) and thread locks which

Re: When will Python go mainstream like Java?

2010-02-22 Thread Chris Rebert
On Mon, Feb 22, 2010 at 8:36 PM, Jonathan Gardner jgard...@jonathangardner.net wrote: On Mon, Feb 22, 2010 at 1:56 PM, AON LAZIO aonla...@gmail.com wrote: That will be superb It already has. Indeed. Python is at position 7, just behind C#, in the TIOBE Index:

Re: How to get memory and CPU status of a particular process

2010-02-22 Thread Chris Rebert
On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka rpjan...@gmail.com wrote: Hi all, Is there a way to get system memory consumption and CPU consumption in a platform independent way, using python...? Basically my requirement is, get the memory status and CPU status of a particular process. If

Re: How to get memory and CPU status of a particular process

2010-02-22 Thread Chris Rebert
On Mon, Feb 22, 2010 at 11:16 PM, Paul Rudin paul.nos...@rudin.co.uk wrote: Chris Rebert c...@rebertia.com writes: On Tue, Feb 23, 2010 at 9:18 AM, R. P. Janaka rpjan...@gmail.com wrote: Is there a way to get system memory consumption and CPU consumption in a platform independent way, using

Re: AKKA vs Python

2010-02-23 Thread Chris Rebert
On Tue, Feb 23, 2010 at 7:59 AM, mk mrk...@gmail.com wrote: Hello everyone, Is there smth like AKKA in Python? http://akkasource.org/ Minus the distributed part, yes; there are a few implementations of actors for Python: http://www.doc.ic.ac.uk/~jwa/stage/ http://osl.cs.uiuc.edu/parley/

Re: Noob raw_input question

2010-02-24 Thread Chris Rebert
On Wed, Feb 24, 2010 at 9:39 AM, Abigail s...@removethis.btinternet.com wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input(Enter a number ) Traceback (most recent call last):  File pyshell#6, line 1, in module    a

Re: When will Java go mainstream like Python?

2010-02-25 Thread Chris Rebert
On Wed, Feb 24, 2010 at 11:03 PM, sjdevn...@yahoo.com sjdevn...@yahoo.com wrote: On Feb 24, 8:05 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message op.u8nfpex8y5e...@laptopwanja, Wanja Gayk wrote: Reference counting is about the worst technique for garbage

Re: Renaming identifiers debugging

2010-02-25 Thread Chris Rebert
On Thu, Feb 25, 2010 at 7:26 AM, Luca lu...@despammed.com wrote: Hello, i am trying to develop an application to teach programming to young kids in a similar way as Logo did in the past. I would like to use an embedded Python as underlying language but this raises a problem. The target of my

Re: Dictionary or Database—Please advise

2010-02-26 Thread Chris Rebert
On Fri, Feb 26, 2010 at 7:58 AM, Jeremy jlcon...@gmail.com wrote: I have lots of data that I currently store in dictionaries.  However, the memory requirements are becoming a problem.  I am considering using a database of some sorts instead, but I have never used them before.  Would a database

Re: A more specific query ...

2010-02-26 Thread Chris Rebert
On Fri, Feb 26, 2010 at 12:45 PM, Gib Bogle g.bo...@auckland.no.spam.ac.nz wrote: How can I interrogate Python to find out where it is looking to find the PyQt4 DLLs in a Windows installation? import sys print(sys.path) Cheers, Chris -- http://blog.rebertia.com --

Re: Pyrhon2.5 to 2.4 conversion

2010-02-27 Thread Chris Rebert
On Sat, Feb 27, 2010 at 5:41 PM, tarek...@gmail.com tarek...@gmail.com wrote: Hi, I am currently using oauth2.py library, and it works fine on one of my PC's (python2.5), but later on when I tried to use it with python2.4 the following line (line 332 in

Re: Draft PEP on RSON configuration file format

2010-02-28 Thread Chris Rebert
On Sun, Feb 28, 2010 at 10:39 PM, John Nagle na...@animats.com wrote: Patrick Maupin wrote: All: Finding .ini configuration files too limiting, JSON and XML to hard to manually edit, and YAML too complex to parse quickly, I have started work on a new configuration file parser.   You're

Re: Adding to a module's __dict__?

2010-03-01 Thread Chris Rebert
On Mon, Mar 1, 2010 at 8:27 PM, Roy Smith r...@panix.com wrote: From inside a module, I want to add a key-value pair to the module's __dict__.  I know I can just do: FOO = 'bar' at the module top-level, but I've got 'FOO' as a string and what I really need to do is __dict__['Foo'] = 'bar'

Re: Call Signtool using python

2010-03-02 Thread Chris Rebert
On Tue, Mar 2, 2010 at 3:34 AM, enda man emann...@gmail.com wrote: Hi, I want to call the Windows signtool to sign a binary from a python script. Here is my script: // os.chdir('./Install/activex/cab') subprocess.call([signtool, sign, /v, /f, webph.pfx, /t,

Re: Interest check in some delicious syntactic sugar for except:pass

2010-03-03 Thread Chris Rebert
On Wed, Mar 3, 2010 at 1:27 AM, Oren Elrad orenel...@gmail.com wrote: Howdy all, longtime appreciative user, first time mailer-inner. I'm wondering if there is any support (tepid better than none) for the following syntactic sugar: silence: block - try:

Re: process mp3 file

2010-03-03 Thread Chris Rebert
On Wed, Mar 3, 2010 at 12:33 AM, asit lipu...@gmail.com wrote: Somebody suggest me a python library for processing mp3 file.  Here I don't want to play the file. Define processing. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: process mp3 file

2010-03-03 Thread Chris Rebert
On Wed, Mar 3, 2010 at 2:43 AM, asit lipu...@gmail.com wrote: Define processing. getting the title, song name, etc of the file and updating in a database You'd want an ID3 tag library then. Here's one: http://eyed3.nicfit.net/ Cheers, Chris -- http://blog.rebertia.com --

Re: Question about typing: ints/floats

2010-03-03 Thread Chris Rebert
On Wed, Mar 3, 2010 at 3:45 PM, Wells thewellsoli...@gmail.com wrote: This seems sort of odd to me: a = 1 a += 1.202 a 2.202 Indicates that 'a' was an int that was implicitly casted to a float. Remember Python is dynamically typed. Values have types, but variables don't (I could do a =

Re: Don't work __getattr__ with __add__

2010-03-04 Thread Chris Rebert
On Thu, Mar 4, 2010 at 12:25 AM, Андрей Симурзин asimur...@gmail.com wrote: It is object of the class A, in conteiner's class tmpA. Not all method from A are in the tmpA. So for exapmle: A + B -- yes , tmpA + B no. I try to call method from A for tmpA. I can to call simple method,  such as

Re: Proper way to return an instance of a class from a class method ?

2010-03-05 Thread Chris Rebert
On Fri, Mar 5, 2010 at 2:35 AM, Auré Gourrier aurelien.gourr...@yahoo.fr wrote: snip QUESTION 2: If I go this way, I have a second problem: if I create a new class which inherits from the previous, I would expect/like the methods from the initial class to return instances from the new class:

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Chris Rebert
On 3/5/10, Pete Emerson pemer...@gmail.com wrote: In a module, how do I create a conditional that will do something based on whether or not another module has been loaded? Suppose I have the following: import foo import foobar print foo() print foobar() ### foo.py def foo:

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Chris Rebert
On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson pemer...@gmail.com wrote: On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert c...@rebertia.com wrote: On 3/5/10, Pete Emerson pemer...@gmail.com wrote: In a module, how do I create a conditional that will do something based on whether or not another

Re: Draft PEP on RSON configuration file format

2010-03-05 Thread Chris Rebert
On Fri, Mar 5, 2010 at 2:45 PM, Aahz a...@pythoncraft.com wrote: In article 7xwrxv4vv7@ruckus.brouhaha.com, Paul Rubin no.em...@nospam.invalid wrote: ReST is another abomination that should never have gotten off the ground. It is one of the reasons I react so negatively to your config

Re: isinstance(False, int)

2010-03-05 Thread Chris Rebert
On Fri, Mar 5, 2010 at 1:51 PM, Terry Reedy tjre...@udel.edu wrote: On 3/5/2010 1:54 PM, Jean-Michel Pichavant wrote: Steven D'Aprano wrote: Despite there are good reasons for bool to be int, the newcomer 'wtf' reaction at first glance is legitimate. Starting python from scratch, booleans

Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Chris Rebert
On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy igo...@yahoo.com wrote: At the command prompt:   python b.py 8 works fine on both XP and Vista   python b.python 8 works on XP (and Linux) but on Vista   python b.python 8 ImportError: No module named b ? Code please. Also, .python is not

Re: python b.python 8 works on XP but not on Vista?

2010-03-06 Thread Chris Rebert
On Sat, Mar 6, 2010 at 4:42 PM, Isaac Gouy igo...@yahoo.com wrote: On Mar 6, 4:02 pm, Chris Rebert c...@rebertia.com wrote: On Sat, Mar 6, 2010 at 3:53 PM, Isaac Gouy igo...@yahoo.com wrote: At the command prompt:   python b.py 8 works fine on both XP and Vista   python b.python 8

Re: negative counts in collections.Counter?

2010-03-08 Thread Chris Rebert
On Mon, Mar 8, 2010 at 4:21 AM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Sun, 07 Mar 2010 22:31:00 -0800, Raymond Hettinger wrote: On Mar 7, 5:46 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Given that Counter supports negative counts, it looks to me

Re: related lists mean value

2010-03-08 Thread Chris Rebert
On Mon, Mar 8, 2010 at 2:34 PM, dimitri pater - serpia dimitri.pa...@gmail.com wrote: Hi, I have two related lists: x = [1 ,2, 8, 5, 0, 7] y = ['a', 'a', 'b', 'c', 'c', 'c' ] what I need is a list representing the mean value of 'a', 'b' and 'c' while maintaining the number of items (len):

Re: Interacting With Another Script

2010-03-10 Thread Chris Rebert
On Wed, Mar 10, 2010 at 4:32 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; There's a program (vpopmail) that has commands which, when called, request input (email address, password, etc.) from the command line. I would like to build a TTW interface for my clients to use that interacts

Re: Interacting With Another Script

2010-03-10 Thread Chris Rebert
On Wed, Mar 10, 2010 at 8:34 AM, Victor Subervi victorsube...@gmail.com wrote: On Wed, Mar 10, 2010 at 12:31 PM, Chris Rebert c...@rebertia.com wrote: Option C. The most user-friendly, and in some sense simplest, one. Figure out the conversation tree vpopmail follows. Create a matching form

Re: equivalent of Ruby's Pathname?

2010-03-10 Thread Chris Rebert
On Wed, Mar 10, 2010 at 8:54 AM, Phlip phlip2...@gmail.com wrote: Martin P. Hellwig wrote: Well even if this statement would be true, I personally think that not proclaiming something a 'standard' if you are sure that you are not sure about it, is a virtue. In terms of trying too hard to

Re: difference between raw_input() and input()

2009-08-20 Thread Chris Rebert
On Thu, Aug 20, 2009 at 3:24 AM, baalu aanandbaaluaan...@gmail.com wrote: Hi,     I have used both raw_input() and input() for a same input value. But these gives different output.     I have listed below what actually I have done             a = raw_input(===)                   === 023  

Re: Object Reference question

2009-08-21 Thread Chris Rebert
On Thu, Aug 20, 2009 at 11:34 PM, Miles Kaufmannmile...@umich.edu wrote: On Aug 20, 2009, at 11:07 PM, josef wrote: snip The following is what I would like to do: I have a list of class instances dk = [ a, b, c, d ], where a, b, c, d is an object reference. Entering dk gives me the object:

<    3   4   5   6   7   8   9   10   11   12   >