Re: PEP 354: Enumerations in Python

2006-03-01 Thread Steven Bethard
Ben Finney wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > >> Ben Finney wrote: >>> This PEP specifies an enumeration data type for Python. >>> An enumeration is an exclusive set of symbolic names bound to >>> arbitrary unique values. Values within an enumeration can be iterated >>> and com

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However we cannot figure out how to cross-compile the .py (of > distribution) files and > generate the .pyc files for the target ppc from an i686 system. Is it > possible to cross > compile .pyc files from .py files? I am under the i

Re: how do I factor a number down to one digit?

2006-03-01 Thread Tim Roberts
"Allan" <[EMAIL PROTECTED]> wrote: > >as so forth. I then input a name. How do I treat each letter as a >single value? That is, instead of print myname I have to do a print >m+y+n+a+m+e which returns a number. I next want to convert the >resulting two or three digit number to a single digit. Like 1

Re: Make staticmethod objects callable?

2006-03-01 Thread Steven D'Aprano
Nicolas Fleury wrote: > Hi everyone, > I was wondering if it would make sense to make staticmethod objects > callable, so that the following code would work: This is one of the more unintuitive areas of Python, with side effects and different behaviour depending on whether code is called insid

PIL and PSDraw

2006-03-01 Thread Sybren Stuvel
Hi there, I'm experimenting with PIL to create a PostScript file. The end result should be an EPS file with a couple of bar graphs. At this moment, I have a very simple piece of code: ps = PIL.PSDraw.PSDraw(file('demo.ps', 'w')) ps.begin_document() ps.rectangle((0, 0, 650, 150))

Failing in a simple embedding example of python

2006-03-01 Thread Themistoklis Bourdenas
Hi I'm trying the following simple test in my application: FILE* fp = fopen("test.py", "r"); PyRun_SimpleFile(fp, "test.py"); fclose(fp); However I get seg fault is in PyRun_SimpleFile(fp, "test.py"). "test.py" is an existing file with a simple statement (print 7+4). Whe

Re: Failing in a simple embedding example of python

2006-03-01 Thread Fredrik Lundh
Themistoklis Bourdenas wrote: > Hi I'm trying the following simple test in my application: > > FILE* fp = fopen("test.py", "r"); > PyRun_SimpleFile(fp, "test.py"); > fclose(fp); > > > However I get seg fault is in PyRun_SimpleFile(fp, "test.py"). "test.py" > is an existing

Re: PEP 354: Enumerations in Python

2006-03-01 Thread greg
Steven D'Aprano wrote: > You can't shell an egg that isn't there. Yesterday upon the stair I shelled an egg that wasn't there. I'd shell the thing again today If only I could find a way. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-03-01 Thread greg
Ben Finney wrote: > On the assumption these might be basic types, though, that > name doesn't read so easily in lowercase ('enummember'). Maybe 'enumval'? I also thought of 'enumber' (from munging together 'enum' and 'member') but that looks too much like 'e-number' rather than 'enum-ber'. -- Gr

Re: PEP 354: Enumerations in Python

2006-03-01 Thread greg
Paul Rubin wrote: > Do you anticipate having parameters like socket.AF_INET that are > currently integers, become enumeration members in future releases? Since these are derived from values defined as integers in C, it's probably better to leave them that way. There may be code that relies on the

Re: PEP 354: Enumerations in Python

2006-03-01 Thread greg
Giovanni Bajo wrote: > What's the repr of an enumeration value? OTOH, it should be something like > "Weekdays.wed", so that eval(repr()) holds true. Also, it'd be very useful in > debug dumps, tracebacks and whatnot. That would be nice, but I don't think that's possible with what the PEP proposes

Re: PEP 354: Enumerations in Python

2006-03-01 Thread greg
Dan Sommers wrote: > In some parts of the world, calendar weeks begin on Monday > and end on Sunday, and in other parts of the world, work weeks begin on > Sunday and end on Thursday. Things like days of the week really have a circular ordering, so it doesn't inherently make sense to ask whether

Re: C++ OpenGL rendering, wxPython GUI?

2006-03-01 Thread Tobias Forslöw
Thanks for all the quick help! After reading your posts about how the canvases actually work it was fairly easy to make my C++ code work within a wxPython frame. Now I only have to decide If I'm actually going to use wxPython or if there is a better alternative but there seem to be plenty of threa

Re: error: argument after ** must be a dictionary

2006-03-01 Thread bruno at modulix
abcd wrote: > I have class like this... > > import threading > class MyBlah(object): > def __init__(self): > self.makeThread(self.blah, (4,9)) > > def blah(self, x, y): > print "X and Y:", x, y > > def makeThread(self, func, args=(), kwargs={}): > threading.Th

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-03-01 Thread Magnus Lycka
Mladen Adamovic wrote: > Magnus Lycka wrote: > >> On Windows that it. At least on Linux and Solaris, time.clock() returns >> CPU time. If time.clock() returns significantly different values before >> and after time.sleep(1), there's something seriously broken in sleep on >> such platforms. > > No

Re: Modify the local scope inside a function

2006-03-01 Thread Fabio Zadrozny
Hi Sandra, Well, first, I'm not sure if you'd be interested, but Pydev Extensions (http://www.fabioz.com/pydev) should be able to make remote debugging in the way you want...Now, in order to do what you are trying to do, debuggers (or at least the pydev debugger) go for the frame you want to e

pysqlite problem

2006-03-01 Thread bapolis
Hello, I'm getting the following error: pysqlite2.dbapi2.OperationalError: no such table: tbl1 Here's my code: from pysqlite2 import dbapi2 as sqlite con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) cur = con.cursor() cur.execute("select * from tbl1") data = cursor.fetchall(

RE: pysqlite problem

2006-03-01 Thread Tim Golden
[EMAIL PROTECTED] | I'm getting the following error: | | pysqlite2.dbapi2.OperationalError: no such table: tbl1 | | Here's my code: | | from pysqlite2 import dbapi2 as sqlite | con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) | cur = con.cursor() | cur.execute("select * from

Re: telnetlib problems

2006-03-01 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm trying to use a python script to access an embedded computer >running linux and connected via a crossover ethernet cable using the >following script... >...and I realize the username and password is not realistic... I'm >still in "proof of concept" stage here :) >#

Re: pysqlite problem

2006-03-01 Thread bapolis
my bad. that was the wrong code, here is my code: from pysqlite2 import dbapi2 as sqlite con = sqlite.connect("ex1") cur = con.cursor() cur.execute("select * from tbl1") print cur.fetchall() -- http://mail.python.org/mailman/listinfo/python-list

Re: pysqlite problem

2006-03-01 Thread looping
Is it the complete code ? If so then you have to create the table each time you connect to the DB. You use an in-memory DB (":memory:") so all the data of the DB is lost when you close the connection, including the schema of the DB. -- http://mail.python.org/mailman/listinfo/python-list

RE: pysqlite problem

2006-03-01 Thread Tim Golden
[EMAIL PROTECTED] | my bad. that was the wrong code, here is my code: | | from pysqlite2 import dbapi2 as sqlite | con = sqlite.connect("ex1") | cur = con.cursor() | cur.execute("select * from tbl1") | print cur.fetchall() Just a thought... is the file containing your database called -- exactly

Re: pysqlite problem

2006-03-01 Thread looping
OK, it's better. You use relative path to your file 'ex1', are you really sure that you open the right file and not creating another DB in another path ? Try to use absolute path (r'c:\temp\ex1'). -- http://mail.python.org/mailman/listinfo/python-list

Re: pysqlite problem

2006-03-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I'm getting the following error: > > pysqlite2.dbapi2.OperationalError: no such table: tbl1 > > Here's my code: > > from pysqlite2 import dbapi2 as sqlite > con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) > cur = con.cursor() > cur.execute("select *

Re: An isalpha() that accepts underscores as well

2006-03-01 Thread egbert
In the discussion about isalpha()_mutants that accept underscores as well, we did not talk about regular expressions. Afterwards I did some timings. My first observation was that the whole experiment is rather futile, because it takes only about a second to do a million tests. If you take the tro

Re: pysqlite problem

2006-03-01 Thread Ganesan Rajagopal
> bapolis <[EMAIL PROTECTED]> writes: > con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES) ^^ Did you really intend this? Since you're opening a database in memory, you will have access to tbl1 only if you create the table after the con

Re: pysqlite problem

2006-03-01 Thread bapolis
I tried using the path "c:\ex1.db" and it worked. I was using "ex1.db" before. Thanks everyone for the help. This is a great community and maybe next time I will ask a harder question :) -- http://mail.python.org/mailman/listinfo/python-list

Re: error: argument after ** must be a dictionary

2006-03-01 Thread Kent Johnson
bruno at modulix wrote: > abcd wrote: > >>def makeThread(self, func, args=(), kwargs={}): >>threading.Thread(target=self.blah, args=args, >>kwargs=kwargs).start() > > Shouldn't it be: > > def makeThread(self, func, *args, **kwargs): > threading.Thread(target=self.blah, >

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Roy Smith
In article <[EMAIL PROTECTED]>, greg <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > > Do you anticipate having parameters like socket.AF_INET that are > > currently integers, become enumeration members in future releases? > > Since these are derived from values defined > as integers in C, i

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-01 Thread Magnus Lycka
Jonathan Gardner wrote: > On database portability... > > While it is noble to try to have a generic interface to these > libraries, the end result is that the databases are always different > enough that the interface just has to work differently. Considering the use case in question... "What I

Re: Problem solved: Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-03-01 Thread Magnus Lycka
Paul Probert wrote: > Thanks everyone for your help. > It was the "Abouttime.exe" program, a time synch utility. To get the > problem, you have to run it as a service, and possibly it has to have > trouble connecting to its time servers. It would cause time.sleep(1) to > sometimes block for 20

Re: Python Indentation Problems

2006-03-01 Thread Petr Jakes
Eric3 works great with spaces, tabs and even when imported code indentation is "mixed". I have got problems trying to import "mixed) code from other people. Settings > Preferences > Editor > General Tab width 8 Indentation width 4 (reasons why 8 and 4 are mentioned in previous postings in this thr

Re: Is Python a Zen language?

2006-03-01 Thread Robert Boyd
On 25 Feb 2006 15:00:37 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> writes: > > I have at times the impression that many people who talk about Zen > > philosophy confuse it with some home brewn mixture of platonism with > > its transgressive move t

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Tim Chase
>> Do you anticipate having parameters like socket.AF_INET >> that are currently integers, become enumeration members >> in future releases? > > Since these are derived from values defined as integers > in C, it's probably better to leave them that way. There > may be code that relies on them bein

Re: how to write file with cp1250 encodings?

2006-03-01 Thread Magnus Lycka
Grzegorz Smith wrote: > Hi all. I have got situation: i load data from database(MSSQL) wchich are > encoded cp1250 Are you sure that you are getting cp1250 from the database? How do you communicate with the database? With the database APIs I used in Windows, I always got Unicode objects from data

Re: PIL and PSDraw

2006-03-01 Thread Kjell Magne Fauske
PIL is, as far as i know,primarily a tool for creating and manipulating raster graphics. If you want to create eps vector graphics with Python I recommend PyX: http://pyx.sourceforge.net/ Take a look at the examples to see some of the possibilities: http://pyx.sourceforge.net/examples/index.html I

Re: looking for help about python-sane

2006-03-01 Thread JW
Every time, or just this run? -- http://mail.python.org/mailman/listinfo/python-list

Writing an applilcation that can easily adapt to any language

2006-03-01 Thread Chance Ginger
I am rather new at Python so I want to get it right. What I am doing is writing a rather large application with plenty of places that strings will be used. Most of the strings involve statements of one kind or another. I would like to make it easy for the support people to port the application f

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Roy Smith
Tim Chase <[EMAIL PROTECTED]> wrote: >>> Do you anticipate having parameters like socket.AF_INET >>> that are currently integers, become enumeration members >>> in future releases? >> >> Since these are derived from values defined as integers >> in C, it's probably better to leave them that way.

Re: Use empty string for self

2006-03-01 Thread John Salerno
James Stroud wrote: > py> def doittoit(it): > ... print it.whatzit > ... > py> class It: > ... whatzit = 42 > ... def doittoit(self): > ... print self.whatzit > ... > py> anit = It() > py> doittoit(anit) > 42 > py> It.doittoit(anit) > 42 > py> anit.doittoit() > 42 > > > If you get this

Re: Writing an applilcation that can easily adapt to any language

2006-03-01 Thread bruno at modulix
Chance Ginger wrote: > I am rather new at Python so I want to get it right. What I am doing > is writing a rather large application with plenty of places that > strings will be used. Most of the strings involve statements of > one kind or another. > I would like to make it easy for the support p

Re: PyGUI 1.6: A Note for MacOSX Users

2006-03-01 Thread Alex Martelli
greg <[EMAIL PROTECTED]> wrote: > A small problem has come to light with PyGUI 1.6 > on MacOSX systems. > > If you get the following exception: > > File "GUI/Generic/BaseAlertFunctions.py", line 5, in ? > ImportError: No module named Alerts > > it's probably because you don't have PyObj

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread ookoi
You should look at this blog entry: http://www.voidspace.org.uk/python/weblog/arch_d7_2006_02_11.shtml#e222 But if you have the original .py it's quite insane to want to hack the .pyc only for porting it under others architectures. Instead, use setuptools. -- sebastien - http://seb.dbzteam.com

Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Hello all I would like to do the following: from elementtree.SimpleXMLWriter import XMLWriter class HtmlWriter(XMLWriter, object): def write_raw(self, text): super( HtmlWriter, self ).flush() super( HtmlWriter, self ).__write(text) but because of the name-mangling

Re: Make staticmethod objects callable?

2006-03-01 Thread Steven Bethard
Steven D'Aprano wrote: > So, based on this evidence, staticmethod() inside a class definition > converts instance methods to functions. Outside a class definition, > staticmethod() does one of two things: it either converts an instance > method to a static method, or if the output is assigned to

is Queue.Queue() serializable with cPickle?

2006-03-01 Thread john peter
i have the following custom extenstion of Queue.Queue() to save and load queue contents but I think there's a problem with it. Does anybody know qhether Queue.Queue() is pickle-able? if so, can I get sample code? If not, can anybody recommend a pickle-able Queue from another library that I migh

Re: unicode question

2006-03-01 Thread Walter Dörwald
Edward Loper wrote: > Walter Dörwald wrote: >> Edward Loper wrote: >> >>> [...] >>> Surely there's a better way than converting back and forth 3 times? Is >>> there a reason that the 'backslashreplace' error mode can't be used >>> with codecs.decode? >>> >>> >>> 'abc \xff\xe8 def'.decode('ascii

Re: Printing a file

2006-03-01 Thread Fabian Steiner
Hi! Thank you so far, but now I got stuck again :-/ Jeremy Sanders wrote: > QPrinter is easy to use. You just draw to the page the same way as you talk > to the screen with a QPainter. > > prnt = qt.QPrinter() > # you can also vary options like colour, doc name, dpi here > > # display dialog b

Re: Use empty string for self

2006-03-01 Thread Roy Smith
John Salerno <[EMAIL PROTECTED]> wrote: >I do get it. I think I will just have to get used to seeing the 'self' >argument but understanding that it's not really something that is always >passed in. I'm trying to train myself to see > >def doittoit(self) as def doittoit() That's OK as far as usi

Re: Numerical solver

2006-03-01 Thread Laszlo Zsolt Nagy
Robert Kern wrote: >In [7]: scipy.optimize.fmin_cobyla? > >Type: function >Base Class: >String Form: >Namespace: Interactive >File: >/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy- >0.4.7.1607-py2.4-macosx-10.4-ppc.egg/scipy/optimize/cob

Searching for uniqness in a list of data

2006-03-01 Thread rh0dium
Hi all, I am having a bit of difficulty in figuring out an efficient way to split up my data and identify the unique pieces of it. list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log'] Now I want to split each item up on the "_" and compare it with all others on the list, if there is a difference

why? [win32com/WMI]

2006-03-01 Thread Sergey
import win32com.client loc = win32com.client.Dispatch("WbemScripting.SWbemLocator") svc = loc.ConnectServer("srv", "root/cimv2", "[EMAIL PROTECTED]", "**") sys = svc.get("Win32_Process") sys.create("notepad.exe") => Traceback (most recent call last): File "remote.py", line 6, in ? sys.create

Re: Searching for uniqness in a list of data

2006-03-01 Thread Claudio Grondi
rh0dium wrote: > Hi all, > > I am having a bit of difficulty in figuring out an efficient way to > split up my data and identify the unique pieces of it. > > list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log'] > > Now I want to split each item up on the "_" and compare it with all > others on t

Re: Default Section Values in ConfigParser

2006-03-01 Thread mwt
Thanks, Terry. That's an interesting way to go about it. -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL and PSDraw

2006-03-01 Thread Sybren Stuvel
Kjell Magne Fauske enlightened us with: > PIL is, as far as i know,primarily a tool for creating and > manipulating raster graphics. I was afraid of that. > If you want to create eps vector graphics with Python I recommend > PyX: That looks exactly what I was looking for. Thanks a lot! Sybren -

Re: Thread Question

2006-03-01 Thread Aahz
In article <[EMAIL PROTECTED]>, Kent Johnson <[EMAIL PROTECTED]> wrote: >D wrote: >> >> My question is, how would I go >> about creating the thread? I have seen examples that used classes, and >> other examples that just called one thread start command - when should >> you use one over another? >

Re: Use empty string for self

2006-03-01 Thread Grant Edwards
On 2006-03-01, John Salerno <[EMAIL PROTECTED]> wrote: > I do get it. I think I will just have to get used to seeing > the 'self' argument but understanding that it's not really > something that is always passed in. But it _is_ always passed to the function. You can even pass it explicity when y

Re: why? [win32com/WMI]

2006-03-01 Thread Claudio Grondi
Sergey wrote: > import win32com.client > > loc = win32com.client.Dispatch("WbemScripting.SWbemLocator") > svc = loc.ConnectServer("srv", "root/cimv2", "[EMAIL PROTECTED]", "**") > sys = svc.get("Win32_Process") > sys.create("notepad.exe") > > => > > Traceback (most recent call last): > File

Re: Numerical solver

2006-03-01 Thread Robert Kern
Laszlo Zsolt Nagy wrote: > Robert Kern wrote: > >>In [7]: scipy.optimize.fmin_cobyla? >> >>Type: function >>Base Class: >>String Form: >>Namespace: Interactive >>File: >>/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy- >>0.4.7.1607-py2.4-

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Steve Juranich
Gerard Flanagan wrote: > I would like to do the following: > > from elementtree.SimpleXMLWriter import XMLWriter > > class HtmlWriter(XMLWriter, object): > def write_raw(self, text): > super( HtmlWriter, self ).flush() > super( HtmlWriter, self ).__write(text) > >

Re: Use empty string for self

2006-03-01 Thread John Salerno
Grant Edwards wrote: > But it _is_ always passed to the function. You can even pass > it explicity when you call the method if you want: I meant it isn't always explicitly passed. > > #!/usr/bin/python > > class MyClass: > def mymethod(self,p1,p2): > print self,p1,p2 >

RE: why? [win32com/WMI]

2006-03-01 Thread Tim Golden
[Sergey] | import win32com.client | | loc = win32com.client.Dispatch("WbemScripting.SWbemLocator") | svc = loc.ConnectServer("srv", "root/cimv2", "[EMAIL PROTECTED]", "**") | sys = svc.get("Win32_Process") | sys.create("notepad.exe") | | => | | Traceback (most recent call last): | File "rem

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread [EMAIL PROTECTED]
>>Is there any simple way round this situation in general? It might be safer to use composition instead of inheritance in this case. Assuming that XMLWriter has a write method to write what you want, you could hold a reference to an XMLWriter within your class and pass along write command like: w

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
"rh0dium" <[EMAIL PROTECTED]> writes: > Hi all, > > I am having a bit of difficulty in figuring out an efficient way to > split up my data and identify the unique pieces of it. > > list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log'] > > Now I want to split each item up on the "_" and compare i

Re: telnetlib problems

2006-03-01 Thread vercingetorix52
Thanks for the reply. I've replaced the call to read_very_eager() with read_until() and enabled debugging messages. My script now looks like this... # import telnetlib tn = telnetlib.Telnet('192.168.100.11') tn.set_debuglevel(9) tn.read_until('login: ', 5) tn.write

Re: Thread Question

2006-03-01 Thread Just
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Kent Johnson <[EMAIL PROTECTED]> wrote: > >D wrote: > >> > >> My question is, how would I go > >> about creating the thread? I have seen examples that used classes, and > >> other examples that j

Re: Searching for uniqness in a list of data

2006-03-01 Thread johnzenger
You can come quite close to what you want without splitting the string at all. It sounds like you are asking the user to build up a string, and you want to keep checking through your list to find any items that begin with the string built up by the user. Try something like this: mylist = ['1p2m_

Re: Printing a file

2006-03-01 Thread David Boddie
Fabian Steiner wrote: > This is what I have so far: > > app = QApplication(sys.argv) > printer = QPrinter(QPrinter.PrinterResolution) > if printer.setup(): > printer.setPageSize(printer.A4) > painter = QPainter(printer) > metrics = QPaintDeviceMetrics(painter.device()) > margin

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread venkatbo
Terry Reedy wrote: > ... > I am under the impression that .pyc files are system independent. > Have you tried simply copying them over? > > tjr Hi Terry, It appears that python on the target ppc system is expecting to see ppc-related info in the .pyc files. These .pyc were generated at cross com

Re: Make staticmethod objects callable?

2006-03-01 Thread Nicolas Fleury
Steven Bethard wrote: > ... > Yes, you have to explain descriptors, but at the point that you start > trying to do funny things with staticmethods and classmethods, I think > you need to start learning about them anyway.) That's all good points, but IMHO, descriptors are a much more advanced Py

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread Just
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Terry Reedy wrote: > > ... > > I am under the impression that .pyc files are system independent. > > Have you tried simply copying them over? > > > > tjr > > Hi Terry, > > It appears that python on the target ppc system is expecting to

Trouble with numpy-0.9.4 and numpy-0.9.5

2006-03-01 Thread drife
Hello, I use the Python Numeric package extensively, and had been an avid user of the "old" scipy. In my view, both pieces of software are truly first rate, and have greatly improved my productivity in the area of scientific analysis. Thus, I was excited to make the transition to the new scipy cor

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread venkatbo
Hi Sebastian, Thanks for that link and your notes. I was under the impression, that the .pyc files will be used (if found) by python to speed up execution of scripts... and so we packaged, deployed and installed the .py/.pyc files on to the ppc-target system. That package includes, site.py(c), ty

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
Steve Juranich wrote: > Gerard Flanagan wrote: > > > I would like to do the following: > > > > from elementtree.SimpleXMLWriter import XMLWriter > > > > class HtmlWriter(XMLWriter, object): > > def write_raw(self, text): > > super( HtmlWriter, self ).flush() > > super

Re: Trouble with numpy-0.9.4 and numpy-0.9.5

2006-03-01 Thread Travis E. Oliphant
drife wrote: > Hello, > > I use the Python Numeric package extensively, and had been an > avid user of the "old" scipy. In my view, both pieces of software > are truly first rate, and have greatly improved my productivity in > the area of scientific analysis. Thus, I was excited to make the > tran

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > >>Is there any simple way round this situation in general? > > It might be safer to use composition instead of inheritance in this > case. Assuming that XMLWriter has a write method to write what you > want, you could hold a reference to an XMLWriter within your class and

Re: Searching for uniqness in a list of data

2006-03-01 Thread Alexander Schmolck
Alexander Schmolck <[EMAIL PROTECTED]> writes: > The easiest way to do this is to have a nested dictionary of prefixes: for > each prefix as key add a nested dictionary of the rest of the split as value > or an empty dict if the split is empty. Accessing the dict with an userinput > will give you

Re: PEP 354: Enumerations in Python

2006-03-01 Thread Raymond Hettinger
[Ben Finney] > It is possible to simply define a sequence of values of some other > basic type, such as ``int`` or ``str``, to represent discrete > arbitrary values. However, an enumeration ensures that such values > are distinct from any others, and that operations without meaning > ("Wednesday t

Re: Use empty string for self

2006-03-01 Thread Douglas Alan
Roy Smith <[EMAIL PROTECTED]> writes: > Terry Hancock <[EMAIL PROTECTED]> wrote: >> However, there is a slightly less onerous method which >> is perfectly legit in present Python -- just use "s" >> for "self": > This is being different for the sake of being different. Everybody *knows* > what

Path completion in 'raw-input'?

2006-03-01 Thread Johannes Graumann
When interactively asking for a path on the cmdl, I'd like to go beyond just 'raw_input' and provide shell like path completion. My research has made me believe that a combination of the cmd and glob modules is what I need, but I find the doc HIGHLY unintuitive and wasn't able to come by any exampl

Re: why? [win32com/WMI]

2006-03-01 Thread rtilley
Tim Golden wrote: > [Sergey] > > | import win32com.client > | > | loc = win32com.client.Dispatch("WbemScripting.SWbemLocator") > | svc = loc.ConnectServer("srv", "root/cimv2", "[EMAIL PROTECTED]", "**") > | sys = svc.get("Win32_Process") > | sys.create("notepad.exe") > | > | => > | > | Trac

Re: looking for help about python-sane

2006-03-01 Thread none
JW wrote: > Every time, or just this run? > every time -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing 'mangled' class attrbutes

2006-03-01 Thread Steve Juranich
Gerard Flanagan wrote: > I tried that Steve but it didn't work, and i don't think I can do what > I want in any case. There is no method '__write' in the base class, it > is only declared as an instance attribute in the constructor, like so: > > def __init__(self, file, encoding="us-ascii"):

Re: Searching for uniqness in a list of data

2006-03-01 Thread Paul McGuire
"rh0dium" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > I am having a bit of difficulty in figuring out an efficient way to > split up my data and identify the unique pieces of it. > > list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log'] > > Now I want to split each item

asynchat network send problems

2006-03-01 Thread Andreas R.
Hello, I'm using Python's asynchat module for network support in a Python-based game, and I run into two problems, both of which occur at random times. Most of the time, the network sending and receiving is perfect, but about 1 out of 10 times, it fails with one of these errors: -- Problem 1. Wh

Re: Use empty string for self

2006-03-01 Thread Duncan Booth
John Salerno wrote: >> The two calls are equivalent. > > can you also say instance.mymethod(instance, 1, 2) ? Only if mymethod is defined to take all 4 arguments you just passed to it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Default Section Values in ConfigParser

2006-03-01 Thread Fuzzyman
mwt wrote: > I want to set default values for a ConfigParser. So far, its job is > very small, so there is only one section heading, ['Main']. Reading the > docs, I see that in order to set default values in a ConfigParser, you > initialize it with a dictionary or defaults. However, I'm not quite

ihooks and Python eggs

2006-03-01 Thread Christoph Zwerschke
Is it a known problem that ihooks is incompatible with Python eggs? When I do the following: import ihooks ihooks.install(ihooks.ModuleImporter()) then I cannot import any Python egg afterwards. Can there be anything done about this? -- Christoph -- http://mail.python.org/mailman/listinfo/pyt

Re: Use empty string for self

2006-03-01 Thread John Salerno
Duncan Booth wrote: > John Salerno wrote: > >>> The two calls are equivalent. >> can you also say instance.mymethod(instance, 1, 2) ? > > Only if mymethod is defined to take all 4 arguments you just passed to it. Got it. I understand how it works now. -- http://mail.python.org/mailman/listin

Re: error: argument after ** must be a dictionary

2006-03-01 Thread abcd
Not sure if it matters, but this occurs when running a unittest. The trace back is: Traceback (most recent call last): File "C:\Python24\Lib\threading.py", line 442, in __bootstrap self.run() File "C:\Python24\Lib\threading.py", line 422, in run self.__target(*self.__args, **self.__kwa

Suggestions for documentation generation?

2006-03-01 Thread kpd
Hello, I have written a C++ library that I've then wrapped with Pyrex. Any suggestions to the best-in-class tool to create documentation for the libraries? I would love to document things in one spot (could be the code) and generate html and PDF from there. Doxygen (www.doxygen.org) looks to be

Re: Thread Question

2006-03-01 Thread Jarek Zgoda
Just napisał(a): > I always felt that subclassing Thread is very unpythonic. It seems like > an unfortunate leftover Javaism (much of threading.py was inspired by > Java, but I don't need to tell you that). If I need some state, I create > my own class, with a reference to the Thread object if

Re: error: argument after ** must be a dictionary

2006-03-01 Thread abcd
i was missing "self" in my method signature! doh! -- http://mail.python.org/mailman/listinfo/python-list

Re: type = "instance" instead of "dict"

2006-03-01 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Cruella DeVille wrote: > >> This is off topic, but if read the documentation is the answere to >> everything why do we need news groups? > > Because "read the documentation" is NOT the answer to > everything. However,

Is it better to use class variables or pass parameters?

2006-03-01 Thread Derek Basch
This one has always bugged me. Is it better to just slap a "self" in front of any variable that will be used by more than one class method or should I pass around variable between the methods? FlamewarNOW! jk, I really do want other opinions. Thanks, Derek -- http://mail.python.org/mai

Re: Is it better to use class variables or pass parameters?

2006-03-01 Thread Mc Osten
On 1 Mar 2006 11:32:02 -0800, Derek Basch wrote: > This one has always bugged me. Is it better to just slap a "self" in > front of any variable that will be used by more than one class method > or should I pass around variable between the methods? I think there is no clear "general" answer. A cri

Re: Path completion in 'raw-input'?

2006-03-01 Thread Mc Osten
On Wed, 01 Mar 2006 10:00:43 -0800, Johannes Graumann wrote: > There's also the rlcompleter module, but in the interest of better platform > agnosis I'd like to stick with cmd ... I would have suggested readline.. This works on Windows: Th

Re: Cross compile generation of .pyc from .py files...

2006-03-01 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ppc system. The "...has bad magic..." appears to indicate that The format of .pyc files, which are generated for greater speed of repeat runs, is considered an internal implementation detail subject to change. The exact details are

newbie question

2006-03-01 Thread orangeDinosaur
Hi, I'm brand new to using/playing with Python, and I have what is likely a very simple question but can't seem to figure it out. I wrote up a script in my preferred text editor. It contains maybe ten lines of code. I want to be able to execute those code lines with a single command either from

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-01 Thread dananrg
Thanks Gerhard and Magnus. Magnus, thanks for the references. I will follow up on those. I was messing around with the native ODBC module you mentioned (I am using Python in a Win32 environment), e.g: import dbi, odbc ...and it seems to meet my needs. The only issue I've had so far is retrieving

  1   2   >