Databases and python

2006-02-16 Thread Dan Stromberg
I've been putting a little bit of time into a file indexing engine in python, which you can find here: http://dcs.nac.uci.edu/~strombrg/pyindex.html It'll do 40,000 mail messages of varying lengths pretty well now, but I want more :) So far, I've been taking the approach of using a single-table

How to run shell commands within python

2006-02-16 Thread fileexit
How can I execute shell commands from within python. Specifically, I am looking for something like the shell "cat". But this also made me wonder how to execute shell commands anyway, just if i needed to do that in the future. -- http://mail.python.org/mailman/listinfo/python-list

text encodings -> subprocess.Popen or -> labelmarkup (pygtk)

2006-02-16 Thread calmar
Hi all, first of all, I have to say I have hardly no knowledge about that issue. on the program there, I have it like that: ,--- | obj = unicode(newcomment, 'utf-8') | newcomment = obj.encode('latin-1') | | pipe = subproces

Re: How to run shell commands within python

2006-02-16 Thread Fredrik Lundh
"fileexit" wrote: > thanks... i was to hasty to post this question, i found a good answer > here: > http://groups.google.com/group/comp.lang.python/browse_thread/thread/ffdab847125f81b6 that's an old thread, and Python has grown a few more ways to deal with shell commands since then. if os.syste

Re: How to run shell commands within python

2006-02-16 Thread Juho Schultz
fileexit wrote: > How can I execute shell commands from within python. Specifically, I > am looking for something like the shell "cat". But this also made me > wonder how to execute shell commands anyway, just if i needed to do > that in the future. > You can use os.system() for that. -- http:/

Re: pop line from file

2006-02-16 Thread Sinan Nalkaya
i am unix platform, now searching for the mkfifo topics. thank you all. -- http://mail.python.org/mailman/listinfo/python-list

Re: Poisson Distribution (for a newbie)

2006-02-16 Thread Jeremy Sanders
[EMAIL PROTECTED] wrote: > I want to mimic such kind of distribution using poison traffic ( a bell > shaped curve). I looked into wikipedia and some other tutorials but I > wasn't sure how many parameter does the above kind of distribution > would require. I've used numarray's poisson distributio

Re: text encodings -> subprocess.Popen or -> labelmarkup (pygtk)

2006-02-16 Thread Fredrik Lundh
"calmar" wrote: > Then I think, 'what' kind of encoding I can send to an external program, > depends also on that program? the encoding is a mapping between raw bytes and their actual meaning, and a program usually only sees the bytes, so it's entirely up to the pro- gram to interpret what you se

Re: web crawler in python or C?

2006-02-16 Thread Fuzzyman
abhinav wrote: > It is DSL broadband 128kbps.But thats not the point.What i am saying is > that would python be fine for implementing fast crawler algorithms or > should i use C. But a web crawler is going to be *mainly* I/O bound - so language efficiency won't be the main issue. There are severa

Re: How to run shell commands within python

2006-02-16 Thread Szabolcs Nagy
use subprocess module from subprocess import call call(['cmd', 'arg1', 'arg2'], stdin='...', stdout='...') eg: call(['ls', '-l']) -- http://mail.python.org/mailman/listinfo/python-list

Re: Encryption

2006-02-16 Thread Robert J. Hansen
Honestly, the best thing you can do when it comes to writing crypto code is _not_ write crypto code. It's far better to instead use pre-existing, trusted, scrutinized, audited code. You'll probably be better served looking for a Python interface to OpenSSL, which will provide you with all the alg

Re: HTTP & tcl

2006-02-16 Thread Fuzzyman
alf wrote: > Hi > > I would like to convert the wctpXml-1.3.py program to Tcl (line by > line). > See http://sourceforge.net/project/showfiles.php?group_id=29217 > This program sends pages using WCTP. I know nothing about Python or > XML but this program is small and seems straightforward and I a

Re: %SystemDrive%

2006-02-16 Thread Atanas Banov
Bryan Olson wrote: > To get it with the \, you might use: > > os.path.abspath(os.environ['SYSTEMDRIVE']) wrong! the result is incorrect if the current directory is different from the root. >>> os.chdir("c:\\winxp") >>> os.path.abspath(os.environ['SYSTEMDRIVE']) 'c:\\winxp' if you really wan

Job advert: Your help needed

2006-02-16 Thread Paul Boots
Hi All, I hope you guys don't mind me posting this to the list, but ... We are looking for a programmer on a very short term to help us write a relative simple, yet very specialised, command line application for our post production pipeline for a television show shot in HD (dpx files) using Vi

Re: Databases and python

2006-02-16 Thread Rene Pijlman
Dan Stromberg: >is there a python database interface that would allow me to define a >-lot- of tables? Like, each word becomes a table, and then the fields >in that table are just the filenames that contained that word. Give ZODB a try. http://www.zope.org/Wikis/ZODB/FrontPage http://www.pytho

Re: Databases and python

2006-02-16 Thread bruno at modulix
Jonathan Gardner wrote: > I'm no expert in BDBs, but I have spent a fair amount of time working > with PostgreSQL and Oracle. It sounds like you need to put some > optimization into your algorithm and data representation. > > I would do pretty much like you are doing, except I would only have the

Re: PyXML SAX Q?

2006-02-16 Thread Alan Kennedy
[EMAIL PROTECTED] > is it possible to use SAX to parse XML that is not in a file but in a > large string? > If I open my XML file and read the content into a string variable. Is > there a way I can pass it to the PyXML Sax handler? > The reason I want to know is that I need to parse XML that is gen

Re: Unexpected behaviour of getattr(obj, __dict__)

2006-02-16 Thread Christos Georgiou
On Tue, 14 Feb 2006 22:24:12 -0500, rumours say that "Terry Reedy" <[EMAIL PROTECTED]> might have written: > id(Parrot.f) == id(Parrot.f) >> True > id(Parrot.__dict__) == id(Parrot.__dict__) >> True > >A wrapper is created and passed to id() which returns an int object while >releasing th

ANN: FreeImagePy 1.2.2

2006-02-16 Thread Michele Petrazzo
FreeImagePy 1.2.2 is available at freeimagepy.sf.net What is? It' a python wrapper for FreeImage, Open Source library for developers who would like to support popular graphics image formats. How work? It use a binary freeimage library present on the system and ctypes. Major changes fro

Re: multi/double dispatch, multifunctions once again

2006-02-16 Thread bruno at modulix
AndyL wrote: > Hi, (OT : please repeat the question in the body of the post...) > Where I can find a module supporting that? http://peak.telecommunity.com/DevCenter/PyConGenericFunctions -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

pymssql and date format

2006-02-16 Thread eight02645999
hi i am using pymmsql to query a date column in MSSQL database table. However the result shows for example (datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be 2006-02-16 17:50:19.000 anyway to correct query a date column using pymssql so that it gives the correct date format? thanks

Re: multiple inheritance

2006-02-16 Thread Thomas Girod
thanks, you pointed exactly on what distrurbed me. I'll see what I can do with cooperative methods. -- http://mail.python.org/mailman/listinfo/python-list

Re: web crawler in python or C?

2006-02-16 Thread Paul Rubin
"abhinav" <[EMAIL PROTECTED]> writes: > It is DSL broadband 128kbps.But thats not the point. But it is the point. > What i am saying is that would python be fine for implementing fast > crawler algorithms or should i use C.Handling huge > data,multithreading,file handling,heuristics for ranking,a

Re: apache mod_python problem

2006-02-16 Thread Ido Yehieli
Hi Graham, thank you for that link but it didn't help. I've followed the instructions, yet In the 'basic-content-handler' section, after getting to the point where it says to add this to the main Apache configuration file: AllowOverride FileInfo I replaced /some/directory with the correct direc

Re: any ftpd written in python?

2006-02-16 Thread garabik-news-2005-05
Kenneth Xie <[EMAIL PROTECTED]> wrote: > I need a simple ftpd example in pure python. Is there already such a > ftpd available? > Thank you very much in advance. self-advertising: http://melkor.dnp.fmph.uniba.sk/~garabik/pyftpd.html it is a bit dated and I do not develop it anymore, but as a base

Extend/embedd python problem?

2006-02-16 Thread Mile Blenton
Hello all, I am considering python as a 'scripting' language to be used in my application where users must be able to write their own code to access application data, use the application mechanisms to gather various data and basicly must be able to control the application itself. Currently, to

Re: apache mod_python problem

2006-02-16 Thread Ido Yehieli
please ignore that last message, the instructions on that webpage worked, it was my fault. Thanks, Ido. -- http://mail.python.org/mailman/listinfo/python-list

Re: Excel and TrackChanges

2006-02-16 Thread pierre_py
If i move the Save after the HighlightChangesOptions it will popup a message saying it can only be used when workbook is saved. The problem is actually not only in python, i figured out that the samples in msdn (which do the same) don't work in VBA also (if i give my macros a shortcut). I have no

Re: Embedding an Application in a Web browser

2006-02-16 Thread paron
>From the OP: As for the application it has to be able display simple animated graphics such as circles, lines and squares. However if someone clicks on a shape it should open up another application, such as Word. Thanks, Rod Python Newbie The application itself can sit on the local users compu

MySQL

2006-02-16 Thread rodmc
I need to write a Python application which connects to a MySQL 5.0 database. Can anyone point me in the right direction or a compatible library? Best, rod -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQL

2006-02-16 Thread Wolfram Kraus
rodmc wrote: > I need to write a Python application which connects to a MySQL 5.0 > database. Can anyone point me in the right direction or a compatible > library? > > Best, > > rod > See http://sourceforge.net/projects/mysql-python HTH, Wolfram -- http://mail.python.org/mailman/listinfo/pyt

Visual Report Editor

2006-02-16 Thread Pawel
Hello, I plan to make Visual Reporting Editior, a new product for corporate-class systems. Data will be in XML and in my application, designer should be able to make fascinating templates of reports. I will use Python and MSVS 2005 Pro. My question is, which libaries will be useful in my job. I pla

Re: web crawler in python or C?

2006-02-16 Thread gene tani
Paul Rubin wrote: > "abhinav" <[EMAIL PROTECTED]> writes: > > maintaining huge data structures.What should be the language so as > > not to compromise that much on speed.What is the performance of > > python based crawlers vs C based crawlers.Should I use both the > > languages(partly C and pytho

Re: Databases and python

2006-02-16 Thread Bryan Olson
Dan Stromberg wrote: > I've been putting a little bit of time into a file indexing engine [...] > So far, I've been taking the approach of using a single-table database > like gdbm or dbhash [...] and making each entry keyed by > a word, and under the word in the database is a null terminated list

Re: web crawler in python or C?

2006-02-16 Thread gene tani
abhinav wrote: > Hi guys.I have to implement a topical crawler as a part of my > project.What language should i implement Oh, and there's some really good books out there, besides the Orilly Spidering Hacks. Springer Verlag has a couple books on "Text Mining" and at least a couple books with "we

Re: Visual Report Editor

2006-02-16 Thread Diez B. Roggisch
Pawel wrote: > Hello, > I plan to make Visual Reporting Editior, a new product for > corporate-class systems. Data will be in XML and in my application, > designer should be able to make fascinating templates of reports. I > will use Python and MSVS 2005 Pro. My question is, which libaries will >

OT- wxPython mailing list problems

2006-02-16 Thread Franz Steinhaeusler
Sorry about asking here, but has anyone experienced, that no message can be sent to the mailing list? Neither with Gmane, nor with Google mail. I always get this reply: from [EMAIL PROTECTED] """ Hi. This is the qmail-send program at sunsite.dk. I'm afraid I wasn't able to deliver your messag

Re: Embedding an Application in a Web browser

2006-02-16 Thread Paul Boddie
Atanas Banov wrote: > paron wrote: > > I forgot -- I like the idea of Kerrigell, too. It runs on top of > > CherryPy, and lets you use python either in the server (which is just a > > little program on your local machine) or embedded in the html pages, or > > in a Kerrigell service, which is an app

Re: any ftpd written in python?

2006-02-16 Thread Jean-Paul Calderone
On Thu, 16 Feb 2006 14:07:55 +0800, Kenneth Xie <[EMAIL PROTECTED]> wrote: >I need a simple ftpd example in pure python. Is there already such a >ftpd available? >Thank you very much in advance. Twisted includes an FTP server: [EMAIL PROTECTED]:~$ mkdir a a/b a/c a/d [EMAIL PROTECTED]:~$ mkta

Re: Visual Report Editor

2006-02-16 Thread Michele Petrazzo
Pawel wrote: > Hello, Hi Pawel, > I plan to make Visual Reporting Editior, a new product for > corporate-class systems. Data will be in XML and in my application, > designer should be able to make fascinating templates of reports. I > will use Python and MSVS 2005 Pro. What are MSVS 2005 Pro

mod_python help!

2006-02-16 Thread treelife
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req): req.content_type = 'text/plain' req.write("Under Construction") return apache.OK Here is some other relevant

Re: ANN: FreeImagePy 1.2.2

2006-02-16 Thread Claudio Grondi
Michele Petrazzo wrote: > FreeImagePy 1.2.2 is available at freeimagepy.sf.net > > What is? > It' a python wrapper for FreeImage, Open Source library for developers >who would like to support popular graphics image formats. > > How work? > It use a binary freeimage library present on the

Re: web crawler in python or C?

2006-02-16 Thread Andrew Gwozdziewycz
On 15 Feb 2006 21:56:52 -0800, abhinav <[EMAIL PROTECTED]> wrote: > Hi guys.I have to implement a topical crawler as a part of my > project.What language should i implement > C or Python? Why does this keep coming up on here as of late? If you search the archives, you can find numerous posts about

Re: ANN: FreeImagePy 1.2.2

2006-02-16 Thread Andrew Gwozdziewycz
> Knowing some details about PIL and as good as no details about > FreeImage, I would like in this context to become enlightened by the > answer to the question, when does it make sense to use FreeImage instead > of PIL? > From what I know up to now I can't see any use for FreeImage :-( . both fr

[ANN] pyqonsole-0.2.0

2006-02-16 Thread Alexandre Fayolle
Logilab has released pyqonsole-0.2.0 Pyqonsole is a X Window terminal written in Python. The code is based on konsole, and it uses the Qt toolkit. It is mainly meant for use by Python application developpers who would like to embed a terminal in their application, but it can be used as a not blazi

looping over more than one list

2006-02-16 Thread Iain King
When I loop over one list I use: for item in items: print item but often I want to loop through two lists at once, and I've been doing this like I would in any other language - creating an index counter and incrementing it. For example, (completely arbitrary), I have two strings of the same l

Some general questions about using "stdin","stdout"....

2006-02-16 Thread asdsd sir
Hi!I'm new in Python and i'd like to ask some general questions about stdin,stdout... Firstly... if we type like something like : cat "file.txt"|python somefile.py #somefile.py import sys text=sys.stdin.read() ...then "sys.stdin.read()" will read from "cat"s stdout... However,if i

Re: Win32_Process.Create -- not starting process

2006-02-16 Thread abcd
Tim, I am skipping using the batch file and only executing the python script directly...and so far it works fine. So now I have: pid, retVal = wmi.WMI("1.2.3.4").new("Win32_Process").Create(CommandLine="c:\python\python.exe c:\some_script.py") Thanks again...not sure why when using the batch

Re: Visual Report Editor

2006-02-16 Thread Paul McNett
Pawel wrote: > I plan to make Visual Reporting Editior, a new product for > corporate-class systems. Data will be in XML and in my application, > designer should be able to make fascinating templates of reports. I > will use Python and MSVS 2005 Pro. My question is, which libaries will > be useful

Installing packages in /usr/local

2006-02-16 Thread Torsten Bronger
Hallöchen! I use the Suse 10.0 RPM of Python 2.4. Unfortunately, it doesn't seem to look for packages in /usr/local because "prefix" and "exec_prefix" in site.py are the same (namely usr/). I have my own packages in /usr/local/lib/python/site-packages. (Due to easier backup, I don't want to cha

Re: ANN: FreeImagePy 1.2.2

2006-02-16 Thread Szabolcs Nagy
eg.: .dds (compressed texture file format) widely used in 3d games but not accessible in pil -- http://mail.python.org/mailman/listinfo/python-list

Re: Encryption

2006-02-16 Thread Larry Bates
dirvine wrote: > HI hope you can help (know you can). > > I am looking for a very strong AIS or better symetrical encryption in > python. Any suggestions ideas welcome. I have spent a lot of time > looking everywhere at pycrypto and many others but is a wee bit of a > minefield out there. Anyone h

Re: looping over more than one list

2006-02-16 Thread EleSSaR^
Iain King si è profuso/a a scrivere su comp.lang.python tutte queste elucubrazioni: [cut] I think you should take a look at the zip() function. You can use for with it like this: for elem1, elem2, elem3 in zip(list1, list2, list3): -- Alan Franzoni <[EMAIL PROTECTED]> - Togli .xyz dal

Re: ANN: FreeImagePy 1.2.2

2006-02-16 Thread Michele Petrazzo
Claudio Grondi wrote: > Knowing some details about PIL and as good as no details about > FreeImage, I would like in this context to become enlightened by the > answer to the question, when does it make sense to use FreeImage > instead of PIL? Into some little environments, like tiff with G3/G4

Re: Is empty string cached?

2006-02-16 Thread Peter Hansen
Farshid Lashkari wrote: > However, the following commands add to my confusion: > > >> a = 'wtf?' > >> b = 'wtf?' > >> a is b > False > > So how are string literals cached? Is there an explanation somewhere? Is > it some freaky voodoo, and I should just assume that a string literal > will alw

Re: MySQL

2006-02-16 Thread rodmc
Hi Wolfram, Thanks for the tip, after some server issues I am pleased to say the library appears to work perfectly with MySQL 5. Best, rod -- http://mail.python.org/mailman/listinfo/python-list

[ANN] Pydev and Pydev Extensions 1.0.2 release

2006-02-16 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.0.2 have been released Check http://www.fabioz.com/pydev for details on Pydev Extensions and http://pydev.sf.net has for details on Pydev Highlights in Pydev Extensions: --- - New feature in the debugger: the console is available

Determing whether two ranges overlap

2006-02-16 Thread Robin Haswell
Hey guys I was wondering if you could give me a hand with something. If I have two tuples that define a range, eg: (10, 20), (15, 30), I need to determine whether the ranges overlap each other. The algo needs to catch: (10, 20) (15, 25) (15, 25) (10, 20) (10, 25) (15, 20) and (15, 20) (10, 25) I

Re: Safe Python Execution

2006-02-16 Thread Alex Martelli
Graham <[EMAIL PROTECTED]> wrote: > I've been messing around with trying to get a small sandbox like > environment where i could execute python code in a "safe" way. > Basically what the old restricted execution module attempted to do. > I've written a small amount of code to get custom interprete

Re: Determing whether two ranges overlap

2006-02-16 Thread Steven D'Aprano
On Thu, 16 Feb 2006 15:22:15 +, Robin Haswell wrote: > Hey guys > > I was wondering if you could give me a hand with something. If I have two > tuples that define a range, eg: (10, 20), (15, 30), I need to determine > whether the ranges overlap each other. The algo needs to catch: > > (10, 2

Re: question about scope

2006-02-16 Thread Fuzzyman
John Salerno wrote: [snip..] > > Thanks guys. It seems like nested functions were what the authors had in > mind, so that makes a lot more sense now. > > But as far as ifs and loops, is there such a thing as scope in them? For > example, if I assign a variable within an if statement, is it usable

RE: Determing whether two ranges overlap

2006-02-16 Thread Tim Golden
[Robin Haswell] | I was wondering if you could give me a hand with something. | If I have two | tuples that define a range, eg: (10, 20), (15, 30), I need to | determine | whether the ranges overlap each other. The algo needs to catch: | | (10, 20) (15, 25) | (15, 25) (10, 20) | (10, 25) (15, 2

Re: is socket thread safe?

2006-02-16 Thread Carl J. Van Arsdall
Bryan Olson wrote: > Carl J. Van Arsdall wrote: > >> Steve Horsley wrote: >> >> >>> [EMAIL PROTECTED] wrote: >>> >>> >>> thread1: while 1: buf = s.read() process(buf) thread2: while 1: buf = getdata()

Re: How to run shell commands within python

2006-02-16 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > (also note that most trivial shell commands are better done in > python. most uses of cat, for example, can be trivially emulated > with one or two lines of python...) Though the knowledge required to do this may be mo

Re: Some general questions about using "stdin","stdout"....

2006-02-16 Thread Dan
Hello. If you're new to Python, then input/output isn't the best place to start. Begin with the tutorial: http://docs.python.org/tut/tut.html Other documentation is also linked to from there. However, I will briefly answer your questions. > print "hello"|sys.stdin.read() In Python the | ope

Re: Determing whether two ranges overlap

2006-02-16 Thread Fredrik Lundh
Robin Haswell wrote: > I was wondering if you could give me a hand with something. If I have two > tuples that define a range, eg: (10, 20), (15, 30), I need to determine > whether the ranges overlap each other. The algo needs to catch: > > (10, 20) (15, 25) > (15, 25) (10, 20) > (10, 25) (15, 20)

Re: pythonic way of 'b = list(a); b.append(4)"

2006-02-16 Thread Heiko Wundram
szabi wrote: > a = [1, 2, 3] > f(*a, 4) f(*(a+[4])) --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list

Re: Some general questions about using "stdin","stdout"....

2006-02-16 Thread Diez B. Roggisch
asdsd sir wrote: > Hi!I'm new in Python and i'd like to ask some general questions about > stdin,stdout... > > Firstly... > > if we type like something like : >cat "file.txt"|python somefile.py > > #somefile.py > import sys > text=sys.stdin.read() > > > ...then "sys.stdin.read()"

Re: is socket thread safe?

2006-02-16 Thread Carl J. Van Arsdall
Jean-Paul Calderone wrote: > On Wed, 15 Feb 2006 12:59:03 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> > wrote: > >> Steve Horsley wrote: >> >>> [EMAIL PROTECTED] wrote: >>> >>> thread1: while 1: buf = s.read() process(buf) threa

Re: pythonic way of 'b = list(a); b.append(4)"

2006-02-16 Thread Peter Otten
szabi wrote: > I have a list of three values and want to call a function with four > parameters. I would like > to write something like: > > a = [1, 2, 3] > f(*a, 4) > > This is syntactically wrong, so is there a function which appends a > value to a list and > returns the new value, so that I c

Re: question about scope

2006-02-16 Thread Fredrik Lundh
John Salerno wrote: > But my real question is this, which is related to the above: > > "Name references search at most four scopes: local, then enclosing > functions (if any), then global, then built-in." > > I understand what global and built-in are, and I thought I understood > the concept of lo

Re: web crawler in python or C?

2006-02-16 Thread Steven D'Aprano
On Wed, 15 Feb 2006 21:56:52 -0800, abhinav wrote: > Hi guys.I have to implement a topical crawler as a part of my > project.What language should i implement > C or Python?Python though has fast development cycle but my concern is > speed also.I want to strke a balance between development speed an

Re: looping over more than one list

2006-02-16 Thread Alex Martelli
Iain King <[EMAIL PROTECTED]> wrote: ... > This works: > > def lowest(s1,s2): > s = "" > for c1,c2 in [x for x in zip(s1,s2)]: > s += lowerChar(c1,c2) > return s > > but it's hardly any more elegant than using a loop counter, and I'm > guessing it's performance is a lot wor

Re: looping over more than one list

2006-02-16 Thread Tim Chase
> def lowest(s1,s2): > s = "" > for i in xrange(len(s1)): > s += lowerChar(s1[i],s2[i]) > return s > > this seems unpythonic, compared to something like: > > def lowest(s1,s2): > s = "" > for c1,c2 in s1,s2: > s += lowerChar(c1,c2) > return s If I understa

mod_python and open HTTP connection

2006-02-16 Thread Charles
Hello, I'm think about using mod_python for a project but I need to make sure: Does mod_python time out after a minute ? (I hope not). If I leave an HTTP connection open so that the content keeps loading inside the browser window indefinately, and if I close the browser window, the mod_pyth

Re: pythonic way of 'b = list(a); b.append(4)"

2006-02-16 Thread szabi
The question was perfectly answered by Heiko Wundram: f(*(a+[4])) I know python is not a lawnmower but a programming language. I can solve a lot of problems, but I prefer short, clear and nice solutions to long and/or too powerful ones. So, my problem with my solution (b = list(a); b.append(4)) wa

Re: Is empty string cached?

2006-02-16 Thread Farshid Lashkari
> A few comments (which I hope are correct, but which I hope you will read > then mostly ignore since you probably shouldn't be designing based on > this stuff anyway): Thanks for the info Peter. My original question wasn't due to any observed performance problems. I was just being curious :)

Re: Safe Python Execution

2006-02-16 Thread gene tani
Jean-Paul Calderone wrote: > On Thu, 16 Feb 2006 07:59:03 -0800, Alex Martelli <[EMAIL PROTECTED]> wrote: > >Graham <[EMAIL PROTECTED]> wrote: > > > >> I've been messing around with trying to get a small sandbox like > >> environment where i could execute python code in a "safe" way. > >> Basicall

Re: embedding python in HTML

2006-02-16 Thread bruno at modulix
John Salerno wrote: > Rene Pijlman wrote: > >> John Salerno: >> [Python alternative for PHP] >> >>> So to do this with Python, do I simply integrate it into the HTML as >>> above, with no extra steps? >> >> >> You'd need something like the PHP engine, that understands Python rather >> than PHP. >

Re: Merging two lists of data (Pythonic way)

2006-02-16 Thread SMB
"Jonathan Gardner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > codes = map(lambda x: x[0], list1) > for d in list2: > if d['code'] in codes: >d['VERIFIED'] = 1 > > Is this what you were looking for? > That is exactly what I was looking for. I will have to take a look at m

Re: question about scope

2006-02-16 Thread Steven D'Aprano
On Thu, 16 Feb 2006 15:18:29 +, John Salerno wrote: > What's an example of a local scope without > having a function definition? Loops and if statements, perhaps? List comprehensions: [2*x+1 for x in range(50)] Lambdas: map(lambda y: y-2, [1,2,4,8,16,32]) At the moment the x in list compre

Re: Merging two lists of data (Pythonic way)

2006-02-16 Thread Paul Rubin
"SMB" <[EMAIL PROTECTED]> writes: > What I am doing is looking for a pythonic way to parse the LIST2 "code" > values and make appropriate changes to to each dictionary if the "code" > value is the first element of a list in LIST1. > > The final result may look like this given that the change is

Seaching Active Directory via ADO

2006-02-16 Thread LittlePython
I am have trouble finding a simple working example of using ADO to search Active Directory. I am hoping someone could point me to a generic working script that connects to AD and pulls up a recordset to help me get started into the right direction in learning ADO, ADSI on Python. -- http://mail

Installing python on lynxOS

2006-02-16 Thread Bryce
I'm trying to install python2.4.2 onto lynxOS 4.0.0. with gcc 2.95.3. I was wondering if anyone who has done this before could give me some pointers. I'm currently getting the following error when running make: gcc -o python Module/python.o libpython2.4.a -lsocket -lm called2:ld returned

Re: question about scope

2006-02-16 Thread John Salerno
John Salerno wrote: > I understand what global and built-in are, and I thought I understood > the concept of local too, but when I got to this sentence (and the > previous sentence), I became confused about the first two scopes. What's > the difference between 'local' and 'enclosing functions'?

calculating on matrix indices

2006-02-16 Thread Brian Blais
Hello, In my attempt to learn python, migrating from matlab, I have the following problem. Here is what I want to do, (with the wrong syntax): from numpy import * t=arange(0,20,.1) x=zeros(len(t),'f') idx=(t>5) tau=5 x[idx]=exp(-t[idx]/tau) # <---this line is wrong (gives a TypeError) #

Re: calculating on matrix indices

2006-02-16 Thread Colin J. Williams
Brian Blais wrote: > Hello, > > In my attempt to learn python, migrating from matlab, I have the > following problem. Here is what I want to do, (with the wrong syntax): > > from numpy import * > > t=arange(0,20,.1) > x=zeros(len(t),'f') > > idx=(t>5)# <---this produces a Boole

Queue.Queue()

2006-02-16 Thread john peter
 what happens behind the scenes when i create a Queue.Queue() without specifying a maxsize?  does a block of space gets allocated initially then dynamically "expanded" as needed?  if so, what is the default size of the initial space? is it always better to specify a big enough maxsize initially

Re: Merging two lists of data (Pythonic way)

2006-02-16 Thread Lonnie Princehouse
You might consider writing two classes to represent the values in list1 and list2. It might be more Pythonic than sloshing around all of those lists and dictionaries. But as it is, it looks like you want to find matching pairs of lists and dictionaries from list1 and list2, respectively: # index

Re: Seaching Active Directory via ADO

2006-02-16 Thread Roger Upole
You could also accomplish the same thing using the Command object, but this way is usually more concise for plain Sql. Roger "LittlePython" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I notice there is no adodb.command. This is not required? > Thx for the example! > "Ro

Re: Databases and python

2006-02-16 Thread Dan Stromberg
On Thu, 16 Feb 2006 13:45:28 +, Bryan Olson wrote: > Dan Stromberg wrote: >> I've been putting a little bit of time into a file indexing engine > [...] > >> So far, I've been taking the approach of using a single-table database >> like gdbm or dbhash [...] and making each entry keyed by >> a

question about scope

2006-02-16 Thread John Salerno
Here's a sentence from Learning Python: "Names not assigned a value in the function definition are assumed to be enclosing scope locals (in an enclosing def), globals (in the enclosing module's namespace) or built-in (in the predefined __builtin__ names module Python provides." I have trouble

getting the line just before or after a pattern searched

2006-02-16 Thread s99999999s2003
hi i have a file something like this abcdefgh ijklmnopq 12345678 rstuvwxyz . . . 12345678 . whenever i search the file and reach 12345678, how do i get the line just above and below ( or more than 1 line above/below) the pattern 12345678 and save to variables? thanks -- http://

Pyserial never read

2006-02-16 Thread luca72
Hello at all sorry for my english but i'm Italian. I use pyserial to communicate via rs232 with an extarnal device called smartmouse. I write the exact line that i want , but when i read i read only the echo ond not the other bytes. When i meke the same project with delphi i solve this problem with

pythonic way of 'b = list(a); b.append(4)"

2006-02-16 Thread szabi
Hi! I have a list of three values and want to call a function with four parameters. I would like to write something like: a = [1, 2, 3] f(*a, 4) This is syntactically wrong, so is there a function which appends a value to a list and returns the new value, so that I could write something like thi

Re: embedding python in HTML

2006-02-16 Thread John Salerno
bruno at modulix wrote: > You've got to understand that Python is *not* a 'ServerPage' language > (-> php, asp, jsp etc) in itself. Your server can now run python, fine, > but *how* ? CGI ? FastCGI ? mod_python ? other ? (hint: it's probably > just plain old CGI...) So does that mean I need to ha

Open Relay Test

2006-02-16 Thread D
Hi all .. how could one test to see if an open relay exists on a specific email server? -- http://mail.python.org/mailman/listinfo/python-list

Re: %SystemDrive%

2006-02-16 Thread Bryan Olson
Atanas Banov wrote: > Bryan Olson wrote: > >>To get it with the \, you might use: >> >> os.path.abspath(os.environ['SYSTEMDRIVE']) > > > wrong! > the result is incorrect if the current directory is different from the > root. Oops, sorry. I should know better than to code from what I think I

Sendmail "ok" signal?

2006-02-16 Thread Gaz
Hey. I looked at the Sendmail help and did not find a property where i can get an "ok" signal when the email is finally sent. I need something like that to show a "Processing, please stand by" screen when the server is sending an email, and when the email is out, another screen appears with an "Ema

Re: multiple inheritance

2006-02-16 Thread Thomas Girod
That's perfect. thanks. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >