Re: Ann: New Python curses book

2021-04-11 Thread Daniel Nelson
On Tue, Mar 30, 2021 at 12:12:19PM +0100, Alan Gauld via Python-list wrote: > I've just published, in Kindle and paperback formats, > my book on "Programming curses with Python". > > https://www.amazon.co.uk/dp/B091B85B77/ > > (It should be available in most other Amazon stores too) This looks h

stat_result.st_ino from os.stat isn't constant on a network drive.

2020-08-26 Thread Andrew Nelson
OS: windows 7 Python: 3.8 I am trying to track which files have been modified in a directory on a network mount. When I call the os.stat function for a given file in that directory the stat_result.st_ino changes every time I call it: ``` >>> os.stat('U:\data\current\myfile') os.stat_result(st_mod

Re: Welcome to the "Python-list" mailing list (Digest mode)

2018-01-28 Thread nelson jon kane
When I enter the word python in the search box on my Chrome Windows 10, this is what comes up. Can you tell me what each of these "types" of Python mean? Thank you. [cid:aa3fd74d-d71d-42c0-b063-4f20c463987b] From: Python-list on behalf of python-list-requ...@p

Re: Welcome to the "Python-list" mailing list (Digest mode)

2018-01-28 Thread nelson jon kane
27;ll check out the FOR Loop in python and see how it is different from the WHILE Loop. ____ From: nelson jon kane Sent: Sunday, January 28, 2018 6:05:04 PM To: python-list@python.org Subject: Re: Welcome to the "Python-list" mailing list (Digest mode) W

Extension of while syntax

2014-12-11 Thread Nelson Crosby
I was thinking a bit about the following pattern: value = get_some_value() while value in undesired_values: value = get_some_value() I've always hated code that looks like this. Partly due to the repetition, but partly also due to the fact that without being able to immediately recognise th

Free vs proprietary (was Re: NumPy, SciPy, & Python 3X Installation/compatibility issues)

2014-05-10 Thread Nelson Crosby
I also believe in this more 'BSD-like' view, but from a business point of view. No one is going to invest in a business that can't guarantee against piracy, and such a business is much less likely to receive profit (see Ardour). Don't get me wrong - I love free software. It's seriously awesome t

Re: AI Example Help

2012-10-11 Thread Trevor Nelson
> > An interesting concept. AI monitoring systems have never really > > appealed to me; I personally prefer something with simpler and clearer > > rules (eg "if server load exceeds 3.0, raise an alert"), coupled with > > information retrieval commands that read like commands, not natural > >

AI Example Help

2012-10-11 Thread Trevor Nelson
Hello all, For the first time in well... a very long time I am coming to a loss on where to really get started here on the project I wish to undertake to help me really get into Python programming. A quick explanation of how I learn. I learn best with example working small code bits. With the

Re: Are ABCs an anti-pattern?

2012-10-05 Thread Trent Nelson
On Tue, Oct 02, 2012 at 07:23:05AM -0700, Demian Brecht wrote: > I don't use them anymore, but I'm curious about others opinions on this > list... I like them. In particular, I like that I can enumerate all the subclasses that happen to implement the ABC via the metaclass's __subclas

Re: Python presentations

2012-09-18 Thread Trent Nelson
On Thu, Sep 13, 2012 at 09:00:19AM -0700, andrea crotti wrote: > I have to give a couple of Python presentations in the next weeks, and > I'm still thinking what is the best approach. > > In one presentation for example I will present decorators and context > managers, and my biggest doubt is how

RE: Coolest Python recipe of all time

2011-05-09 Thread Trent Nelson
> What are your favorites? I think I've posted this before, but I love my 3-lines-if-you-ignore-the-scaffolding language translator. Not because it's clever code -- quite the opposite, the code is dead simple -- but because it encompasses one of the things I love about Python the most: it gets

Re: Questions about GIL and web services from a n00b

2011-04-19 Thread Lamont Nelson
> 1. Are you sure you want to use python because threading is not good due > to the Global Lock (GIL)?  Is this really an issue for multi-threaded > web services as seems to be indicated by the articles from a Google > search?  If not, how do you avoid this issue in a multi-threaded process > to t

Trouble installing numpy on QNX

2011-02-23 Thread Nelson Powell
I'm currently using QNX 6.4.1 with Python 2.5. I went to install numpy 1.4.1, but the install kicks bakc an error saying that it cannot find Python.h and that I should install python-dev|python-devel. I look online and I can only find those two packages in relation to Ubuntu, which obviously will

strange TypeError exception in function compiled from a string

2010-12-01 Thread nelson
Hi all, I have this function, defined in a string and ecetuted through ad exec call def cell1(d): x=d.get('x') print x import y return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x)) d is a dict of this kind {'x':2} I receive the following exception, that i find very st

Re: Financial time series data

2010-09-03 Thread Trent Nelson
On 03-Sep-10 1:48 PM, Frederic Rentsch wrote: And do let us know if you get an answer from Yahoo. Hacks like this are unreliable. They fail almost certainly the next time a page gets redesigned, which can be any time. Indeed -- see my other post (regarding ystockquote.py). There's a CSV

Re: Financial time series data

2010-09-03 Thread Trent Nelson
On 03-Sep-10 7:29 AM, Virgil Stokes wrote: A more direct question on accessing stock information from Yahoo. First, use your browser to go to: http://finance.yahoo.com/q/cp?s=%5EGSPC+Components Now, you see the first 50 rows of a 500 row table of information on S&P 500 index. You can LM click

Re: Why list comprehension faster than for loop?

2010-05-09 Thread Trent Nelson
On 9 May 2010, at 16:29, Xavier Ho wrote: On Sun, May 9, 2010 at 6:20 PM, gopi krishna mailto:dasarathulag...@gmail.com>> wrote: Why list comprehension faster than for loop? Because Python optimises for certain special cases, when the number of iterations is predicable in a list comprehension.

RE: Django as exemplary design

2010-05-06 Thread Trent Nelson
> I'm interested in improving my python design by studying a large, > well-designed codebase. I'll tell you one of the best ways to improve your Python code: attend one of Raymond Hettinger's Code Clinic workshops at a Python conference and put some up of your work up on the projector for 20+ deve

Trouble with quotes

2010-03-08 Thread Stephen Nelson-Smith
ome/stephen/scratch/test-data.txt'): lines +=1 line = line.strip() match = regex.match(line) if match: data = match.groupdict() if data['SiteIntelligenceCookie'] == '': no_cookies +=1 else: print "Couldn't match ", line unmatched +=1 print "I analysed %s lines." % (lines,) print "There were %s lines with missing Site Intelligence cookies." % (no_cookies,) print "I was unable to process %s lines." % (unmatched,) How can I make the regex a bit more resilient so it doesn't break when " " is embedded? -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-systems.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems uploading to IIS using FTP over SSL

2010-02-26 Thread Stephen Nelson-Smith
On Feb 26, 2:05 pm, Stephen Nelson-Smith wrote: > Hello, I'm sorry - I hadn't realised that python-list ended up here as well. Sincere apologies for double-posting. S. -- http://mail.python.org/mailman/listinfo/python-list

[M2Crypto] Problems uploading to IIS using FTP over SSL

2010-02-26 Thread Stephen Nelson-Smith
Hello, System: # rpm -q python m2crypto python-2.4.3-27.el5 m2crypto-0.16-6.el5.6 # cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) I have the following method: def ftp_tarball(aggregation_dir, date_format, ftp_server, ftp_user, ftp_pass): date = datetime.today(

[M2Crypto] Problems uploading to IIS using FTP over SSL

2010-02-26 Thread Stephen Nelson-Smith
System: # rpm -q python m2crypto python-2.4.3-27.el5 m2crypto-0.16-6.el5.6 # cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) I have the following method: def ftp_tarball(aggregation_dir, date_format, ftp_server, ftp_user, ftp_pass): date = datetime.today().strftim

mac install

2010-02-09 Thread Thomas Nelson
I downloaded the 3.1.1 dmg from http://www.python.org/download/releases/3.1.1/ but when I run it I get the error "The folowing install step failed: run postflight script for python documentation." The bugs list has this bug at http://bugs.python.org/issue6934 but it's described as fixed. Is it on

Remote audio recording in a multiuser environment

2009-07-14 Thread nelson -
le solution? I will surely use wxpython for the UI on the client and on the server. Thank for any advice, nelson -- Consulenze Linux e Windows http://nelsonenterprise.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Feedparser Problem

2009-06-05 Thread Jonathan Nelson
Thanks for the responses. I've tried the same script on a Server 2003 install, and Python 2.5 and it ran without a hitch. So, it's either a problem with Python 2.6 or with Windows 7. Thanks for all the responses. You've been great. Best, Jonathan On Jun 5, 7:39 am, Jonatha

Feedparser Problem

2009-06-05 Thread Jonathan Nelson
I'm working with Feedparser on months old install of Windows 7, and now programs that ran before are broken, and I'm getting wierd messages that are rather opaque to me. Google, Bing, News groups have all left me empty handed. I was wondering if I could humbly impose upon the wizards of comp.lan

Feedparser problem

2009-06-04 Thread Jonathan Nelson
I'm trying to add a feedreader element to my django project. I'm using Mark Pilgrim's great feedparser library. I've used it before without any problems. I'm getting a TypeError I can't figure out. I've tried searching google, bing, google groups to no avail. Here's the dpaste of what I'm tryin

__import__ Confusion

2009-02-12 Thread scott . bronson . nelson
Can someone explain to me what's going on here? >>> __import__('some.package.module', {}, {}, []) >>> __import__('some.package.module', {}, {}, ['']) (Note that '' is two single quotes) Thanks, Scott -- http://mail.python.org/mailman/listinfo/python-list

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread Christopher Nelson
I'm not sure what to say about that. The company I work for is committed to Python (our product is mostly Python source), and my current job is to make our software work on Itanium, which means providing an Itanium build of Python. As long as I have this job I suspect that I will be maintaining i

Re: Can anyone suggest a good crypto package?

2008-09-04 Thread Trent Nelson
On Thu, Sep 04, 2008 at 11:39:42AM -0700, Fett wrote: > I need a crypto package that works on windows with python 2.5. Can > anyone suggest one for me? You could always rely on the the APIs Windows provides to do this sort out stuff, either via pywin32 or ctypes. Trent. -- h

REMINDER: Python Sprint Weekend This Weekend!

2008-05-07 Thread Trent Nelson
Just a friendly reminder that this weekend is the Python sprint weekend! Look forward to seeing everyone on #python-dev irc.freenode.net over the course of the weekend! Trent. On 16 Apr, 18:52, Trent Nelson wrote: > >Following on from the success of previous sprint/bugfix we

RE: Python development tools

2008-04-23 Thread Trent Nelson
> Are there any completely free developent tools for python > scripts like IDLE. I have used IDLE , but I want to try out > others also. I saw stuff like PyCrust, but I don't see that > it can run the script as well. > Thanks, Ignoring the 'free' part of your question, I've recently moved from Py

RE: Python script to automate use of Google Translate? (or other translator)

2008-04-22 Thread Trent Nelson
> > I have the need to occasionally translate a single word > > programatically. Would anyone have a Python script that > > would let me do this using Google (or another) translation > > service? As a matter of fact, yes, I do! This happens to be my most favourite piece of Python code I've ever

Global Python Sprint Weekends: May 10th-11th and June 21st-22nd.

2008-04-16 Thread Trent Nelson
Following on from the success of previous sprint/bugfix weekends and sprinting efforts at PyCon 2008, I'd like to propose the next two Global Python Sprint Weekends take place on the following dates: * May 10th-11th (four days after 2.6a3 and 3.0a5 are released) * June

RE: Randall Munroe loves Python

2008-04-11 Thread Trent Nelson
> Another xkcd plug for Python: http://xkcd.com/409/ Damn it. There goes another 40 minutes of my life magically whisked away by that more-addictive-than-crack 'RANDOM' button. -- http://mail.python.org/mailman/listinfo/python-list

RE: Google App Engine

2008-04-08 Thread Trent Nelson
> But people will always prefer complaining on the grounds of > insufficient information to keeping quiet on the basis of knowledge. +1 QOTW! -- http://mail.python.org/mailman/listinfo/python-list

Re: python tutorial on a single html page?

2007-11-07 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, BartlebyScrivener <[EMAIL PROTECTED]> wrote: > Is the main Python tutorial posted on single searchable page > somewhere? As opposed to browsing the index and clicking NEXT etc. For completeness (though a bit late), I'll mention that Google can search a group of

RE: calling a function from string

2007-10-22 Thread Trent Nelson
> i have a function that I could like to call, but to make it more > dynamic I am constructing a string first that could equivalent to the > name of the function I wish to call. how could I do that? the string > could might include name of the module. > > for example > > a_string = 'datetime.' +

RE: a question about decorator

2007-10-22 Thread Trent Nelson
> def A(): > print 'warp in A' > def why(self, *arg, **kw): > print 'in A' > print self > print arg > print kw > #self(*arg, **kw) > > return why > > class T(object): > @A() > def test(g, out): >

PEP idea: Instrumented Python

2007-10-12 Thread Christopher Nelson
I was looking at adding dtrace-like dynamic tracing to Python. Note that this isn't dtrace itself. The basic rationale: 1. A lot of enterprise-level software is written in Python. It is difficult to impossible to reproduce the customer environment in a test lab. Sometimes applications hang myst

Re: Looping through File Question

2007-09-05 Thread Thomas Nelson
> > > On Sep 5, 8:58 pm, planetmatt <[EMAIL PROTECTED]> wrote: > > > > > I am a Python beginner. I am trying to loop through a CSV file which > > > > I can do. What I want to change though is for the loop to start at > > > > row 2 in the file thus excluding column headers. The DictReader object

Re: Cancelling events on a COM Object

2007-08-18 Thread Oliver Nelson
Roger, I tried modifying my code so that I have def OnBeforeClick(self, Button, Shift, X, Y, Cancel): print "click" Cancel = True return Cancel But this doesn't seem to have changed anything. Am I doing this wrong? OLIVER Roger Upole wrote: > O

Re: Canceling events on COM Objects in python

2007-08-18 Thread Oliver Nelson
nly a different model than the standard wx event system... OLIVER [EMAIL PROTECTED] wrote: > On Aug 17, 11:54 pm, Oliver Nelson <[EMAIL PROTECTED]> wrote: >> I have MapPoint working in Python, and I'm trying to cancel events on >> the map, but I can't seem to make that happ

Canceling events on COM objects

2007-08-18 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Re: Cancelling events on a COM Object

2007-08-17 Thread Oliver Nelson
James, I was getting an error everytime so I thought I had a setup problem... Sorry everybody... OLIVER James Stroud wrote: > Oliver, wait a while before you panic about your post not getting through! > > James > -- http://mail.python.org/mailman/listinfo/python-list

Cancelling events on a COM Object

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Events in Com Object for Python

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Canceling events from COM Objects

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Canceling events from COM Objects

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Canceling events from COM objects

2007-08-16 Thread Oliver Nelson
I have MapPoint working in Python, and I'm trying to cancel events on the map, but I can't seem to make that happen. I'm responding to the events successfully in my panel object. My code is like this: global MapPointMod MapPointMod = win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-

Re: Combinatorial of elements in Python?

2007-08-15 Thread Thomas Nelson
On Aug 15, 8:39 am, "Sebastian Bassi" <[EMAIL PROTECTED]> wrote: > That was easy :) > What about extending it for N elements inside the dictionary? Sounds > like a work for a recursive function. Here's my attempt: [code] def backtrack(groups,position=0, answer=''): if position==len(groups)

condor_compiled python interpreter

2007-07-11 Thread Thomas Nelson
Does anyone know where I could find help on condor_compiling a python interpreter? My own attempts have failed, and I can't find anything on google. Here's the condor page: http://www.cs.wisc.edu/condor/ Thanks, Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble killing a process on windows

2007-06-02 Thread Thomas Nelson
On Jun 2, 11:43 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Thomas Nelson wrote: > > from subprocess import Popen > > from time import sleep > > import win32api > > war3game = Popen(["C:\Program Files\Warcraft III\Frozen Throne.exe"]) >

Trouble killing a process on windows

2007-06-02 Thread Thomas Nelson
Hi, I'd like to start a program, run it for a while, then terminate it. I can do this on linux, but I'm new to working with windows. Here's my script: from subprocess import Popen from time import sleep import win32api war3game = Popen(["C:\Program Files\Warcraft III\Frozen Throne.exe"]) sleep(30

Re: Sorting troubles

2007-05-14 Thread Thomas Nelson
On May 14, 11:05 am, [EMAIL PROTECTED] wrote: > I have the following implementations of quicksort and insertion sort: > > def qSort(List): > if List == []: return [] > return qSort([x for x in List[1:] if x< List[0]]) + List[0:1] + \ >qSort([x for x in List[1:] if x>=List[0]]) >

Re: Microsoft's Dynamic Languages Runtime (DLR)

2007-05-04 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, Kaz Kylheku <[EMAIL PROTECTED]> wrote: > On May 2, 5:19 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > > On May 3, 2:15 am, Kaz Kylheku <[EMAIL PROTECTED]> wrote: > > > > > Kindly refrain from creating any more off-topic, cross-posted threads. > > > Thanks. > > > >

Re: How do I get type methods?

2007-05-04 Thread Thomas Nelson
On May 4, 7:59 am, [EMAIL PROTECTED] wrote: > On 4 ÍÁÊ, 09:08, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > En Fri, 04 May 2007 01:34:20 -0300, <[EMAIL PROTECTED]> escribio: > > > I'm not against 'dir(MyClass)'; the question is, what should I 'dir()' > > > to get methods of 'pyuno' type ins

How safe is a set of floats?

2007-05-04 Thread Thomas Nelson
I want to generate all the fractions between 1 and limit (with limit>1) in an orderly fashion, without duplicates. def all_ratios(limit): s = set() hi = 1.0 lo = 1.0 while True: if hi/lo not in s: s.add(hi/lo) yield (hi,lo) hi += 1 if

Re: editing scripts on a mac

2007-04-27 Thread Thomas Nelson
On Apr 27, 11:37 am, Tommy Grav <[EMAIL PROTECTED]> wrote: > > him> I do not have a text editor, but here are the answers to > > him> questions 1-5. > > > Now, frankly, I don't think this answer is correct, since I know OS > > X is > > a UNIX derivative, but I am loathe to involve a programming n

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-24 Thread Thomas Nelson
On Apr 23, 10:38 pm, Mel Wilson <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > > The interpreter explains it: "A list is not a hashable object." > > Choosing a hash table instead of some kind of balanced tree seems > > to be just an optimization. ;) > > Even with a balanced tree, if a key in a

feedback on Until recipe

2007-04-24 Thread Thomas Nelson
Occasionally people post complaining about the lack of a "repeat...until" structure in python. I thought about it and came up with this recipe that I like. The only ugly thing is having to use lambdas, otherwise it's very terse and readable. Tell me what you think, and if anyone besides me think

Feedback on Until recipe

2007-04-24 Thread Thomas Nelson
Occasionally someone posts to this group complaining about the lack of "repeat ... until" in python. I too have occasionally wished for such a construct, and after some thinking, I came up with the class below. I'm hoping to get some feedback here, and if people besides me think they might use it

Re: how to remove multiple occurrences of a string within a list?

2007-04-03 Thread Thomas Nelson
On Apr 3, 1:49 pm, [EMAIL PROTECTED] wrote: > On Apr 3, 1:31 pm, "Matimus" <[EMAIL PROTECTED]> wrote: > > > It depends on your application, but a 'set' might really be what you > > want, as opposed to a list. > > > >>> s = set(["0024","haha","0024"]) > > >>> s > > > set(["0024","haha"])>>> s.remove

Re: how to remove multiple occurrences of a string within a list?

2007-04-03 Thread Thomas Nelson
bahoo wrote: > Hi, > > I have a list like ['0024', 'haha', '0024'] > and as output I want ['haha'] > > If I > myList.remove('0024') > > then only the first instance of '0024' is removed. > > It seems like regular expressions is the rescue, but I couldn't find > the right tool. > > Thanks! > bahoo

Re: newbie needs help building Python 2.5 for Fedora Core 6

2007-02-24 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "bobmon" <[EMAIL PROTECTED]> wrote: > Hello, and please be gentle... > > I'm trying to build Python 2.5 on my Fedora Core 6 installation. I > think I've resolved most of my problems, but "make test" reports an > error for test_socket.py, shown below. > > I suppo

Re: Possible to set cpython heap size?

2007-02-23 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "Andy Watson" <[EMAIL PROTECTED]> wrote: ... > If I could have a heap that is larger and does not need to be > dynamically extended, then the Python GC could work more efficiently. ... GC! If you're allocating lots of objects and holding on to them, GC will ru

Re: list/get methods/attributes of a class?

2007-02-22 Thread Thomas Nelson
Check out the dir() function. It does what you want, I think. Tom On Feb 22, 9:27 am, [EMAIL PROTECTED] wrote: > Hello, > Sorry guys for this newbie questions. But I wonder if there is a > standard or build-in method to know the methods of a class? > > I'm not originally a progrommer and I have

FloatCanvas in a wxpython application.... layout problems

2007-02-21 Thread nelson -
e floatcanvas in the right position... it is'n displaied... can annyone give me an example of use of floatcanvas in an application with more than one panel... thanks a lot! nelson -- http://mail.python.org/mailman/listinfo/python-list

Re: c++ for python programmers

2007-02-12 Thread Thomas Nelson
On Feb 12, 1:35 pm, andrew clarke <[EMAIL PROTECTED]> wrote: > Thomas, I sent you a message off-list but it bounced due to your mailbox > being full. > > Short answer: Subscribe to the c-prog@yahoogroups.com mailing list and > ask your C/C++ questions there. > > Regards > Andrew I have to edit a

c++ for python programmers

2007-02-12 Thread Thomas Nelson
I realize I'm approaching this backwards from the direction most people go, but does anyone know of a good c/c++ introduction for python programmers? Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting a List of Lists

2007-01-30 Thread Thomas Nelson
On Jan 30, 5:55 pm, [EMAIL PROTECTED] wrote: > I can't seem to get this nailed down and I thought I'd toss it out > there as, by gosh, its got to be something simple I'm missing. > > I have two different database tables of events that use different > schemas. I am using python to collate these reco

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Thomas Nelson
On Jan 28, 3:13 pm, Wojciech Muła <[EMAIL PROTECTED]> wrote: >Define method __gt__. This works, thanks. I was a little surprised though. is __cmp__ used by any builtin functions? Thanks, THN -- http://mail.python.org/mailman/listinfo/python-list

Trouble with max() and __cmp__()

2007-01-28 Thread Thomas Nelson
My code: class Policy(list): def __cmp__(self,other): return cmp(self.fitness,other.fitness) j = Policy() j.fitness = 3 k = Policy() k.fitness = 1 l = Policy() l.fitness = 5 print max([j,k,l]).fitness prints 3, when I was expecting it to print 5. What have I done wrong? Thanks for

Re: newbieee

2007-01-08 Thread Thomas Nelson
lee wrote: > I getting familiarised with python...can any one suggest me a good > editor available for python which runs on windows xpone more > request guys...can nyone tell me a good reference manual for python.. I think vim is a very good editor for python, and it's certainly available for

Re: Non greedy regex

2006-12-14 Thread Thomas Nelson
There's an optional count argument that will give what you want. Try re.sub('a.*b','','ababc',count=1) Carsten Haese wrote: > On Thu, 2006-12-14 at 06:45 -0800, [EMAIL PROTECTED] wrote: > > Can someone please explain why these expressions both produce the same > > result? Surely this means that

Window, Windows, Linux, client and server...

2006-12-07 Thread nelson -
picture of the desktop client. Is it a thing that i can do in python? any advice? I googled but i can't find something too useful... II know i can use vnc, but i want a pure python solution... if it's possibile... Doing it using VNC it seems not so "clear"... :) thanks, nel

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > Michael Hobbs wrote: > > > That is, assume that the expression ends at the colon, not at the > > newline. That would make this type of statement possible: > > if color == red or > > color == blue or > >

Re: Python in sci/tech applications

2006-11-03 Thread Thomas Nelson
How hard would it be to have numpy/ scipy part of the python standard library? Tom mattf wrote: > I've discovered Python and have been trying it out lately as a possible > replacement for computations that would ordinarily be done with a > commercial package like Matlab or IDL. I'd like to mentio

Re: can I import the module twice (under differnet names)

2006-11-01 Thread Thomas Nelson
alf wrote: > Hi, > > wonder if in the python I could treat modules imorts like classes > instances. It means I could import it twice or more times under > different names. > > -- > alfz1 You can always give any object as many names as you want: >>> import sys >>> s1 = sys >>> s2 = sys >>> s1.path

Re: 3d programming without opengl

2006-10-31 Thread nelson -
Hi paul, i look at slut and it seem very good... Can i embed it into a wxpython application? thanks, nelson -- http://mail.python.org/mailman/listinfo/python-list

3d programming without opengl

2006-10-30 Thread nelson -
x27;t find nothing interesting... (the best would be a pure python solution) Thanks, nelson -- http://mail.python.org/mailman/listinfo/python-list

3D Vector Type Line-Drawing Program

2006-10-11 Thread nelson -
shaded > shapes? And with or without hidden line removal? > i'm goind the same. I looked to vpython, but i can't make it go with wxpython. So i make a slightly different question. There is a library that fits well with wxpython that have features similar to vpython? thanks,

wxpython problems using GLCanvas

2006-10-08 Thread nelson
ersections... thanks, nelson -- http://mail.python.org/mailman/listinfo/python-list

ANN: pyfuzzylib 0.1.3 Released

2006-09-16 Thread nelson -
/pyfuzzylib good afternoon, nelson -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory problem

2006-08-14 Thread Thomas Nelson
Yi Xing wrote: > On a related question: how do I initialize a list or an array with a > pre-specified number of elements, something like > int p[100] in C? I can do append() for 100 times but this looks silly... > > Thanks. > > Yi Xing Use [0]*100 for a list. THN -- http://mail.python.org/ma

Re: Two Classes In Two Files

2006-08-10 Thread Thomas Nelson
Perhaps __init__.py has what you're looking for? THN [EMAIL PROTECTED] wrote: > I just started working with Python and ran into an annoyance. Is there > a way to avoid having to use the "from xxx import yyy" syntax from > files in the same directory? I'm sure it's been asked a million times, > b

Re: E' possibile integrare ironpython con visual studio 2005?

2006-08-05 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: > LaGuna <[EMAIL PROTECTED]> wrote: > > > Se si come? > > > > Ciao by Enzo > > Questo newsgroup preferisce l'inglese -- per favore, chiedi su > it.comp.lang.python invece che qui. > > This newsgroup prefers English -- pl

Re: What is the best way to print the usage string ?

2006-08-05 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "Simon Forman" <[EMAIL PROTECTED]> wrote: ... > Python also concatenates adjacent strings, but the "real" newlines > between your strings will need to be escaped (otherwise, because the > newlines are statement separators, you will have one print statement > follow

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-03 Thread Thomas Nelson
I strongly recommend trying to come up with your own projects. Just pick small things that reflect something you actually want to do: maybe make a simple board game, or a few scripts to help you keep all your files organized, etc. Generally speaking I think it's easier to teach yourself a languag

Re: looking for a regular expression

2006-08-01 Thread Thomas Nelson
How about my_string = "We the people of the United States, in order to form a more perfect union, establish justice, insure domestic tranquility,.." print (x for x in my_string.split(",") if "justice" in x).next() This isn't a regular expression, but it gives what you're looking for. THN --

Re: statistical analysis tools in python?

2006-07-18 Thread Thomas Nelson
Actually, after a little looking, the simple stats.py module at http://www.nmr.mgh.harvard.edu/Neural_Systems_Group/gary/python.html is exactly what I needed. It may not be as fast or as comprehensive as scipy or R, but installation simply involves downloading the module and importing into the cod

Re: execute a shell script from a python script

2006-07-18 Thread Thomas Nelson
As described in the docs I pointed to before: subprocess.call("foo.sh",shell=True) Is the way to do it without args. I think it is simplest to learn the subprocess module because (quoting from the docs) this module intends to replace several other, older modules and functions, such as: os.system o

Re: execute a shell script from a python script

2006-07-17 Thread Thomas Nelson
If your script is foo.sh and takes args: import subprocess subprocess.call(["foo.sh","args"],shell=True) Should work fine. check out http://www.python.org/dev/doc/maint24/lib/module-subprocess.html Enjoy, THN spec wrote: > Hi all, I know nothing about Python. What I need to do is to get a > Pyth

statistical analysis tools in python?

2006-07-12 Thread Thomas Nelson
Sorry if this is a FAQ, but I couldn't find a good summary through google. What kinds of statistical analysis tools exist in python? I really just need t-tests, chi-squared test, and other such tests of statistical significance. A few things point to numpy and scipy, but I was surprised to find

Re: Best command for running shell command

2006-07-11 Thread Thomas Nelson
Yes, I highly recommend the subprocess module. subprocess.call() can do almost anything you want to do, and the options are all pretty intuitive Whenever I need to write quick scripts for myself, it's what I use. THN Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Donald Duck <[EMAIL PRO

Re: how can I avoid abusing lists?

2006-07-07 Thread Thomas Nelson
Thanks to everyone who posted. First, I don't think my question was clear enough: Rob Cowie, Ant, Simon Forman, [EMAIL PROTECTED], and Jon Ribbens offered solutions that don't quite work as-is, because I need multiple values to map to a single type. Tim Chase and Bruno Destuilliers both offer ver

how can I avoid abusing lists?

2006-07-07 Thread Thomas Nelson
I have this code: type1 = [0] type2 = [0] type3 = [0] map = {0:type1, 1:type1, 2:type3, 3:type1, 4:type2} # the real map is longer than this def increment(value): map[value][0] += 1 increment(1) increment(1) increment(0) increment(4) #increment will actually be called many times through

Re: Trace KeyboardInterrupt exception?

2006-06-15 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > if you want to interrupt the code to find out where it is, > you can instead connect to it in gdb and get the python traceback of > each thread. > if you're interested I'll post the necesary gdb-macro for that (didn'

socket and Ctl-C workaround?

2006-06-15 Thread Tony Nelson
I've been trying to figure out why Ctl-C sometimes doesn't interrupt yum. It appears to be unresolved Python bug 926423, unresolved proposed patch 1102879, don't know if anything ever came of it. Note that I cannot ask all yum users to apply the patch. I'm not sure I should be getting rid of

Re: Trace KeyboardInterrupt exception?

2006-06-14 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Tony Nelson wrote: > > I'm trying to find out what is eating some KeyboardInterrupt exceptions > > in a fairly large program (yum). My KeyboardInterrupt handler is called > > for some Ctl-C presses,

  1   2   >