Enum class

2015-10-15 Thread Joseph L. Casale
Is it possible to override __contains__ from the meta class in the derived class with the Enum type? Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

Re: Enum class

2015-10-15 Thread Joseph L. Casale
import enum class M(enum.EnumMeta): >... def __contains__(self, value): >... print("checking", value) >... return super().__contains__(value) >... class Colors(enum.Enum, metaclass=M): >... red = 1 >... green = 2 >... blue = 3 >... Colors.red in C

RE: Enum class

2015-10-15 Thread Joseph L. Casale
> Like that? > > >>> class M2(enum.EnumMeta): >... def __contains__(self, value): >... print(value, "? never", sep="") >... return False >... > >>> Colors.__class__ > > >>> Colors.red in Colors > checking Colors.red > True > >>> Colors.__class__ = M2 > >>> Colors.red in Colors

Using pyVmomi

2014-07-23 Thread Joseph L. Casale
I am doing some scripting with pyVmomi under 2.6.8 so the code may run directly on a vmware esxi server. As the code is long running, it surpasses the authentication timeout. For anyone familiar with this code and/or this style of programming, does anyone have a recommendation for an elegant authe

RE: Using pyVmomi

2014-07-24 Thread Joseph L. Casale
> You could: > >- have a single point of entry that can check and, if necessary, revalidate > >- create a helper that checks and, if necessary, revalidate, which is then > called where ever needed > >- create a decorator that does the above for each function that needs it Hi Et

RE: GIL detector

2014-08-17 Thread Joseph L. Casale
> I don't have to care about threading issues all the time and > can otherwise freely choose the right model of parallelism that suits my > current use case when the need arises (and threads are rarely the right > model). I'm sure that's not just me. The sound bite of a loyal Python coder:) If it

Processing xml for output with cElementTree

2014-10-17 Thread Joseph L. Casale
I am unfortunately unable to use lxml for a project and must resort to base only libraries to create several nested elements located directly under a root element. The caveat is the incremental writing and flushing of the nested elements as they are created. So assuming the structure is texttext

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Randal L. Schwartz
>>>>> "Xah" == Xah Lee writes: Xah> curious question. Xah> suppose you have 300 different strings and they need all be replaced Xah> to say "aaa". And then suppose this isn't the *real* question, but one entirely of Fiction by Xah Lee. How h

Logging within a class

2013-02-10 Thread Joseph L. Casale
Within __init__ I setup a log with self.log = logging.getLogger('foo') then add a console and filehandler which requires the formatting to be specified. There a few methods I setup a local log object by calling getChild against the global log object. This works fine until I need to adjust the 

A better way to accomplish loop

2013-02-12 Thread Joseph L. Casale
I have an issue with some code I have been passed: for (x, y) in [(a_dict1, a_tuple[0]), (a_dict2, a_tuple[1])]: I only noticed it as PyCharm failed to assign the str type to y, whereas it knew the tuples 0 and 1 item were type str. In the loop it flags the passing of y into a method that expe

RE: A better way to accomplish loop

2013-02-12 Thread Joseph L. Casale
> I think you're saying that the lint-feature of PyCharm is trying to  > guess the object types, and telling you there's a conflict here.  I > don't think you're saying that it executes incorrectly. Hah, yeah sorry Dave that's it. > Still there are ways to express it differently, and maybe one

Switch statement

2013-03-10 Thread Joseph L. Casale
I have a switch statement composed using a dict: switch = {     'a': func_a,     'b': func_b,     'c': func_c } switch.get(var, default)() As a result of multiple functions per choice, it migrated to: switch = {     'a': (func_a1, func_a2),     'b': (func_b1, func_b2),     'c': (func_c, ) }

RE: Switch statement

2013-03-10 Thread Joseph L. Casale
> switch = {  > 'A': functools.partial(spam, a), > 'B': lambda b, c=c: ham(b, c), > 'C': eggs, > } >  > switch[letter](b) That's cool, never even thought to use lambdas. > functools.partial isn't always applicable, but when it is, you should > prefer it over lambda since it will

RE: Switch statement

2013-03-10 Thread Joseph L. Casale
> Or could you do something like: > > arguments_to_pass = [list of some sort] > switch.get(var, default)(*arguments_to_pass) Stevens lambda suggestion was most appropriate. Within the switch, there are functions called with none, or some variation of arguments. It was not easy to pass them in afte

Decorator help

2013-03-27 Thread Joseph L. Casale
I have a class which sets up some class vars, then several methods that are passed in data and do work referencing the class vars. I want to decorate these methods, the decorator needs access to the class vars, so I thought about making the decorator its own class and allowing it to accept args

RE: Decorator help

2013-03-27 Thread Joseph L. Casale
> So decorators will never take instance variables as arguments (nor should >they, since no instance > can possibly exist when they execute). Right, I never thought of it that way, my only use of them has been trivial, in non class scenarios so far. > Bear in mind, a decorator should take a

RE: Decorator help

2013-03-30 Thread Joseph L. Casale
> When you say "class vars", do you mean variables which hold classes? You guessed correctly, and thanks for pointing out the ambiguity in my references. > The one doesn't follow from the other. Writing decorators as classes is  > fairly unusual. Normally, they will be regular functions. I

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Larry Bates wrote: Looking over the code, it seems very inefficient and hard to understand. You really should check out the following. http://sourceforge.net/projects/crcmod/ It will allow you to generate efficient CRC functions for use in Python and in C or C++. The only thing you need to in

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread Raymond L. Buvel
[EMAIL PROTECTED] wrote: > I am writing a C extension with python 2.3.5 and need constructs > similar to python >func(*args, **kwds) > What's a neat way to do that? > I found pyrex has a __Pyx_GetStarArgs - > is there something I'm missing from the regular C/API maybe using one > of the PyArg_P

Re: recursive function return value problems

2005-12-28 Thread Brian L. Troutwine
[EMAIL PROTECTED] wrote: def reTest(bool): > > ... result = [] > ... if not bool: > ... reTest(True) > ... else: > ... print "YAHHH" > ... result = ["should be the only thing returned"] > ... print "printing result: " > ... print result > ... return re

[ANN] clnum-1.3 Class Library For Numbers Python Binding

2006-08-19 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

[ANN] ratfun-2.3 Polynomials and Rational Functions

2006-08-19 Thread Raymond L. Buvel
The ratfun module provides classes for defining polynomial and rational function (ratio of two polynomials) objects. These objects can be used in arithmetic expressions and evaluated at a particular point. Home page: http://calcrpnpy.sourceforge.net/ratfun.html Note: If you are using rpncalc-1.2

[ANN] rpncalc-2.4 RPN Calculator for Python

2006-08-19 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Chang

Re: ratfun-2.3 Polynomials and Rational Functions

2006-08-19 Thread Raymond L. Buvel
Bas wrote: > Are there any differences between this module and the one already > present in numpy? > > http://www.scipy.org/doc/numpy_api_docs/numpy.lib.polynomial.html > > Cheers, > Bas > Yes, there are quite a few. This module uses a multi-precision library (clnum) to make the calculations m

Re: building extensions for Windows Python

2006-10-13 Thread Michael L Torrie
d stuck it on my linux drive (in my case in /usr/i386-pc-mingw32/Python2.4. Then I just did: $ pyrex test.pyx $ i386-pc-mingw32-gcc -o test.dll test.c -I/usr/i386-pc- mingw32/include/python2.4 -mwindows -shared -lpython24 -L/usr/i386-pc- mingw32/Python2.4/lib Since there were no special windows l

Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-31 Thread Michael L Torrie
On Fri, 2006-10-27 at 14:53 -0700, [EMAIL PROTECTED] wrote: > Hi, > > I am new to python and am currently writing my first application. One > of the problems I quickly ran into, however, is that python's imports > are very different from php/C++ includes in the sense that they > completely wrap th

Re: PIL - Pixel Level Image Manipulation?

2006-11-08 Thread Michael L Torrie
On Wed, 2006-11-08 at 11:53 -0500, Gregory Piñero wrote: > I want to be able to randomly change pixels in an image and view the > results. I can use whatever format of image makes this easiest, e.g., > gray scale, bit tonal, etc. > > Ideally I'd like to keep the pixels in an intermediate format l

[ANN] clnum-1.2.1 Class Library For Numbers Python Binding

2006-06-11 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

Re: math.pow(x,y)

2006-06-11 Thread Raymond L. Buvel
Felipe Almeida Lessa wrote: > Em Dom, 2006-06-11 às 11:19 -0700, fl1p-fl0p escreveu: >> import math >> math.pow(34564323, 456356) >> >> will give math range error. >> >> how can i force python to process huge integers without math range >> error? Any modules i can use possibly? > > 34564323**45635

Re: math.pow(x,y)

2006-06-11 Thread Raymond L. Buvel
K.S.Sreeram wrote: > Raymond L. Buvel wrote: >> I just tried this and it is taking an extremely long time even on a fast >> machine with 4 Gb of RAM. Killed it after a couple of minutes. > > Thats odd. > 34564323**456356 completed on my laptop in 28 seconds. > [Pyt

Re: Help me use my Dual Core CPU!

2006-09-12 Thread Brian L. Troutwine
John Henry wrote: > I don't know what CPython is but I have developed a Python application > under Windows that utilize the Dure Core CPU when it's present. It's the default python implementation, the one you find at python.org. It happens to be written in C. Other python implementations included

Delete items in nested dictionary based on value.

2006-09-13 Thread Brian L. Troutwine
I've got a problem that I can't seem to get my head around and hoped somebody might help me out a bit: I've got a dictionary, A, that is arbitarily large and may contains ints, None and more dictionaries which themselves may contain ints, None and more dictionaries. Each of the sub-dictionaries is

Re: Delete items in nested dictionary based on value.

2006-09-14 Thread Brian L. Troutwine
ight in that if I did indeed need the original dictionary unchanged it would be much, much easier to modify the pretty-printer. Dennis Lee Bieber wrote: > On 13 Sep 2006 16:08:37 -0700, "Brian L. Troutwine" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: >

Re: Delete items in nested dictionary based on value.

2006-09-14 Thread Brian L. Troutwine
This is a general reply to all. Thanks for all the suggestions. I hadn't really thought about filtering empty dictionaries because the data I'm processing won't have them, but it does make for a much nicer, more general filter. I did end up using bearophileH's code, but that's mostly because he go

pprint: "...thank small children who sleep at night."

2006-09-19 Thread Brian L. Troutwine
The heading comment to pprint reads: # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # something. I wrote this when I was trying to read some heavily nested # tuples with fairly non-descriptive c

Re: ANN: Python Molecular Viewer - 1.4.3

2006-09-19 Thread Niels L Ellegaard
[EMAIL PROTECTED] wrote: > More information can be found on our web site at > http://mgltools.scripps.edu I had some trouble finding the license of the code on the webpage, but it looks like the software is free for non-commercial use. Could I convince you to make the license more visible? Please

[ANN] clnum-1.4 Class Library For Numbers Python Binding

2006-11-19 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

[ANN] ratfun-2.4 Polynomials and Rational Functions

2006-11-19 Thread Raymond L. Buvel
The ratfun module provides classes for defining polynomial and rational function (ratio of two polynomials) objects. These objects can be used in arithmetic expressions and evaluated at a particular point. Home page: http://calcrpnpy.sourceforge.net/ratfun.html Note: If you are using rpncalc-1.2

[ANN] rpncalc-2.5 RPN Calculator for Python

2006-11-19 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Chang

Re: About alternatives to Matlab

2006-11-27 Thread Niels L Ellegaard
Filip Wasilewski wrote: > As far as the speed comparison is concerned I totally agree that NumPy > can easily outperform Matlab in most cases. Of course one can use > compiled low-level extensions to speed up specific computations in > Matlab, but it's a lot easier and/or cheaper to find very good

Re: About alternatives to Matlab

2006-12-03 Thread Niels L Ellegaard
Jon Harrop wrote: > So I'm keen to learn what Python programmers would want/expect from F# and > OCaml. I think this discussion becoming is a little misguided. The real strength of scipy is the elegant notation rather than speed. Being raised with Matlab I find scipy nicely familiar, and its fast

Automatic debugging of copy by reference errors?

2006-12-08 Thread Niels L Ellegaard
Is there a module that allows me to find errors that occur due to copy by reference? I am looking for something like the following: >>> import mydebug >>> mydebug.checkcopybyreference = True >>> a=2 >>> b=[a] >>> a=4 Traceback (most recent call last): File "", line 1, in ? CopyByReferenceError:

Re: Automatic debugging of copy by reference errors?

2006-12-09 Thread Niels L Ellegaard
Gabriel Genellina wrote: > I think you got in trouble with something and you're trying to avoid it > again - but perhaps this is not the right way. Could you provide some > example? I have been using scipy for some time now, but in the beginning I made a few mistakes with copying by reference. The

Re: Automatic debugging of copy by reference errors?

2006-12-09 Thread Niels L Ellegaard
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Niels L > Ellegaard wrote: > > I have been using scipy for some time now, but in the beginning I made > > a few mistakes with copying by reference. > But "copying by reference" is the way Pyth

Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
the first, sequence of the letter 'a', and only if the length of the sequence is exactly 3. Does such a regular expression exist? If so, any ideas as to what it could be? -- Roger L. Cauvin [EMAIL PROTECTED] (omit the "nospam_" part) Cauvin, Inc. Product Management

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
quot;" The correct pattern should reject the string: 'xyz123aabbaaab' since the length of the first sequence of the letter 'a' is 2. Yours accepts it, right? -- Roger L. Cauvin [EMAIL PROTECTED] (omit the "nospam_" part) Cauvin, Inc. Product Management / Market Research http://www.cauvin-inc.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
which the first sequence of the letter 'a' that is followed by the letter 'b' has a length of exactly three. Hope that's clearer . . . . -- Roger L. Cauvin [EMAIL PROTECTED] (omit the "nospam_" part) Cauvin, Inc. Product Management / Market Research http://www.cauvin-inc.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Sybren Stuvel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin enlightened us with: >> I'm looking for a regular expression that matches the first, and >> only the first, sequence of the letter 'a', and only if the le

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
7;b' has a length of >> exactly three. > > Ah...a little more clear. > > r = re.compile("[^a]*a{3}b+(a+b*)*") > matches = [s for s in listOfStringsToTest if r.match(s)] Wow, I like it, but it allows some strings it shouldn't. For example: "xyz123aabba

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 14:09:54 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>Say I have some string that begins with an arbitrary

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
is ensures that no "a"s come before the first 3x"a" and nothing but "b" > and "a" follows it. Anchoring may be the key here, but this pattern rejects "xayz123aaabab" which it should accept, since the 'a' between the '

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin wrote: >> Sorry for the confusion. The correct pattern should reject all strings >> except those in which the first sequence of the letter 'a' that is >

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
files so that the code doesn't have to change to add or change patterns. Before throwing up my hands and re-architecting, I wanted to see if regexps would handle the job (they have in every case but one). -- Roger L. Cauvin [EMAIL PROTECTED] (omit the "nospam_" part) Cauvin, Inc. Product Management / Market Research http://www.cauvin-inc.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin wrote: > >> Good suggestion. Here are some "test cases": >> >> "xyz123aaabbab" accept >> "xyz123aabbaab" reject >> "

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 16:41:08 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>Good suggestion. Here are some "test cases&qu

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 16:26:57 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>"Christos Georgiou" <[EMAIL PROTECTED]

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 18:01:07 +0100, rumours say that "Fredrik Lundh" > <[EMAIL PROTECTED]> might have written: > >>Roger L. Cauvin wrote: >> >>> Good s

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>Thanks, but the second test case I listed con

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin wrote: > >> > $ python test.py >> > gotexpected >> > --- >> > accept accept >> > reject reject >> > accept ac

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Tim Chase" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The below seems to pass all the tests you threw at it (taking the modified > 2nd test into consideration) > > One other test that occurs to me would be > > "xyz123aaabbaaabab" > > where you have "aaab" in there twice. Good

Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread Brian L. Troutwine
Lately I've been tinkering around with Erlang and have begun to sorely want some of its features in Python, mostly the ease at which new processes can be forked off for computation. To that end I've coded up a class I call, boringly enough, Process. It takes a function, its args and keywords and

Re: Comments appreciated on Erlang inspired Process class.

2007-06-01 Thread Brian L. Troutwine
On Friday 01 June 2007 10:48:10 Paul Boddie wrote: > On 1 Jun, 19:34, "Brian L. Troutwine" <[EMAIL PROTECTED]> > > wrote: > > Lately I've been tinkering around with Erlang and have begun to sorely > > want some of its features in Python, mostly the e

missing modules help

2007-06-19 Thread Christopher L Judd
Dear list, I am attempting to build a python based project off SourceForge, iTorrent ( http://sourceforge.net/project/showfiles.php?group_id=163841&package_id=185388&release_id=415006). The project is built with py2exe, includes bittorrent 4.4 and appears to require a number of dependent modules.

Re: pydev help

2007-06-19 Thread Christopher L Judd
Its called mylyn now. You can get it from here: http://www.eclipse.org/mylyn/dl.php Best, Chris On 6/19/07, Danyelle Gragsone <[EMAIL PROTECTED]> wrote: My first post! Greetings all, I am trying to get pydev up and running in linux. I have it up and running in windows but for some strange

Discovery of unpickleables in class heirarchies.

2007-06-22 Thread Brian L. Troutwine
I've a need to pickle arbitrary class hierarchies, which, luckily, can be made to conform to the pickle protocol. At the moment, however, I'm having a rather hard time discovering which classes in a heirarchy cannot be pickles. For instance, say class A has class B in it's __dict__ and let class B

Re: Video: Professor of Physics Phd at Cal Tech says: 911 Inside Job

2007-04-26 Thread Dave L. Renfro
wa.edu/~cgrabbe/ Yikes! This is less than 2 miles from where I live. Plus, there's Alexander Abian who, before he died, was down the road a bit at Iowa State University. And then there were the physics department shootings here a few years ago (5 killed, 3 of whom were professors in the ph

Re: List Moderator

2007-05-21 Thread Michael L Torrie
On Mon, 2007-05-21 at 14:24 +, Grant Edwards wrote: > > To quantify things for curiosity's sake, I just scanned through > the last 1000 postings in c.l.p. There was exactly 1 spam > message and two replies to spam messages complaining about > them. I'm seeing 2 messages a day, lately, to c.l

Re: Python compared to other language

2007-05-21 Thread Michael L Torrie
On Mon, 2007-05-21 at 16:00 +0200, Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > > >> Python is a strongly typed but dynamic language ... > > > > In the "A few questions" thread, John Nagle's summary of Python begins > > "Python is a byte-code interpreted

Re: Python and GUI

2007-05-21 Thread Michael L Torrie
On Mon, 2007-05-21 at 18:23 +0200, Petr Muller wrote: > There's PyQt thingy, imho very good and easy to learn/use, but still > powerful. I've used it for a small gui-oriented project with almost no > problems and it worked like a charm. However, sometimes I had troubles > finding useful document

Re: Slightly OT: Why all the spam?

2007-05-22 Thread Michael L Torrie
On Tue, 2007-05-22 at 09:08 +0200, bryan rasmussen wrote: > Well two things I would suppose: > > 1. relative popularity and volume of the group leads spammers to put > more resources towards spamming the group. > > 2. I seem to remember that python-list is also a usenet group? > non-moderated, me

Re: Restart Linux System

2007-05-22 Thread Michael L Torrie
On Mon, 2007-05-21 at 09:25 +0100, Robert Rawlins - Think Blue wrote: > Hello Guys, > > > > I’m looking to restart a Linux system from my python application. > What’s the best way to achieve this, is there something in the OS > module? Probably not. You need to just spawn the "reboot" command

Re: Restart Linux System

2007-05-22 Thread Michael L Torrie
On Tue, 2007-05-22 at 09:34 -0700, Alexandre Gans wrote: > > You can use sudo on your user or the bit suid in your application... Just know that you cannot setuid any shebang executable, of which python scripts usually are. -- http://mail.python.org/mailman/listinfo/python-list

Re: code indentation

2007-07-26 Thread Michael L Torrie
[EMAIL PROTECTED] wrote: > > .so maybe if you can help me with this? If I understand you correctly, you're trying to make a "pretty-printer" in python, right? Something that will take arbitrary python source code, recognize the blocks and so forth, and then emit clean python code (text) with

Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-28 Thread Michael L Torrie
Stefan Scholl wrote: > Don't let the subject line fool you. I'm OK with cStringIO. The > thread is now about xml.sax's parseString(). Giving you the benefit of the doubt here, despite the fact that Stefan Behnel has state this over and over again and you just haven't listened. xml.sax's use of pa

Re: why psyco using more memery in liunx?

2007-08-17 Thread Michael L Torrie
kyo guan wrote: > Hi all: > > When you import psyco in python2.5, you can see the memery grow up near > 40MB in linux. but the same version python and > psyco, is only grow up 1MB under windows. I have a hunch it's because of how the OS's are reporting shared memory usage. IE, the 1 MB i

Re: IDE for Python

2007-08-21 Thread Michael L Torrie
Ricardo Aráoz wrote: > Hi, > Do you know if for in-house development a GPL license applies? (Qt4 > and/or Eric4). If your programs are used in-house and never released, then you don't have to abide by the terms of the GPL. BUT (this is a big but) if you ever release your code or distribute

Re: list index()

2007-09-01 Thread Michael L Torrie
[EMAIL PROTECTED] wrote: > In my case of have done os.listdir() on two directories. I want to see > what files are in directory A that are not in directory B. > I have used exceptions in other languages and only do so on logic that > should never happen. In this case it is known that some of the fi

Re: list index()

2007-09-01 Thread Michael L Torrie
Alex Martelli wrote: > is the "one obvious way to do it" (the set(...) is just a simple and > powerful optimization -- checking membership in a set is roughly O(1), > while checking membership in a list of N items is O(N)...). Depending on a how a set is stored, I'd estimate any membership check

Re: Help in Placing Object in Memory

2007-03-27 Thread Michael L Torrie
On Tue, 2007-03-27 at 16:49 +0200, Diez B. Roggisch wrote: > > can two python script share a common object? > > What do you mean by that? They can both load a pickled object, yes. But they > can't share it as a at-runtime object, where changes in one script are > immediately are known to the o

You have been unsubscribed from the TECHWR-L mailing list

2007-09-17 Thread techwr-l-bounces
We're sorry to see that you're leaving TECHWR-L. If there is anything you believe TECHWR-L should have offered but didn't, or if there are any other suggestions you may have for the list, please feel free to write directly to us. TECHWR-L Administrators [EMAIL PROT

Re: Using fractions instead of floats

2007-10-03 Thread Raymond L. Buvel
Neil Cerutti wrote: >> Another guess could be that real numbers being closed under the >> four arithmetic operations, there is no danger to accidentally >> step into complex numbers. OTOH floats and rationals are two >> (conflicting) ways of extending integers. > > You would have to adopt a few s

Re: if then elif

2007-10-10 Thread Michael L Torrie
[EMAIL PROTECTED] wrote: > > that's the most incorrect thing i've heard all day! > > if cal or fat <= 0 is parsed as if (cal) or (fat <= 0) Which is exactly what he said. He also said that what the poster probably wanted was if cal <= 0 or fat <=0 > -- http://mail.python.org/mailman/listi

Re: if then elif

2007-10-11 Thread Michael L Torrie
Michael L Torrie wrote: > Which is exactly what he said. Haha. Nevermind. You're right. A subtle distinction, isn't it. >He also said that what the poster > probably wanted was > > if cal <= 0 or fat <=0 > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Cross-platform GUI development

2007-10-12 Thread Michael L Torrie
Alexandre Badez wrote: > Personnaly, I use PyQt simply because I prefere Qt to Gtk, witch is > much more integrated with all desktop than Gtk. > In fact, your application in Qt on Mac, Win or Linux look like a > native app. Qt doesn't look very native on my desktop. In fact, Qt apps have always l

Re: C++ version of the C Python API?

2007-10-21 Thread Michael L Torrie
Robert Dailey wrote: > On 10/21/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> No, I literally meant that the Python C API is object-oriented. >> You don't need an object-oriented language to write object-oriented >> code. > > I disagree with this statement. C is not an object oriented langua

Re: tuples within tuples

2007-10-26 Thread Michael L Torrie
[EMAIL PROTECTED] wrote: > On 26 Ott, 19:23, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > (A,B,C,D) >>> that could be >>> ('tagA', None, [('tagB', None, ['bobloblaw], None)], None) >> "C" isn't a tuple in your example either. It is a one-element list >> (the single element INSIDE the

Re: Pari Python

2007-10-28 Thread Michael L Torrie
Anton Mellit wrote: > And I think (correct me if I am wrong) that the ^ operator (xor) is > used very very infrequently. And it is not difficult to replace all ^ > with say ^^. The division is probably used more often, but python has > this trend anyway - to replace division with 'true' division, s

Re: A Python 3000 Question

2007-10-29 Thread Michael L Torrie
brad wrote: > Not complaining. len is simple and understandable and IMO fits nicely > with split(), strip(), etc... that's why I used it as an example, but > list(), etc. could be used as examples as well: > > a_string.list() instead of list(a_string) This is a great example of why list() needs

pgen2 use questions.

2007-01-09 Thread Brian L. Troutwine
I happened to stumble upon Guido's announcement of his python2 to python3 refactoring tool earlier today (http://mail.python.org/pipermail/python-3000/2006-December/005102.html), and, after playing with it a bit, I have some use questions as I don't quite understand how the pattern matching languag

distutils data file difficulties

2007-01-18 Thread Brian L. Troutwine
I am new to the use of distutils and am having difficulty getting distutils recognize and install data files. Here are the relevant parts of my source directory: ExampleTree/ |-- __init__.py |-- data | |-- Example1.txt | |-- Example2.txt | `-- __init__.py |-- subPackage1 | |-- (...) `-- su

Re: Excellent Interview with Dennis D'Souza, full of laughs

2007-01-29 Thread Michael L Torrie
On Mon, 2007-01-29 at 15:47 -0800, [EMAIL PROTECTED] wrote: > I know this is a useless gesture, but my normal tolerance for such behavior has reached an end. Please stop spamming this list with off-topic profanities. Your ramblings have nothing to do with programming in Python (this is a compute

Re: More than one interpreter per process?

2007-12-17 Thread Michael L Torrie
sturlamolden wrote: > Python has a GIL that impairs scalability on computers with more than > one processor. The problem seems to be that there is only one GIL per > process. Solutions to removing the GIL has always stranded on the need > for 'fine grained locking' on reference counts. I believe th

[ANN] crcmod-1.3 CRC Generator

2006-04-23 Thread Raymond L. Buvel
Crcmod is a Python package for creating functions computing the Cyclic Redundancy Check (CRC). Any generating polynomial producing 8, 16, 32, or 64 bit CRCs is allowed. Generated functions can be used in Python or C/C++ source code can be generated. Home page: http://crcmod.sourceforge.net/ Chang

Re: symbolic links, aliases, cls clear

2006-05-03 Thread Floyd L. Davidson
[EMAIL PROTECTED] wrote: >it would be nice if python provided a termcap or terminfo library, >wouldn't it? Try "import curses". -- Floyd L. Davidson<http://www.apaflo.com/floyd_davidson> Ukpeagvik (Barrow, Alaska) [EMAIL PROTECTED]

Re: CRC calculation

2006-05-05 Thread Raymond L. Buvel
[EMAIL PROTECTED] wrote: > Does anyone know where I can get python code to perform a CRC > calculation on an IP packet? > Check out http://crcmod.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

[ANN] clnum-1.2 Class Library For Numbers Python Binding

2006-05-06 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

Class Library for Numbers now available for Windows

2006-05-06 Thread Raymond L. Buvel
Due to the contribution of Frank Palazzolo, a Windows binary installer and build instructions are available for the clnum package. This also makes ratfun and rpncalc usable on the Windows platform. The clnum package adds rational numbers and arbitrary precision floating point numbers in real and c

Re: python rounding problem.

2006-05-07 Thread Raymond L. Buvel
Gary Wessle wrote: > Erik Max Francis <[EMAIL PROTECTED]> writes: > > >>chun ping wang wrote: >> >> >>>Hey i have a stupid question. >>>How do i get python to print the result in only three decimal >>>place... >>>Example>>> round (2.9954254, 3) >>>2.9951 >>>but i want to get r

Re: printing list

2006-05-07 Thread Raymond L. Buvel
compboy wrote: > How do you print elements of the list in one line? > > alist = [1, 2, 5, 10, 15] > > so it will be like this: > 1, 2, 5, 10, 15 > > because if I use this code > > for i in alist: > print i > > the result would be like this > > 1 > 2 > 5 > 10 > 15 > > Thanks. > There ar

Re: installing numpy

2006-05-09 Thread Raymond L. Buvel
Gary Wessle wrote: > Hi > > I am trying to install NumPy in my debian/testing linux > 2.6.15-1-686. > When installing from source on a Debian system, you want the installed package to wind up in /usr/local/lib/python2.x/site-packages (where x represents the version of Python you are running th

<    1   2   3   4   5   6   7   >