Re: Mapping a series of Dates to an array of Numbers

2008-06-17 Thread Chris
On Jun 17, 2:15 pm, J-Burns <[EMAIL PROTECTED]> wrote: > Hello. Got a problem here. > > Ive got a set of points tht id be plotting. Those points would contain > the date on which the work was done against its frequency. Supposedly > if i did something on the 28th of March one of the points would be

Re: Pattern Matching Over Python Lists

2008-06-19 Thread Chris
Thanks for your help. Those weren't quite what I was looking for, but I ended up figuring it out on my own. Turns out you can actually search nested Python lists using simple regular expressions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Over Python Lists

2008-06-19 Thread Chris
On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote: > Kirk Strauser: > > > Hint: recursion. Your general algorithm will be something like: > > Another solution is to use a better (different) language, that has > built-in pattern matching, or allows to create one. > > Bye, > bearophile Btw, Python's stdl

images on the web

2008-06-19 Thread chris
I'm creating a data plot and need to display the image to a web page. What's the best way of doing this without having to save the image to disk? I already have a mod_python script that outputs the data in tabular format, but I haven't been able to find anything on adding a generated image. -- http

Re: images on the web

2008-06-20 Thread chris
On Jun 20, 1:52 am, Michael Ströder <[EMAIL PROTECTED]> wrote: > Matt Nordhoff wrote: > > Matt Nordhoff wrote: > >> You could use data: URIs [1]. > > >> For example, a 43-byte single pixel GIF becomes this URI: > > >> > > >> They don't have universal browser support, but that might not be a > >> p

Re: Getting column names from a cursor using ODBC module?

2008-06-21 Thread Chris
On Jun 21, 3:58 pm, [EMAIL PROTECTED] wrote: > Is there any way to retrieve column names from a cursor using the ODBC > module? Or must I, in advance, create a dictionary of column position > and column names for a particular table before I can access column > values by column names? I'd prefer sti

Re: Pattern Matching Over Python Lists

2008-06-22 Thread Chris
On Jun 19, 9:03 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jun 20, 10:45 am, Chris <[EMAIL PROTECTED]> wrote: > > > On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote: > > > > Kirk Strauser: > > > > > Hint: recursion. Your general algorithm will be

Re: python -regular expression - list element

2008-06-25 Thread Chris
On Jun 25, 12:32 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > antar2 <[EMAIL PROTECTED]> writes: > > for x in list1: > >    re.compile(x) > >    for y in list2: > >            re.compile(y) > >            if x in y: > >                    z = re.sub(x, 'u', y) > > but this does not work > > You need

Re: Question on List

2008-06-27 Thread Chris
on) print new_list n -= 1 Obviously I'm going to assume that the code you posted excluded your loop control for the "try n amount of times". What was most likely the cause is that you loop through your structure for every attempt of the n times but each time you reset your list when you re-create it. Hope that helps some. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for Null?

2008-06-29 Thread Chris
On Jun 29, 3:12 am, c0mrade <[EMAIL PROTECTED]> wrote: > Try something like this... > > list = ['lkdfjsldk', None, '', '0', 'slfkjsdlfj', 'lsdgjdlfg', False, True] > for n, it in enumerate(list): >     if not it: print 'Error on this definition' >     else: print '%d. %s' % (n+1, it) > > Results: >

Re: simple UnZip

2008-07-02 Thread Chris
On Jul 2, 3:39 pm, noydb <[EMAIL PROTECTED]> wrote: > Can someone help me with this script, which I found posted elsewhere? > I'm trying to figure out what is going on here so that I can alter it > for my needs, but the lack of descriptive names is making it > difficult.  And, the script doesn't qu

Re: site-packages, unzipepd there but import fails

2008-07-03 Thread Chris
On Jul 3, 4:11 pm, defn noob <[EMAIL PROTECTED]> wrote: > i unzipped and put the folder in site-packages. when i run setup.py > install nothing happens. > > when i do import pp from shell it complains it doesnt exist. > > isnt placing the folder in site-packages enough? > > these setup.py-files oft

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Chris
On Jul 9, 7:48 am, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]> wrote: > Try this: > > >>> li=[0,0,1,2,1,0,0] > >>> li > > [0, 0, 1, 2, 1, 0, 0]>>> [i for i in range(len(li)) if li[i] != 0] > > [2, 3, 4] > > Cheers, > > Raj > > > > On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey <[EMAIL PROTECT

Re: Returning the positions of a list that are non-zero

2008-07-09 Thread Chris
On Jul 9, 7:48 am, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]> wrote: > Try this: > > >>> li=[0,0,1,2,1,0,0] > >>> li > > [0, 0, 1, 2, 1, 0, 0]>>> [i for i in range(len(li)) if li[i] != 0] > > [2, 3, 4] > > Cheers, > > Raj > > > > On Tue, Jul 8, 2008 at 10:26 PM, Benjamin Goudey <[EMAIL PROTECT

Using Groups inside Braces with Regular Expressions

2008-07-13 Thread Chris
ving me an "unbalanced parenthesis" error for the [^] part. If this isn't valid regex syntax, how else would I match a block of text that doesn't the delimiter pattern? Thanks, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Groups inside Braces with Regular Expressions

2008-07-13 Thread Chris
On Jul 13, 8:14 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Jul 14, 12:05 am, Chris <[EMAIL PROTECTED]> wrote:> I'm trying to delimit > sentences in a block of text by defining the > > end-of-sentence marker as a period followed by a space followed by an >

Re: How can i use a variable without define it ?

2008-07-16 Thread Chris
On Jul 16, 11:06 am, zhw <[EMAIL PROTECTED]> wrote: > On 7月16日, 下午4时47分, Ben Finney <[EMAIL PROTECTED]> > wrote: > > > > > zhw <[EMAIL PROTECTED]> writes: > > > How can i use a variable without define it ? > > > What do you mean by "use"? That's so vague I can think of many > > possible interpretat

Good HTML Parser

2008-07-17 Thread Chris
Can anyone recommend a good HTML/XHTML parser, similar to HTMLParser.HTMLParser or htmllib.HTMLParser, but able to intelligently know that certain tags, like , are implicitly closed? I need to iterate through the entire DOM, building up a DOM path, but the stdlib parsers aren't calling handle_endta

Re: Remove some characters from a string

2008-07-17 Thread Chris
On Jul 17, 10:13 am, Julien <[EMAIL PROTECTED]> wrote: > Hi, > > I can't seem to find the right regular expression to achieve what I > want. I'd like to remove all characters from a string that are not > numbers, letters or underscores. > > For example: > > >>> magic_function('[EMAIL PROTECTED]') >

Re: Python Behind a Squid Corporate Proxy on Windows

2008-07-18 Thread Chris
On Jul 17, 6:40 pm, Larry Hale <[EMAIL PROTECTED]> wrote: > Err, the line above should be: > > proxy_handler = urllib2.ProxyHandler( { "http": "http:// > myusername:[EMAIL PROTECTED]:3128" } ) > > (Sorry!  :) some old code I wrote to download public domain info for our company, also through a squi

Re: howto check is function capable of obtaining **kwargs?

2008-07-21 Thread Chris
gs is returned: (args, varargs, varkw, defaults). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments. Hope that helps. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: maximum value in a column of file

2008-07-23 Thread Chris
On Jul 23, 9:25 am, maurizio <[EMAIL PROTECTED]> wrote: >  which is the best way for the calculation of the maximum value in a >     column of a file? oddly enough >>> help(max) Help on built-in function max in module __builtin__: max(...) max(iterable[, key=func]) -> value max(a, b, c,

Re: concatenate the elements in each list of a list of lists

2008-07-23 Thread Chris
On Jul 23, 5:33 pm, antar2 <[EMAIL PROTECTED]> wrote: > I already asked a similar question, but encounter problems with > python... > How can I concatenate the elements in each list of a list of lists > > list_of_listsA = > > [['klas*', '*', '*'], > ['mooi*', '*', '*', '*'], > ['arm*', '*', '*(haar

Re: pixel colour on screen

2008-07-26 Thread chris
On Jun 30, 4:37 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > >Could anyone help me, I'm a python noob and need some help. im trying > >to find some code that will, given ascreenco-ordinate, will give me > >thecolourof thatpixelin RGB. i have found a lot about getting th

Executing Python From Perl

2008-07-30 Thread Chris
I have an old application that has an embedded Perl interpreter exposing an API. However, all the code I have needs to use the API is in Python. What's the easiest way access my Python code from inside Perl? The closest thing I've found is the Inline::Python module (http://search.cpan.org/~neilw/In

Re: how to split text into lines?

2008-07-31 Thread Chris
On Jul 31, 7:26 am, alex23 <[EMAIL PROTECTED]> wrote: > kj wrote: > > Sorry, I should have googled this first.  I just found splitlines()... > > > Still, for my own edification, is there a way to achieve the same > > effect using re.split? > > re.split(os.linesep, ) works the same as .splitlines()

Re: regex question

2008-08-05 Thread Chris
On Aug 5, 2:23 pm, Jeff <[EMAIL PROTECTED]> wrote: > On Aug 5, 7:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > On Tue, 05 Aug 2008 11:39:36 +0100, Fred Mangusta wrote: > > > In other words I'd like to replace all the instances of a '.' character > > > with something (say noth

Re: if len(str(a)) == len(str(r)) and isMult(a, r): faster if isMult is slow?

2008-08-11 Thread Chris
atements to see how much time is spent on each, also note your mean failure rate for each conditional test and then decide for yourself which to place first. Hope that helps, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: splitting an XML file on the basis on basis of XML tags

2008-04-02 Thread Chris
[EMAIL PROTECTED] wrote: > Hi all, > > i have an XML file with the following structure:: > > > -| > | > | > . | > . | > constitutes one record. > . | > . | > . | > | > | > | > > . > .

Re: splitting an XML file on the basis on basis of XML tags

2008-04-03 Thread Chris
On Apr 3, 8:51 am, Steve Holden <[EMAIL PROTECTED]> wrote: > bijeshn wrote: > > On Apr 2, 5:37 pm, Chris <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> Hi all, > >>>  

Re: new user needs help!

2008-04-10 Thread Chris
" >     if matches[a][1]=='V' and matches[a][0]==1: > >         print "    1  1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 11:0 12:0 > 13:0 14:0 15:0 16:0 17:0 18:1 19:0 20:0 21:0" >     if matches[a][1]=='X' and matches[a][0]==1: > >         print "    1  1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 11:0 12:0 > 13:0 14:0 15:0 16:0 17:0 18:0 19:1 20:0 21:0" >     if matches[a][1]=='Y' and matches[a][0]==1: > >         print "    1  1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 11:0 12:0 > 13:0 14:0 15:0 16:0 17:0 18:0 19:0 20:1 21:0" >     if matches[a][1]=='Z' and matches[a][0]==1: > >         print "    1  1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:0 11:0 12:0 > 13:0 14:0 15:0 16:0 17:0 18:0 19:0 20:0 21:1" >    waiting for ur opinion. >    thanks > > -- > View this message in > context:http://www.nabble.com/new--user-needs-help%21-tp16571823p16596608.html > Sent from the Python - python-list mailing list archive at Nabble.com. Masses of print statements might work for debugging but you can get a better structure through something else. If you have a specific message for those you could always build a dictionary containing the messages and access them like msg_dict = {'A':'Message for A', 'B':'Message for B',..,'Z':'Message for Z'} for part1, part2 in matches: # You have a 2 element structure, (part1, part2) inside the list and lists are iterable if part2 == 1: # Test the value try: print msg_dict[part1] except KeyError: print 'Amino Acid listed not on record' # or you can just simply pass over and not log anything Hope that helps. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: new user needs help!

2008-04-10 Thread Chris
On Apr 10, 10:07 am, Chris <[EMAIL PROTECTED]> wrote: > On Apr 9, 11:02 pm, drjekil <[EMAIL PROTECTED]> wrote: > > > > > I have done something so far about that problem,but its not the good way to > > do it > > > need ur comments about that...

Re: Rounding a number to nearest even

2008-04-15 Thread Chris
On Apr 15, 11:22 am, Sjoerd Mullender <[EMAIL PROTECTED]> wrote: > Thomas Dybdahl Ahle wrote: > > On Fri, 2008-04-11 at 03:14 -0700, bdsatish wrote: > >> The built-in function round( ) will always "round up", that is 1.5 is > >> rounded to 2.0 and 2.5 is rounded to 3.0. > > >> If I want to round to

Re: Rounding a number to nearest even

2008-04-15 Thread Chris
On Apr 15, 12:33 pm, Chris <[EMAIL PROTECTED]> wrote: > On Apr 15, 11:47 am, Duncan Booth <[EMAIL PROTECTED]> > wrote: > > > Chris <[EMAIL PROTECTED]> wrote: > > > even is closer to even.75 than even+1.25.  Why should it be rounded > > > up

Re: Rounding a number to nearest even

2008-04-15 Thread Chris
On Apr 15, 11:47 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Chris <[EMAIL PROTECTED]> wrote: > > even is closer to even.75 than even+1.25.  Why should it be rounded > > up ? > > Because the OP wants to round values to the nearest integer. Only values of > t

Re: where is pythoncard program ?

2008-04-15 Thread Chris
On Apr 15, 1:04 pm, bvidinli <[EMAIL PROTECTED]> wrote: > i installed pythoncard, but i could not find how to start it ? > where can i find its executable/binary ? > or menu item ? > or command line that i should  enter ? > > thanks. > > -- > Ý.Bahattin Vidinli > Elk-Elektronik Müh. > -

Re: I just killed GIL!!!

2008-04-17 Thread Chris
On Apr 17, 11:49 am, Marco Mariani <[EMAIL PROTECTED]> wrote: > Torsten Bronger wrote: > >>> If I were you I would keep it a secret until a Hollywood producer > >>> offers big bucks for the film rights. > >> Who would play Guido, I wonder? > > > Ralf Möller.  No other. > > And the GIL killer? > > C

Re: problem with dictionaries

2008-04-23 Thread Chris
On Apr 23, 1:16 pm, Simon Strobl <[EMAIL PROTECTED]> wrote: > Hello, > > the idea of the following program is to parse a frequency list of the > form FREQUENCY|WORD, to store the frequency of a word in a dictionary > (and to do some things with this information later). > > I have done this many man

Installer

2008-04-24 Thread Chris
Hey all, I've created a python program that relies on pysqlite, wxpython, and matplotlib. Is there any way of creating an installer that will install all these modules, python 2.5 and my program? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: open filename with spaces in path

2008-05-07 Thread Chris
On May 7, 1:09 am, "Kam-Hung Soh" <[EMAIL PROTECTED]> wrote: > On Wed, 07 May 2008 08:36:35 +1000, Michael Robertson   > > <[EMAIL PROTECTED]> wrote: > > I'm having trouble opening a file in linux, whose path has spaces in it. > > > $ mkdir my\ test > > $ echo test > my\ test/test.txt > > $ python

Re: open filename with spaces in path

2008-05-07 Thread Chris
On May 7, 3:25 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-05-07, Chris <[EMAIL PROTECTED]> wrote: > > >>>> os.chdir('C:\temp\my test') > > Traceback (most recent call last): > >   File "", line 1, in >

Re: need help using enumerate ??

2008-08-22 Thread Chris
On Aug 22, 1:14 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am trying to take some data in file that looks like this > > command colnum_1 columnum_2 > > and look for the command and then cange the value in the collum(word) > number indicated. I am under > the impression I need enumera

How to get PyTypeObject from PyObject?

2008-08-25 Thread chris
I want to check the type of an object, right now I am doing strcmp( object->ob_type->tp_name, "MyClass") Which seems slow, is there a way I can find the pointer to the global PyTypeObject for MyClass, and then just call PyObject_TypeCheck? Thanks -- http://mail.python.org/mailman/listinfo/python

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Chris
On Aug 28, 6:11 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I am new to Python and have one simple question to which I cannot find > a satisfactory solution. > I want to read text line-by-line from a text file, but want to ignore > only the first line. I know how to do it in Jav

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Chris
On Aug 28, 11:53 am, Ken Starks <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hello, > > > I am new to Python and have one simple question to which I cannot find > > a satisfactory solution. > > I want to read text line-by-line from a text file, but want to ignore > > only the first lin

Re: filter in for loop

2008-08-28 Thread Chris
On Aug 28, 12:20 pm, GHZ <[EMAIL PROTECTED]> wrote: > I would like to say something like: > > for x in l if : >     > > e.g. > > for filename in os.listdir(DIR) if filename[-4:] == '.xml': >     > > instead of having to say: > > for filename in os.listdir(DIR): >     if filename[-4:] == '.xml': >

Accessing __slots__ from C

2008-09-10 Thread Chris
low is an example of what I'm talking about. I use SciPy's weave to inline C code, but I assume that doesn't make any difference to my problem. Thanks for any suggestions, Chris class MyObject(object): __slots__ = ['attr_one'] def __init__(self,attr_one=1.0):

Re: Accessing __slots__ from C

2008-09-11 Thread Chris
firmation. We'd been hoping to avoid creating such a struct... Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing __slots__ from C

2008-09-11 Thread Chris
red to the actual attribute lookup. Thanks for the advice, Chris -- http://mail.python.org/mailman/listinfo/python-list

Finding tcltk when building Python on Windows

2008-09-11 Thread Chris
t;INSTALLDIR=..\..\tcltk" when building). This is then supposed to be found when I build Python. But tcl/tk isn't found, so I assume I didn't do the right thing here. I feel a bit stupid! I also can't find any explicit instructions for building Python with tcl/tk support us

Re: Accessing __slots__ from C

2008-09-12 Thread Chris
mple is appended to this message). I guessed the type of offset; I'm not sure what it should be. I couldn't find any information about d_member on the web. > There might be some macros to simplify this. Sorry to say that I also have no idea about where to find such macr

Re: Accessing __slots__ from C

2008-09-12 Thread Chris
Hrvoje Niksic xemacs.org> writes: ... > Chris users.sourceforge.net> writes: > > >> PyObject_GetAttrString is convenient, but it creates a Python string > >> only so it can intern it (and in most cases throw away the freshly > >> created version). For ma

Re: Accessing __slots__ from C

2008-09-16 Thread Chris
as great, thanks! Now we have done exactly what we wanted, and have fast access from C to two particular attributes of instances of a particular class. We use that fast access in optimized versions of pure-Python components of our simulator. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie wxPython questions.

2006-04-07 Thread chris
Oh, by the way... in your frame's constructor (the Frame1.__init__), you'll have to make "parent" a member variable of the class so that OnCloseMe has access to it. I.e., in the __init__ add self.FrameParent = parent Then in OnCloseMe do: self.FrameParent.Close() -- http://mail.python.org/mailm

Re: How to run python script in emacs

2009-10-08 Thread Chris
> if you want, i can suggest you some lines for the init file .emacs, > in order to keep the text indented with 4 spaces, no tab at all (very > important). I would be interest in the .emacs changes for python mode. -- http://mail.python.org/mailman/listinfo/python-list

PyQT4 user group

2009-10-29 Thread Chris
Hi! I'm starting to learn and use PyQT4 at work. Is there a good user group or forum out there that I should know about? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

aggregation for a nested dict

2010-12-02 Thread chris
Hi, i would like to parse many thousand files and aggregate the counts for the field entries related to every id. extract_field grep the identifier for the fields with regex. result = [ { extract_field("id", line) : [extract_field("field1", line),extract_field("field2", line)]} for line in FIL

Re: aggregation for a nested dict

2010-12-02 Thread chris
I very appreciate all responses. It's incredible how fast it is! Cheers Christian -- http://mail.python.org/mailman/listinfo/python-list

Decorator question

2011-01-26 Thread Chris
would result in: 'in foo' Exception: ... This exact solution isn't necessary, just something that doesn't require me to have the clunky: def foo(self,...): if self.b: ... else: raise Exception('b attribute must be true before executing this method') in e

Re: Decorator question

2011-01-26 Thread Chris
On Jan 26, 6:17 pm, Chris wrote: > I have a class (A, for instance) that possesses a boolean (A.b, for > instance) that is liable to change over an instance's lifetime. > > Many of the methods of this class (A.foo, for instance) should not > execute as long as this boolean

socket.getsockopt() and SO_ORIGINAL_DST

2010-05-20 Thread chris
s fine. But I really need this problem to be solved in Python. Do you have any ideas? Thanks for any support in advance and regards, Chris PS: I know there are ugly work-arounds to parse /proc/net/ip_conntrack to do this job, but I will defenitely avoid that. -- http://mail.python.org/mailman/listinfo/python-list

Re: socket.getsockopt() and SO_ORIGINAL_DST

2010-05-21 Thread chris
dr = s.accept() dst = conn.getsockopt(SOL_IP, SO_ORIGINAL_DST, 16) srv_port, srv_ip = struct.unpack("!2xH4s8x", dst) print "original %s:%d" % (inet_ntoa(srv_ip), srv_port) Basically, my fault was not specifying the buffer length :( Have fun with it, whoever needs it. Regards,

Python WSDL Support

2009-06-19 Thread Chris
Is there any modern support for WSDL? The only projects I could find are ZSI and SOAPpy, and both have been dead for several years. -- http://mail.python.org/mailman/listinfo/python-list

multiprocessing managers and socket connection.

2009-08-25 Thread Chris
I've been using multiprocessing managers and I really like the functionality. I have a question about reconnecting to a manager. I have a situation where I start on one machine (A) a manager that is listening and then on another machine (B) connects to that manager and uses its proxy object to cal

Re: multiprocessing managers and socket connection.

2009-08-26 Thread Chris
On Aug 25, 9:11 pm, Terry wrote: > On Aug 25, 10:14 pm, Chris wrote: > > > > > I've been using multiprocessing managers and I really like the > > functionality. > > > I have a question about reconnecting to a manager. I have a situation > > where

Trouble with MySQLdb

2009-09-15 Thread Chris
I'm receiving the following error: Traceback (most recent call last): File "db.py", line 189, in rows = db.get("SELECT * FROM survey") File "db.py", line 55, in get self.sql(query) File "db.py", line 47, in sql return self.cursor.execute(query) File "build/bdist.linux-i686/e

Re: multiprocessing managers and socket connection.

2009-09-18 Thread Chris
On Aug 31, 10:41 pm, Terry wrote: > On Aug 26, 7:25 pm, Chris wrote: > > > > > On Aug 25, 9:11 pm, Terry wrote: > > > > On Aug 25, 10:14 pm, Chris wrote: > > > > > I've been using multiprocessing managers and I really like the > &

Re: multiprocessing managers and socket connection.

2009-09-18 Thread Chris
On Sep 18, 12:42 pm, "bouncy...@gmail.com" wrote: > Is this "server" something you wrote from scratch or something that is just > being used. Some details are left out > > -- > > --Original Message-- > From: Chris > To: > Date: F

From IDL to Python

2010-09-13 Thread Chris
Hi, I'm an IDL user since years and try now to learn Python since a few days. I'm blogging the various steps of this transition to: http://idl2python.blogspot.com/ I hope that other IDL switchers can help me by commenting on the blog and helping (me and others) to learn quickly the basics of Pyth

{ '0':'c->c->a' ,'1':'a->b->a' .........}

2010-11-07 Thread chris
Hi, have anybody a hint , how i get a dict from non unique id's and their different related values. Thanks for advance Chris ###random data # a=range(10)*3 def seqelem(): i=random.randint(0,2) elem=['a','b','c'][i] return elem s=[seqelem()

Re: First python program, syntax error in while loop

2013-05-06 Thread Chris Angelico
On Mon, May 6, 2013 at 11:08 PM, Roy Smith wrote: > On the other hand, I've long since given up trying to remember operator > precedence in various languages. If I ever have even the slightest > doubt, I just go ahead and put in the extra parens. If I ever have even the slightest doubt, I just g

Re: socket programming

2013-05-06 Thread Chris Angelico
On Tue, May 7, 2013 at 1:54 AM, Pedro wrote: > Thanks for the reply. I'm sending short strings as commands to my server > machine so the socket module seems to be doing the trick reliably. I'll try > to add Twisted to my arsenal though. > Cheers I've never used Twisted, so I can't say how good

Re: First python program, syntax error in while loop

2013-05-06 Thread Chris Angelico
On Tue, May 7, 2013 at 6:11 AM, Terry Jan Reedy wrote: > On 5/6/2013 11:31 AM, Roy Smith wrote: >> >> In article , >> Chris Angelico wrote: >>> If I ever have even the slightest doubt, I just go ahead and type >>> " operator precedence" into

Re: python backup script

2013-05-06 Thread Chris Angelico
On Tue, May 7, 2013 at 5:01 AM, MMZ wrote: > username = config.get('client', 'mmz') > password = config.get('client', 'pass1') > hostname = config.get('client', 'localhost') Are 'mmz', 'pass1', and 'localhost' the actual values you want for username, password, and hostname? If so, don't pass them

Re: python backup script

2013-05-06 Thread Chris Angelico
On Tue, May 7, 2013 at 8:40 AM, MMZ wrote: > Thanks Chris. you are right. > So I used them directly and removed configParser. The new error is: > > Traceback (most recent call last): > File "./bbk.py", line 11, in ? > for database in os.popen(database_list_comma

Re: Red Black Tree implementation?

2013-05-06 Thread Chris Angelico
On Tue, May 7, 2013 at 10:55 AM, duncan smith wrote: > Here's the text I usually prepend. > > > ##Copyright (c) 2013 duncan g. smith > ## > ##Permission is hereby granted, free of charge, to any person obtaining a > ##copy of this software and associated documentation files (the "Software"), > ##t

Re: First python program, syntax error in while loop

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 4:10 PM, Mark Lawrence wrote: > On 07/05/2013 01:17, alex23 wrote: >> >> On May 6, 10:37 pm, Mark Lawrence wrote: >>> >>> One of these days I'll work out why some people insist on using >>> superfluous parentheses in Python code. Could it be that they enjoy >>> exercising

Re: use python to split a video file into a set of parts

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 9:15 PM, iMath wrote: > I use the following python code to split a FLV video file into a set of parts > ,when finished ,only the first part video can be played ,the other parts are > corrupted.I wonder why and Is there some correct ways to split video files Most complex f

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 11:22 PM, jmfauth wrote: > There are plenty of good reasons to use Python. There are > also plenty of good reasons to not use (or now to drop) > Python and to realize that if you wish to process text > seriously, you are better served by using "corporate > products" or tools

Re: First python program, syntax error in while loop

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 10:44 PM, Ombongi Moraa Fe wrote: > My first language was Pascal. It was at a time in 2005 when computers were > finally becoming popular in Africa and our year was the first time a girls > school from our Province did a computer coursework for National Exams. (That > was su

Re: Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread Chris Angelico
On Wed, May 8, 2013 at 12:57 AM, MRAB wrote: > Also, please read this: > > http://wiki.python.org/moin/GoogleGroupsPython > > because gmail insists on adding extra linebreaks, which can be somewhat > annoying. Accuracy correction: It's nothing to do with gmail, which is what I use (via python-lis

Re: Making safe file names

2013-05-07 Thread Chris Angelico
On Wed, May 8, 2013 at 8:18 AM, Fábio Santos wrote: > I suggest Base64. b64encode > (http://docs.python.org/2/library/base64.html#base64.b64encode) and > b64decode take an argument which allows you to eliminate the pesky "/" > character. It's reversible and simple. But it doesn't look anything li

Re: cello library

2013-05-08 Thread Chris Angelico
On Wed, May 8, 2013 at 7:39 PM, Mark Lawrence wrote: > Hi folks, > > I thought some of you might find this interesting [link redacted] If this is a legit post, can you please elaborate on just _why_ we would find it interesting? I'm leery of clicking random links like that without at least some i

Re: MySQL Database

2013-05-08 Thread Chris Angelico
On Thu, May 9, 2013 at 4:52 AM, Kevin Holleran wrote: > Will using db_c to update the database mess up the loop that is cycling > through db_c.fetchall()? Nope; fetchall() returns a list, which you're then iterating over. Nothing the database does can disrupt that. ChrisA -- http://mail.python.

Re: cello library

2013-05-08 Thread Chris Angelico
On Thu, May 9, 2013 at 7:06 AM, Terry Jan Reedy wrote: > Legitimate request, like some I have made of others. Since I trust Mark: It's actually nothing to do with trusting Mark. I've often seen posts from addresses of people I trust, but with links that I definitely would not want to click... and

Re: Style question -- plural of class name?

2013-05-08 Thread Chris Angelico
On Thu, May 9, 2013 at 6:20 AM, Roy Smith wrote: > "A list of FooEntry's" Only if you put another apostrophe in: "A list of 'FooEntry's" But the delimited style is almost never of use. I'd go for this only if there were some sort of automated markup being applied - if the word FooEntry were tur

Re: Making safe file names

2013-05-08 Thread Chris Angelico
On Thu, May 9, 2013 at 10:16 AM, Roy Smith wrote: > Pro-tip, guys. If you want to form a band, and expect people to be able > to find your stuff in a search engine some day, don't play cute with > your name. It's the modern equivalent of names like Catherine Withekay. ChrisA -- http://mail.pyt

Re: object.enable() anti-pattern

2013-05-08 Thread Chris Angelico
On Thu, May 9, 2013 at 3:37 PM, Steven D'Aprano wrote: > I can see use-cases for separating "make it go" from initialisation. It > all depends on what you might want to do to the object before making it > go. If the answer is "Nothing", then there is no reason not to have the > constructor make it

Re: Append to python List

2013-05-09 Thread Chris Angelico
On Thu, May 9, 2013 at 4:36 PM, RAHUL RAJ wrote: > output=[x for x in sample2 if x not in output] > > output=[] > for x in sample2: > if x not in output: > output.append(x) The first one constructs a list, then points the name 'output' at it. The second one builds up a list, with 'output'

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:35 AM, chandan kumar wrote: > > Hi all, > I'm new to python and facing issue using serial in python.I'm facing the > below error > > ser.write(port,command) > NameError: global name 'ser' is not defined > > Please find the attached script and let me know whats wrong

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:35 AM, chandan kumar wrote: > Please find the attached script and let me know whats wrong in my script > and also how can i read data from serial port for the same script. Don't do this: except serial.serialutil.SerialException: print "Exception" se

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 4:59 AM, Roy Smith wrote: > It's not hard to imagine a > file class which could be used like: > > f = file("/path/to/my/file") > f.delete() > > That would be a totally different model from the current python file > object. And then there would be plenty of things you might

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 8:30 AM, Ian Kelly wrote: > On Thu, May 9, 2013 at 3:51 PM, Mark Janssen > wrote: >> the community stays fractured. > > The open source community seems pretty healthy to me. What is the > basis of your claim that it is "fractured"? The carpentry community is fractured.

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 9:58 AM, alex23 wrote: > On 10 May, 07:51, Mark Janssen wrote: >> Languages can reach for an optimal design (within a >> constant margin of leeway). Language "expressivity" can be measured. > > I'm sure that's great. I, however, have a major project going live in > a few

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 12:30 PM, Steven D'Aprano wrote: > I must admit I am astonished at how controversial the opinion "if your > object is useless until you call 'start', you should automatically call > 'start' when the object is created" has turned out to be. I share your astonishment. This i

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:19 PM, Mark Janssen wrote: >> I think where things went pear shaped is when you made the statement: >> There is no sensible use-case for creating a file OBJECT unless it initially wraps an open file pointer. >> >> That's a pretty absolute point of view. Life is

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:08 PM, Mark Janssen wrote: > On Thu, May 9, 2013 at 4:58 PM, alex23 wrote: >> On 10 May, 07:51, Mark Janssen wrote: >>> You see Ian, while you and the other millions of coding practitioners >>> have (mal)adapted to a suboptimal coding environment where "hey >>> there's

Re: Message passing syntax for objects | OOPv2

2013-05-10 Thread Chris Angelico
On Fri, May 10, 2013 at 2:55 PM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> The first hard disk I ever worked with stored 20MB in the space of a >> 5.25" slot (plus its associated ISA controller card). > > Heh. The first hard disk I ever wo

Re: object.enable() anti-pattern

2013-05-10 Thread Chris Angelico
On Sat, May 11, 2013 at 12:37 AM, Roy Smith wrote: > I suppose, if I had a class like this, I would write a factory function > which called the constructor and post-construction initializer. And > then I would make the constructor protected. That sounds like a reasonable plan, with the possible

Re: object.enable() anti-pattern

2013-05-10 Thread Chris Angelico
On Sat, May 11, 2013 at 12:54 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Sat, May 11, 2013 at 12:37 AM, Roy Smith wrote: >> > I suppose, if I had a class like this, I would write a factory function >> > which called the constructor

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