Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
>>> RESTART === >>> 0 30.4740708665 secs (Anton Vredegoor) >>> RESTART === >>> 0 30.4132625795 secs (Anton Vredegoor) >>> RESTART === >>> 0 30.4812175849 secs (Anton Vredegoor) >>> +

[ANN] GCC 4.1.2 installer for Python distutils compilation

2007-03-17 Thread Giovanni Bajo
Hello, This page: http://www.develer.com/oss/GccWinBinaries contains a friendly Windows installer for GCC 4.1.2 (MinGW binary version), with full support for integrating it with Python installations so that it is used by distutils to compile Python extensions. Direct download link: http

Re: List to string

2007-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2007 21:28:56 -0700, Hitesh wrote: > > Hi, > > I've a list like this.. > str1 = ['this is a test string inside list'] That's a bad name for the variable. It's called "str1" but it is a list. > I am doing it this way. > > for s in str1: > temp_s = s > print temp_s That

Re: How to parse the os.system() output in python

2007-03-17 Thread Sebastian Bassi
On 3/18/07, bruce peng <[EMAIL PROTECTED]> wrote: > how to redirect the putput of the > program to a file? like this: program_name -parameters > outfile.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: List to string

2007-03-17 Thread Hitesh
On Mar 18, 12:28 am, "Hitesh" <[EMAIL PROTECTED]> wrote: > Hi, > > I've a list like this.. > str1 = ['this is a test string inside list'] > > I am doing it this way. > > for s in str1: > temp_s = s > print temp_s > > Any better suggestions? > > Thank you, > hj I want to cast value of a lis

Re: How to parse the os.system() output in python

2007-03-17 Thread bruce peng
how to redirect the putput of the program to a file? thanks. "Sebastian Bassi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 17 Mar 2007 17:28:56 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: >> I use os.system() to execute a system command in python. >> Can you please

List to string

2007-03-17 Thread Hitesh
Hi, I've a list like this.. str1 = ['this is a test string inside list'] I am doing it this way. for s in str1: temp_s = s print temp_s Any better suggestions? Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
my dial-up line's too slow for downloading 4mb of shedskin-0.0.20.exe -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
bearophileH! I gave to your "oil" svrl runs ("z in dict" instd of "dict.has_key" saved only ~0.4 sec). The result is (and I'm completely lost in all these *optimizations* :)): >>> RESTART === >>> 0 34.78 secs (bearophileH) >>> RES

Re: How to parse the os.system() output in python

2007-03-17 Thread Sebastian Bassi
On 17 Mar 2007 17:28:56 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I use os.system() to execute a system command in python. > Can you please tell me how can I parse (in python) the output of the > os.system() ? Maybe you mean to parse the output of the program you run using os.system.

Re: IDE for wxPython

2007-03-17 Thread SPE - Stani's Python Editor
On Mar 18, 2:23 am, "sleek" <[EMAIL PROTECTED]> wrote: > On Mar 17, 4:12 pm, Ghirai <[EMAIL PROTECTED]> wrote: > > > Hellopython-list, > > > Can anyone suggest an IDE for wxPython? > > Or an IDE for TkInter? > > > Thanks. > > > -- > > Best regards, > > Ghirai. > > You might want to check outSPE. It

Re: Automagically log changes in table

2007-03-17 Thread George Sakkis
On Mar 17, 7:59 pm, "aspineux" <[EMAIL PROTECTED]> wrote: > Hi > > You can get this using "triggers" and "stored procedures". > These are SQL engine dependent! This is available for long time with > postgress and only from version 5 with mysql. > This let you write SQL code (Procedure) that will b

Webcams and python

2007-03-17 Thread Synt4x
I'm using VideoCapture in windows to obtain images from my webcam. The thing is, if i want to show a live video from my webcam i have to make an infinite loop and request an image everytime: from VideoCapture import Device cam = Device() while 1: img = cam.getImage() Now, by doing this, my p

Re: How to parse the os.system() output in python

2007-03-17 Thread Dave Reed
On Mar 17, 2007, at 8:28 PM, [EMAIL PROTECTED] wrote: > Hi, > > I use os.system() to execute a system command in python. > Can you please tell me how can I parse (in python) the output of the > os.system() ? > > Thank you. Sounds like you want os.popen, not os.system. http://docs.python.org/l

Re: IDE for wxPython

2007-03-17 Thread sleek
On Mar 17, 4:12 pm, Ghirai <[EMAIL PROTECTED]> wrote: > Hello python-list, > > Can anyone suggest an IDE for wxPython? > Or an IDE for TkInter? > > Thanks. > > -- > Best regards, > Ghirai. You might want to check out SPE. It's a great Python IDE. http://pythonide.blogspot.com/ -- http://mail.pyt

Looking for a job?

2007-03-17 Thread good_online_jobs
Free. Find a Job here now--> http://www.jobbankdata.com -- http://mail.python.org/mailman/listinfo/python-list

IDE for wxPython

2007-03-17 Thread Ghirai
Hello python-list, Can anyone suggest an IDE for wxPython? Or an IDE for TkInter? Thanks. -- Best regards, Ghirai. -- http://mail.python.org/mailman/listinfo/python-list

How to parse the os.system() output in python

2007-03-17 Thread [EMAIL PROTECTED]
Hi, I use os.system() to execute a system command in python. Can you please tell me how can I parse (in python) the output of the os.system() ? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: MIME Magic

2007-03-17 Thread aspineux
On 18 mar, 00:54, "Samuel" <[EMAIL PROTECTED]> wrote: > On Mar 18, 12:30 am, Jorge Godoy <[EMAIL PROTECTED]> wrote: > > > I'd start by taking a look at "file"'s code. :-) > > > The thing is being able to identify the signatures of several different > > types > > of files. Here's some help for >

Re: tkinter grid vs pack

2007-03-17 Thread aspineux
On 18 mar, 16:49, Gigs_ <[EMAIL PROTECTED]> wrote: > For what is grid better than pack, and otherwise? > > thanks in advance Grid are useful to align items vertically _AND_ horizontally ! For example to make adialog box with label of different length Firstname: John__ Lastname: Smith_

Re: formatting strings to have the same width

2007-03-17 Thread John Machin
On Mar 18, 10:17 am, "spohle" <[EMAIL PROTECTED]> wrote: > sorry the code should read: > > foo = ["aaa", "1232"] > for each in foo: > print each.center(10, " ") + " | " Works OK for me on the console: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win 32 Type "he

Re: Automagically log changes in table

2007-03-17 Thread aspineux
Hi You can get this using "triggers" and "stored procedures". These are SQL engine dependent! This is available for long time with postgress and only from version 5 with mysql. This let you write SQL code (Procedure) that will be called when "trigged" by an event like inserting new row, updating r

Re: Still the __new__ hell ...

2007-03-17 Thread Paulo da Silva
Arnaud Delobelle escreveu: > On Mar 17, 9:31 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: ... >> I used __new__ to >> subclass date class but now cPickle/pickle loads >> does not work. >> >> from datetime import date >> import cPickle,string >> >> class MyDate(date): >> def __new__(cls,ye

Re: MIME Magic

2007-03-17 Thread Samuel
On Mar 18, 12:30 am, Jorge Godoy <[EMAIL PROTECTED]> wrote: > I'd start by taking a look at "file"'s code. :-) > > The thing is being able to identify the signatures of several different types > of files. Here's some help for > you:http://www.garykessler.net/library/file_sigs.html > > And here's

Re: formatting strings to have the same width

2007-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2007 16:07:44 -0700, spohle wrote: > hi, > > i got random strings and wanna attach a " | " at the end. now if i > print them i want the | to always be underneath each other. example > code: > > foo = ["aaa", "1232"] > for each in foo: > > print foo[0].center(10, " ") + " | " > f

Report options...

2007-03-17 Thread Mario Lacunza
Hello, Right now Im migrating an VB6+Crystal report+Word App to Python+wxPython +Reportlab+??? The VB system work with Word creating some patterns (title, foot prints, etc) and users maybe could insert some Forms fields to personalize the output connecting this fields with an recordset. I dont w

Re: MIME Magic

2007-03-17 Thread Jorge Godoy
"Samuel" <[EMAIL PROTECTED]> writes: > Hi, > > How can I determine the type of a file from "magic bytes", similar to > what the "file" command on unix does? I found > > http://docs.python.org/lib/module-mimetypes.html > > but this only seems to use the filename (extension) for finding the > type.

Re: formatting strings to have the same width

2007-03-17 Thread spohle
sorry the code should read: foo = ["aaa", "1232"] for each in foo: print each.center(10, " ") + " | " -- http://mail.python.org/mailman/listinfo/python-list

formatting strings to have the same width

2007-03-17 Thread spohle
hi, i got random strings and wanna attach a " | " at the end. now if i print them i want the | to always be underneath each other. example code: foo = ["aaa", "1232"] for each in foo: print foo[0].center(10, " ") + " | " foo2 = "1232" print foo2.center(10, " ") + " | " even though i define a c

MIME Magic

2007-03-17 Thread Samuel
Hi, How can I determine the type of a file from "magic bytes", similar to what the "file" command on unix does? I found http://docs.python.org/lib/module-mimetypes.html but this only seems to use the filename (extension) for finding the type. Any hints? -Samuel -- http://mail.python.org/mailm

[ANN] squisher 0.3

2007-03-17 Thread Adam Atlas
http://cheeseshop.python.org/pypi/squisher/0.3 I've posted the third version of my experimental packaging program Squisher. Squisher can take a directory representing a Python package (i.e. a directory with __init__.py) and "squish" it into a single .pyc file that you can import, or run on the com

Re: class question

2007-03-17 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Hello there, > i am pretty new to object-oriented programming and i have a question: > let's say i have a simple class such as: > class father: > age=... > name= > def abcd. > class son(father): > age= > name= >

Re: Still the __new__ hell ...

2007-03-17 Thread Paul McGuire
On Mar 17, 4:31 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Sorry to put here too many questions about __init__ __new__ > stuff but I always found a new problem when using them. > I have searched for simple __new__ docs on how to do the > basic things but find none. > > After trying the solutio

Re: Still the __new__ hell ...

2007-03-17 Thread Arnaud Delobelle
On Mar 17, 9:31 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Sorry to put here too many questions about __init__ __new__ > stuff but I always found a new problem when using them. > I have searched for simple __new__ docs on how to do the > basic things but find none. > > After trying the solutio

Still the __new__ hell ...

2007-03-17 Thread Paulo da Silva
Sorry to put here too many questions about __init__ __new__ stuff but I always found a new problem when using them. I have searched for simple __new__ docs on how to do the basic things but find none. After trying the solutions people gently posted here (thanks) I run into new trouble when I go wi

Re: Returning other instance from __init__ - I need help

2007-03-17 Thread Paulo da Silva
Gabriel Genellina escreveu: > En Fri, 16 Mar 2007 22:05:05 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: ... > class C(object): > > def __new__(cls, filename=None, foo=None, bar=None): > if filename is not None: > return cls.load(filename) > inst = super(C,

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread bearophileHUGS
Mark Dufour: > FWIW, the original program can also be compiled with Shed Skin (http:// > mark.dufour.googlepages.com), an experimental (static-)Python-to-C++ > compiler, resulting in a speedup of about 8 times for a single test > with 500 tuples. If we want to play, then this is a literal translat

Automagically log changes in table

2007-03-17 Thread George Sakkis
This is more in the context of Turbogears/SQLAlchemy, but if anyone has implemented something similar with other packages it might be useful to know. I'd like to have a way to make a table "loggable", meaning it would get, say, two fields "last_modified" and "modified_by", and every write operatio

Re: Weekly Python Patch/Bug Summary

2007-03-17 Thread Robert Kern
Terry Reedy wrote: > "Dick Moores" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | I thought I'd give > | > | (the latest release (plus bug fixes) of Python) a try. I first backed > | up my Python25 folder (I'm usi

Re: distributing python software in jar like fashion

2007-03-17 Thread Colin J. Williams
ce wrote: > On Mar 15, 10:23 am, alf <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I have a small app which consist of a few .py files. Is there any way to >> distribute it in jar like fashion as a single file I can just run python >> on. I obviously look for platform independent solution. >> >> Thx in a

class question

2007-03-17 Thread sittner
Hello there, i am pretty new to object-oriented programming and i have a question: let's say i have a simple class such as: class father: age=... name= def abcd. class son(father): age= name= def efgh: or any other heirarchic s

Re: Pickle and Instance Methods

2007-03-17 Thread Troy Melhase
> I understand that this cannot be saved by pickle. > My question is, is there another way of setting a callback that would > agree with pickle? > If not is there some way to make pickle ignore the problem attribute? Try adding a __getstate__ method to your class: http://docs.python.org/lib/pickl

Pickle and Instance Methods

2007-03-17 Thread Steve Potter
I have a class that I am trying to pickle. One of the attributes is used to set a callback e.g. self.attribute.setCallback(self.callbackfunction). I understand that this cannot be saved by pickle. My question is, is there another way of setting a callback that would agree with pickle? If not is t

Re: SQLite3, data not found

2007-03-17 Thread jim-on-linux
On Saturday 17 March 2007 13:51, John Nagle wrote: > jim-on-linux wrote: > > On Friday 16 March 2007 18:23, Jerry Hill wrote: > >>On 3/16/07, jim-on-linux > >> <[EMAIL PROTECTED]> > > > > wrote: > >>>Below, the first select produces results > >>> but, after closing then re-opening the > >>> databa

Re: running python on xp command prompt

2007-03-17 Thread Steve Potter
On Mar 17, 2:15 pm, [EMAIL PROTECTED] wrote: > Hi, > > I have a simple question about running python on windows xp command > prompt. The file is as follows and is named spam.py: > > print 2**8 > print 'the bright side' + 'of life' > print "hello world" > > I run this on the command prompt as follow

running python on xp command prompt

2007-03-17 Thread TPhung
Hi, I have a simple question about running python on windows xp command prompt. The file is as follows and is named spam.py: print 2**8 print 'the bright side' + 'of life' print "hello world" I run this on the command prompt as follows C:\Documents and Settings\User>python C:\Documents and Sett

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread mark . dufour
Paul Rubin wrote: > "n00m" <[EMAIL PROTECTED]> writes: > > Two first outputs is of above (your) code; next two - of my code: > > Yeah, I see now that we both used the same algorithm. At first glance > I thought you had done something much slower. The 10 second limit > they gave looks like they i

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: > for x in e: > for y in r: > if -x-y in h: > sch += h[-x-y] I wonder whether g = h.get for x in e: for y in r: if -x-y in h: sch += g(-x-y, 0) might be a little bit faster. Also, -x-y

Re: Odd error

2007-03-17 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I installed it using the regular download form python.org. I went | back and did a lot of testing with the file, commenting out most of | it, seeing what would actually run, and it seems I had a normal | semantic error: | | self.data(o

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread bearophileHUGS
n00m: > i have no NumPy to test it... > without Psyco Anton's code is the winner: ~48sec vs ~58sec of my code > But with Psyco my runtime is ~28sec; Anton's - ~30sec (PC: 1.6 ghz, > 512 mb) > Not so bad.. keeping in mind that 256000 billions quadruplets to > check :) I have oiled it a bit, you can

Re: Weekly Python Patch/Bug Summary

2007-03-17 Thread Terry Reedy
"Dick Moores" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I thought I'd give | | (the latest release (plus bug fixes) of Python) a try. I first backed | up my Python25 folder (I'm using Win XP). Then with Python 2

Re: Odd error

2007-03-17 Thread [EMAIL PROTECTED]
I installed it using the regular download form python.org. I went back and did a lot of testing with the file, commenting out most of it, seeing what would actually run, and it seems I had a normal semantic error: self.data(one).append(item) and data is in fact a dictionary, not a callable objec

Re: read a web page using python

2007-03-17 Thread Lawrence Oluyede
<[EMAIL PROTECTED]> wrote: > Kindly, could you someone tell me how to read a page(any web site) > using Python, what method to be used ? import urllib2 res = urllib2.urlopen(url) page = res.read() See: http://www.voidspace.org.uk/python/articles/urllib2.shtml -- Lawrence, oluyede.org - neroperc

Re: Phase change material ...

2007-03-17 Thread Brian Whatcott
On Sat, 10 Mar 2007 20:23:27 GMT, Dan Bloomquist <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: > >> On Mar 8, 5:57 pm, "martinl" <[EMAIL PROTECTED]> wrote: >> >>>Hi All, >>>I'm looking for a substance that does a phase change at between 60 and >>>100 C. >I settled for hurricane wax. (IGI-

Re: read a web page using python

2007-03-17 Thread Luuk
<[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Hi All, > > Kindly, could you someone tell me how to read a page(any web site) > using Python, what method to be used ? > > Paris > http://www.amk.ca/python/howto/sockets/ -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-17 Thread n00m
i have no NumPy to test it... without Psyco Anton's code is the winner: ~48sec vs ~58sec of my code But with Psyco my runtime is ~28sec; Anton's - ~30sec (PC: 1.6 ghz, 512 mb) Not so bad.. keeping in mind that 256000 billions quadruplets to check :) import psyco, time psyco.full() t = time.clock(

Re: SQLite3, data not found

2007-03-17 Thread John Nagle
jim-on-linux wrote: > On Friday 16 March 2007 18:23, Jerry Hill wrote: > >>On 3/16/07, jim-on-linux <[EMAIL PROTECTED]> > > wrote: > >>>Below, the first select produces results but, >>>after closing then re-opening the database >>>the select produces an empty list. Anyone >>>know the reason ??

read a web page using python

2007-03-17 Thread myTesterFrench
Hi All, Kindly, could you someone tell me how to read a page(any web site) using Python, what method to be used ? Paris -- http://mail.python.org/mailman/listinfo/python-list

Re: Python shell on mac os x

2007-03-17 Thread Kevin Walzer
7stud wrote: > On Mar 16, 2:53 am, [EMAIL PROTECTED] wrote: >> or go tohttp://pythonmac.org/packages/ >> and you have python 2.5 or python 2.4.4 with readline support > > The download instructions seem to steer Mac users to version 2.4.4 > because it has more modules available. What is the consen

Re: Finding the insertion point in a list

2007-03-17 Thread 7stud
On Mar 17, 4:12 am, "Martin Blume" <[EMAIL PROTECTED]> wrote: > "7stud" schrieb > > > > > How about: > > > --- > > x = [0, 100, 200, 1000] > > y = -1 > > inserted = False > > > for i in range(len(x)): > > if(y <= x[i]): > > x.insert(i, y) > > inserted

Private data

2007-03-17 Thread Dustan
http://dustangroups.googlepages.com/privateattributesinpython This is something that I just threw together this morning, after a eureka moment. It's a way of creating private class attributes and static function variables (I'm not 100% sure if that's the correct terminology, but you get what I mea

Re: a better solution for GUI in python

2007-03-17 Thread Rainer Grimm
ce wrote: > Hi, > > My company is using python currently for our website. We need to > develop a GUI front-end for our ERP that would be portable (Windows > and Linux). > > My question is which solution would be better for the GUI (and easier > to implement)? I knew there are something like wxidg

tkinter grid vs pack

2007-03-17 Thread Gigs_
For what is grid better than pack, and otherwise? thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: Mastering Python

2007-03-17 Thread Alex Martelli
John Nagle <[EMAIL PROTECTED]> wrote: ... > >>Mastery and quickly are opposing terms Took me 15 years on a job > >>using FORTRAN 77 and I still wouldn't have called myself a master. (I'm ... > Python just isn't that complicated. The syntax is straightforward, Neither is/was Fortran 77,

Re: SQLite3, data not found

2007-03-17 Thread jim-on-linux
On Friday 16 March 2007 18:23, Jerry Hill wrote: > On 3/16/07, jim-on-linux <[EMAIL PROTECTED]> wrote: > > Below, the first select produces results but, > > after closing then re-opening the database > > the select produces an empty list. Anyone > > know the reason ?? > > When you first open a co

Re: Writing python module in C: wchar_t or Py_UNICODE?

2007-03-17 Thread Yury
Carsten Haese wrote: > > You should familiarize yourself with the Python/C API documentation. It > contains the answers to all the above questions. > > http://docs.python.org/api/arg-parsing.html says this about the "u" > format character: "a pointer to the existing Unicode data is stored into > t

Re: lock problem

2007-03-17 Thread Ritesh Raj Sarraf
Leo Kislov wrote: > But you miss the fact that there is only one environment per process. Maybe there's a confusion. The environment variable that I'm setting has noting to do with ldapsearch. I use the environment variable as a filename to which ldapsearch can redirect its output. And that I do

Re: lock problem

2007-03-17 Thread Ritesh Raj Sarraf
Leo Kislov wrote: > But you miss the fact that there is only one environment per process. > Oh!! I think I get your point. There'd be only one __kabc_ldap environment variable to which all the threads would be overwriting. Hmmm!! Yes, you're correct. Thanks for pointing it out. Ritesh -- Rit

Re: Finding the insertion point in a list

2007-03-17 Thread John Machin
On Mar 17, 9:46 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> or even > > >> len(filter(lambda t, y=y: y>t, x)) > > > How about > > >min(i for i,t in enumerate(x) if t >= y) > > > or > > >max(i for i,t in enumerate(x) if

[Announce] Scribes 0.3.1 Released

2007-03-17 Thread mystilleef
Scribes is python editor for *nix and GNOME that balances simplicity with power. This release features extensibility via Python plugins, auto-completion enhances, snippets improvement, automatic replacement and correction, a new minimalist interface, performance optimizations and more... release n

cannot start IDLE in WinXP

2007-03-17 Thread imx
Hi, Enviroment: WinXP sp2, python 2.5 problem: click IDLE using shorcut menu or run phthonw.exe directly, nothing happen! But running python.exe from the command line is fine. I searched this issue on the net and this forum and tried some suggestions but with no luck. Any ideas? Thanks in advan

Re: import error

2007-03-17 Thread Steve Holden
Gabriel Genellina wrote: > En Fri, 16 Mar 2007 23:49:43 -0300, Nick Burns <[EMAIL PROTECTED]> > escribió: > >> Quick question. I am running python on windows xp. i want to import my >> own >> module "mymod". However, when I try to import it i get the error message >> "ImportError: >> no modu

Re: Finding the insertion point in a list

2007-03-17 Thread Steve Holden
Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> or even >> >> len(filter(lambda t, y=y: y>t, x)) > > > How about > >min(i for i,t in enumerate(x) if t >= y) > > or > >max(i for i,t in enumerate(x) if t <= y) > > Those are actually pretty direct. How about a soluti

Re: File extension

2007-03-17 Thread Steve Holden
Anil Kumar wrote: > Hi, > > Can Python Script can have different extensions like .sh etc Or Is > .py is mandatory to be present as the extension for the Python Script. > The interpreter itself doesn't really care. The issues you are hotting are due to operating system. and command shell d

Re: Returning other instance from __init__ - I need help

2007-03-17 Thread Gabriel Genellina
En Fri, 16 Mar 2007 22:05:05 -0300, Paulo da Silva <[EMAIL PROTECTED]> escribió: > When debugging, I found this is wrong!!! > Would someone please clarify what do I have to return from > __new__? Try this. I used a classmethod for load, it may be easier to subclass. class C(object): def

Re: Finding the insertion point in a list

2007-03-17 Thread John Machin
On Mar 17, 5:42 pm, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > or even > > > len(filter(lambda t, y=y: y>t, x)) > > How about > >min(i for i,t in enumerate(x) if t >= y) > > or > >max(i for i,t in enumerate(x) if t <= y) > > Those are actu

Re: "urlopen" not thread safe

2007-03-17 Thread Gabriel Genellina
En Thu, 15 Mar 2007 21:12:46 -0300, John Nagle <[EMAIL PROTECTED]> escribió: > I was looking at the code for "urllib", and there's > some undocumented "FTP cacheing" code in there that's not thread safe. > The documentation for "urllib" > > Is there any good reason to keep that code in "

ECCOMAS VipIMAGE 2007 - Abstracts Submission Period Extended in TWO WEEKS

2007-03-17 Thread [EMAIL PROTECTED]
International ECCOMAS Thematic Conference VipIMAGE 2007 - I ECCOMAS THEMATIC CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL IMAGE PROCESSING 17-19th October 2007, FEUP, Porto, Portugal http://www.fe.up.pt/VIPIMAGE We would appreciate if you could distribute this information by your colleagues and

Re: Weekly Python Patch/Bug Summary

2007-03-17 Thread Dick Moores
At 01:32 AM 3/17/2007, Terry Reedy wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >| May I ask a dumb question here? It isn't clear to me what to do with >these patches. For most of them there is something like, "Committed as >r54386 and r54387". I'm familiar wi

Re: File extension

2007-03-17 Thread Gabriel Genellina
En Fri, 16 Mar 2007 19:59:09 -0300, Anil Kumar <[EMAIL PROTECTED]> escribió: > But when I try a python script with extension .sh in windows, the file is > not getting recognized by the Python interpreter. Is this supported? Or > is > there any way we can achieve the same? C:\TEMP>type test.sh

Re: lock problem

2007-03-17 Thread Gabriel Genellina
En Fri, 16 Mar 2007 04:40:27 -0300, Ritesh Raj Sarraf <[EMAIL PROTECTED]> escribió: > Leo Kislov wrote: > >> You're changing environmental variable __kabc_ldap that is shared >> between your threads. Environment is not designed for that kind of >> usage, it was designed for settings. Either use

Re: Finding the insertion point in a list

2007-03-17 Thread Martin Blume
"7stud" schrieb > How about: > > --- > x = [0, 100, 200, 1000] > y = -1 > inserted = False > > for i in range(len(x)): > if(y <= x[i]): > x.insert(i, y) > inserted = True > break > if(not inserted): x.append(y) > > print x > --

Re: import error

2007-03-17 Thread Gabriel Genellina
En Fri, 16 Mar 2007 23:49:43 -0300, Nick Burns <[EMAIL PROTECTED]> escribió: > Quick question. I am running python on windows xp. i want to import my > own > module "mymod". However, when I try to import it i get the error message > "ImportError: > no module named mymod". > > "mymod" is loca

Re: TypeError: 'module' object is not callable

2007-03-17 Thread Gabriel Genellina
En Fri, 16 Mar 2007 14:42:49 -0300, <[EMAIL PROTECTED]> escribió: > and i tried to call profile('t.printworld()') > > but i received the following error: > Traceback (most recent call last): > File "", line 1, in ? > TypeError: 'module' object is not callable It's always better to post the *who

Re: (unknown)

2007-03-17 Thread Gabriel Genellina
En Sat, 17 Mar 2007 03:54:22 -0300, Milton Segura <[EMAIL PROTECTED]> escribió: > Hello, I'm trying to exclude files from a list using the following code: > for item in dirs:if item.find('Software') > -1: > dirs.remove(item)elif item.find('Images') > -1: > dirs.remove(i

Re:

2007-03-17 Thread Shane Geiger
Milton, This isn't terribly elegant, but it gets the job done: dirs = ['C:\Images', 'C:\Images\2006', 'C:\Images\2007', 'C:\Music', 'C:\Files', 'C:\Software', 'C:\Software\Python', 'C:\Software\iTunes'] exclude_list = ['Software','Images']

Re: Odd error

2007-03-17 Thread John Machin
On Mar 17, 4:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm trying to use a script that I originally wrote on a Mac Classic > machine and have moved to a Windows XP machine. > > I can open the script and edit the thing, but when I try to run it in > I get: > Exception in Tkinter callba

Re: distributing python software in jar like fashion

2007-03-17 Thread Gary Duzan
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: > Were Python "eggs" a flop, or what? > > We need to have one packager that everyone agrees on. >Otherwise, installs become a mess, and then you have to have >installers that handle multiple packagers. I think the po

Re: Weekly Python Patch/Bug Summary

2007-03-17 Thread Terry Reedy
"Dick Moores" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | May I ask a dumb question here? It isn't clear to me what to do with these patches. For most of them there is something like, "Committed as r54386 and r54387". I'm familiar with updating the editor Ulipad to the latest