Re: Python syntax wart

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 15:02:58 +1200, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Bjoern Schliessmann wrote: > >> Lawrence D'Oliveiro wrote: >>> But then you can no longer use indentation to display the >>> two-dimensional structure of the statement. >> >> How can a statement be t

Re: How to insert in a string @ a index

2007-09-10 Thread Ant
On Sep 10, 3:15 am, "a.m." <[EMAIL PROTECTED]> wrote: > Thanks guys for you help. I ended up doing this way (for the > records)... > > t1 = "hello world hello. hello. \nwhy world hello" ... Another approach may be to use the re module's sub function: import re t1 = 'hello world hello. hello. \nw

Re: How to insert in a string @ a index

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 00:29:50 -0700, Ant wrote: > On Sep 10, 3:15 am, "a.m." <[EMAIL PROTECTED]> wrote: >> Thanks guys for you help. I ended up doing this way (for the >> records)... >> >> t1 = "hello world hello. hello. \nwhy world hello" > ... > > Another approach may be to use the re module's s

Re: concise code (beginner)

2007-09-10 Thread bambam
I have a number of news readers here, but all of them work better with top-posting, and in none of them is top posting a problem. What software are you using? Steve. "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In message <[EMAIL PROTECTED]>, bambam wrot

Re: python 2.5 problems

2007-09-10 Thread Ant
On Sep 9, 6:57 pm, "O.R.Senthil Kumaran" <[EMAIL PROTECTED]> wrote: > > Finally deleted 2.2 and loaded 2.5 (see below), using > > Dont delete. Uninstall python 2.2 and additional modules if you have > installed them. But since you've already deleted 2.2, download and reinstall 2.2, uninstall 2.2

Re: Python syntax wart

2007-09-10 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch wrote: > On Mon, 10 Sep 2007 15:02:58 +1200, Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Bjoern Schliessmann >> wrote: >> >>> Lawrence D'Oliveiro wrote: But then you can no longer use indentation to display the >>>

Re: concise code (beginner)

2007-09-10 Thread Francesco Guerrieri
On 9/10/07, bambam <[EMAIL PROTECTED]> wrote: > > I have a number of news readers here, but all of them work > better with top-posting, and in none of them is top posting > a problem. What software are you using? > > Steve. > I use gmail and I can assure you that top posting is annoying. france

Re: Does shuffle() produce uniform result ?

2007-09-10 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Sun, 09 Sep 2007 18:53:32 +1200, Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Paul Rubin wrote: >> >>> Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: >>> Except that the NSA's reputation has taken a dent since t

Re: concise code (beginner)

2007-09-10 Thread Lawrence D'Oliveiro
A: Skid-marks in front of the hedgehog. Q: What's the difference between a dead hedgehog on the road, and a dead top-poster on the road? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python syntax wart

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 19:54:49 +1200, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch > wrote: > >> On Mon, 10 Sep 2007 15:02:58 +1200, Lawrence D'Oliveiro wrote: >> >>> In message <[EMAIL PROTECTED]>, Bjoern Schliessmann >>> wrote: >>> Lawrence D'Olivei

Re: Python syntax wart

2007-09-10 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch wrote: > I see a tree structure here ... Good, you're improving. > ... but still no table. Who said anything about a table? > And this is also easily written that way in Python if you don't insist on > the line break after the ``if`` or

Re: concise code (beginner)

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 17:42:16 +1000, bambam wrote: > "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >> In message <[EMAIL PROTECTED]>, bambam wrote: >> >>> Thank you, >> >> Don't top-post. > > I have a number of news readers here, but all of them work > better

Re: concise code (beginner)

2007-09-10 Thread Paul Rudin
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Mon, 10 Sep 2007 17:42:16 +1000, bambam wrote: > >> "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in >> message news:[EMAIL PROTECTED] >>> In message <[EMAIL PROTECTED]>, bambam wrote: >>> Thank you, >>> >>> Don't top-post. >> >> I h

Re: Python syntax wart

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 20:19:08 +1200, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch > wrote: > >> I see a tree structure here ... > > Good, you're improving. Thanks. >> ... but still no table. > > Who said anything about a table? Me. If that statement i

Re: Python syntax wart

2007-09-10 Thread Stefan Behnel
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch > wrote: >> And this is also easily written that way in Python if you don't insist on >> the line break after the ``if`` or can live with backslashes. > > Which is precisely the point. This actually sounds somew

Re: Python syntax wart

2007-09-10 Thread Gabriel Genellina
On 9 sep, 08:14, Bjoern Schliessmann wrote: > How can a statement be two-dimensional? Like a two-dimensionalTuringMachine? Do you know the Befunge language? Program flow is not lineal but along a 2D grid. There are variants over toroids and more bizarre surfaces, even using 3D. "Befunge is beli

Re: Python syntax wart

2007-09-10 Thread Duncan Booth
Stefan Behnel <[EMAIL PROTECTED]> wrote: > This actually sounds somewhat pointless to me. If complex things don't > fit into one line, a good way to deal with it is not to insist on > making them a single statement. > Or make them into a single method/function call. I would post some pseudo- cod

Re: Setting stdout encoding

2007-09-10 Thread Gabriel Genellina
En Sun, 09 Sep 2007 17:49:14 -0300, Fabio Zadrozny <[EMAIL PROTECTED]> escribi?: Does someone know if there's a way to explicitly set the stdout/stderr/ stdin encoding that python should use? The encoding can be set using the C API for file objects - from Python code, use ctypes: py> from ctypes

Enum class with ToString functionality

2007-09-10 Thread bg_ie
Hi, I have the following class - class TestOutcomes: PASSED = 0 FAILED = 1 ABORTED = 2 plus the following code - testResult = TestOutcomes.PASSED testResultAsString if testResult == TestOutcomes.PASSED: testResultAsString = "Passed" elif testResult == TestOutcomes.FAILED :

Re: unexpected behavior: did i create a pointer?

2007-09-10 Thread neoedmund
On Sep 7, 4:07 pm, gu <[EMAIL PROTECTED]> wrote: > hi to all! > after two days debugging my code, i've come to the point that the > problem was caused by an unexpected behaviour of python. or by lack of > some information about the program, of course! i've stripped down the > code to reproduce the

Re: concise code (beginner)

2007-09-10 Thread Gabriel Genellina
"Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Why not just build a new list? E.g. newdevs = [] for dev in devs : ... if not removing_dev : newdevs.append(dev) #end if #end for devs = newdevs En Sun, 09 Sep 2007 22:58

less obvious "super"

2007-09-10 Thread Nagarajan
Hi group, I am confused with "super" usage..It seems to be complicated and less obvious. Here is what I need to achieve.. class A : def __init__( self ): self.x = 0 class B ( A ): def __init__( self, something ): # Use "super" construct here so that I can "inherit" x of A

Re: less obvious "super"

2007-09-10 Thread Francesco Guerrieri
On 9/10/07, Nagarajan <[EMAIL PROTECTED]> wrote: > > Hi group, > I am confused with "super" usage..It seems to be complicated and less > obvious. > Here is what I need to achieve.. > > class A : > def __init__( self ): > self.x = 0 > > class B ( A ): > def __init__( self, something

Re: Modul (%) in python not like in C?

2007-09-10 Thread Bryan Olson
Dennis Lee Bieber wrote: > The best answer is probably to be found from the definition of > divmod() The divmod() function is one of those little delights that reminds me why I love Python, but I do not think it answers the question here. The definition of divmod() references the '%' operati

Re: Python wrapper, problem with subprocess read/write

2007-09-10 Thread A.T.Hofkamp
On 2007-09-07, NeoGregorian <[EMAIL PROTECTED]> wrote: > I tried instead to use: > > lines = [] > line = proc.stdout.readline() > while line : > lines.append(line) > line = proc.stdout.readline() > > This prints out everything except the ">" line, which is good. But > then freezes while wai

Re: Python syntax wart

2007-09-10 Thread J. Cliff Dyer
J. Cliff Dyer wrote: Lawrence D'Oliveiro wrote: In message <[EMAIL PROTECTED]>, Bjoern Schliessmann wrote: What's wrong with this: for Link in GetEachRecord( Then you're no longer showing the syntax structure in two dimensions. If somebody handed me a program of more than twenty

Re: Modul (%) in python not like in C?

2007-09-10 Thread John Machin
On Sep 10, 9:16 am, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > On Sep 10, 8:05 am, Lee Harr <[EMAIL PROTECTED]> wrote: > Python will always yield a number x = m%n such that 0 <= x < n, but > Turbo C will always yield a number such that if x = m%n -x = -m%n. That >

Re: Using s.sort([cmp[, key[, reverse]]]) to sort a list of objects based on a attribute

2007-09-10 Thread Stefan Arentz
[EMAIL PROTECTED] (Alex Martelli) writes: > Stefan Arentz <[EMAIL PROTECTED]> wrote: > > > Miki <[EMAIL PROTECTED]> writes: > > > > > > steps.sort(key = lambda s: s.time) > > > This is why attrgetter in the operator module was invented. > > > from operator import attrgetter > > > ... > > > ste

Re: less obvious "super"

2007-09-10 Thread Duncan Booth
Nagarajan <[EMAIL PROTECTED]> wrote: > Here is what I need to achieve.. > > class A : > def __init__( self ): > self.x = 0 Don't use old style classes. If you are planning to use 'super' then you must use new-style classes, so use 'object' as a base class here. > > class B ( A ):

Pydev 1.3.9 Released

2007-09-10 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.9 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ---

Re: Enum class with ToString functionality

2007-09-10 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > But it would be much nicer if I had a function to covert to string as > part of the TestOutcomes class. How would I implement this? Perhaps: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486 -- http://mail.python.org/mailman/listinfo/python-list

Re: Enum class with ToString functionality

2007-09-10 Thread TheFlyingDutchman
On Sep 10, 2:28 am, [EMAIL PROTECTED] wrote: > Hi, > > I have the following class - > > class TestOutcomes: > PASSED = 0 > FAILED = 1 > ABORTED = 2 > > plus the following code - > > testResult = TestOutcomes.PASSED > > testResultAsString > if testResult == TestOutcomes.PASSED: > te

Re: Enum class with ToString functionality

2007-09-10 Thread aine_canby
On 10 Sep, 13:35, TheFlyingDutchman <[EMAIL PROTECTED]> wrote: > On Sep 10, 2:28 am, [EMAIL PROTECTED] wrote: > > > > > > > Hi, > > > I have the following class - > > > class TestOutcomes: > > PASSED = 0 > > FAILED = 1 > > ABORTED = 2 > > > plus the following code - > > > testResult = T

Re: Enum class with ToString functionality

2007-09-10 Thread David
On 9/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following class - > > class TestOutcomes: > PASSED = 0 > FAILED = 1 > ABORTED = 2 > > plus the following code - > > testResult = TestOutcomes.PASSED > > testResultAsString > if testResult == TestOutcomes.PASS

Re: less obvious "super"

2007-09-10 Thread Nagarajan
On Sep 10, 4:20 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Nagarajan <[EMAIL PROTECTED]> wrote: > > Here is what I need to achieve.. > > > class A : > > def __init__( self ): > > self.x = 0 > > Don't use old style classes. If you are planning to use 'super' then you > must use new-s

Re: less obvious "super"

2007-09-10 Thread Nagarajan
On Sep 10, 4:20 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Nagarajan <[EMAIL PROTECTED]> wrote: > > Here is what I need to achieve.. > > > class A : > > def __init__( self ): > > self.x = 0 > > Don't use old style classes. If you are planning to use 'super' then you > must use new-s

Re: Enum class with ToString functionality

2007-09-10 Thread TheFlyingDutchman
On Sep 10, 2:28 am, [EMAIL PROTECTED] wrote: > Hi, > > I have the following class - > > class TestOutcomes: > PASSED = 0 > FAILED = 1 > ABORTED = 2 > > plus the following code - > > testResult = TestOutcomes.PASSED > > testResultAsString > if testResult == TestOutcomes.PASSED: > te

Re: Enum class with ToString functionality

2007-09-10 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I have the following class - > > class TestOutcomes: > PASSED = 0 > FAILED = 1 > ABORTED = 2 > > plus the following code - > > testResult = TestOutcomes.PASSED > > testResultAsString > if testResult == TestOutcomes.PASSED: > testResultAsString = "Pas

Re: python 2.5 problems

2007-09-10 Thread Bjoern Schliessmann
Brian wrote: > Finally deleted 2.2 and loaded 2.5 (see below), using > the msi, on my XP partition. Having intermittent system > crashes. The probability that this is not a coincidence is IMHO very, very low. Looks like a deeper software or even hardware problem. Regards, Björn -- BOFH excu

Re: less obvious "super"

2007-09-10 Thread Bjoern Schliessmann
Nagarajan wrote: > class A : > def __init__( self ): > self.x = 0 > > class B ( A ): > def __init__( self, something ): > # Use "super" construct here so that I can "inherit" x of > # A > self.y = something > > How should I use "super" so that I could acc

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Bjoern >> What's wrong with this: >> >> for Link in GetEachRecord( > > Then you're no longer showing the syntax structure in two > dimensions. Why should I want to? :) BTW, this is the first time I read about "two dimensional syntax

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
Gabriel Genellina wrote: > Do you know the Befunge language? Program flow is not lineal but > along a 2D grid. There are variants over toroids and more bizarre > surfaces, even using 3D. Ah, I remember. Once read about it. Really cool idea :) Regards, Björn -- BOFH excuse #149: Dew on the te

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
TheFlyingDutchman wrote: > It may be that a language that doesn't have a statement terminator > (which can be end-of-line) needs a statement continuation symbol. Which language could that be? I can hardly imagine making a complex program out of one statement. Regards, Björn -- BOFH excuse #1

Re: Python syntax wart

2007-09-10 Thread Bjoern Schliessmann
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' >> I see a tree structure here ... > > Good, you're improving. Tree structures can't, IMHO, be called two-dimensional. Although, you can represent them with a two-dimensional graph. If the tree gets more complex this c

easy_install only stable packages

2007-09-10 Thread exhuma.twn
easy_install is great. But it always automatically installs the *latest* version. Even if that is beta,alpha (or however else the developers call it). Is there no switch or possibility to disable this feature? So that it installs the latest *stable* version? I know that you can specify a specific

Re: less obvious "super"

2007-09-10 Thread Francesco Guerrieri
On 9/10/07, Nagarajan <[EMAIL PROTECTED]> wrote: > > > > What's the difference b/w: > class A: > and > class A ( object ): > > Thanks. > The first one declares an old-style class. The second one declares a new style class. It's better to use the new-style (always derive from object). Se

Re: Python syntax wart

2007-09-10 Thread TheFlyingDutchman
On Sep 9, 11:20 pm, TheFlyingDutchman <[EMAIL PROTECTED]> wrote: > It may be that a language that doesn't have a statement terminator > (which can be end-of-line) needs a statement continuation symbol. > (Excluding languages like Lisp that have parentheses everywhere). Actually I guess Python does

encoding latin1 to utf-8

2007-09-10 Thread Harshad Modi
hello , I make one function for encoding latin1 to utf-8. but i think it is not work proper. plz guide me. it is not get proper result . such that i got "Belgi�" using this method, (Belgium) : import codecs import sys # Encoding / decoding functions def encode(filename): file = codecs.open(f

Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread cjt22
Hi there, I wonder if any of you could tell me the best way to going about solving this little problem! I have a list of Step objects containing their start and finish times The steps are sorted so that they are in order of their step times The start and finish times are in string format of "%H:%S

Re: Python syntax wart

2007-09-10 Thread TheFlyingDutchman
On Sep 10, 4:45 am, Bjoern Schliessmann wrote: > TheFlyingDutchman wrote: > > It may be that a language that doesn't have a statement terminator > > (which can be end-of-line) needs a statement continuation symbol. > > Which language could that be? I can hardly imagine making a complex > program o

Re: less obvious "super"

2007-09-10 Thread Bruno Desthuilliers
Nagarajan a écrit : (snip) > What's the difference b/w: > class A: > and > class A ( object ): > The first one creates a 'classic' (aka 'old-style') class, IOW a class using the legacy object-model of Python < 2.2. The second one creates a 'new-style' class using the new (well... sinc

Re: encoding latin1 to utf-8

2007-09-10 Thread J. Clifford Dyer
On Mon, Sep 10, 2007 at 12:25:46PM -, Harshad Modi wrote regarding encoding latin1 to utf-8: > Path: > news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsgate.cistron.nl!xs4all!news.glorb.com!postnews.google.com!22g2000hsm.googlegroups.com!not-for-mail > > hello , > I make o

Re: Setting stdout encoding

2007-09-10 Thread Fabio Zadrozny
> > > Does someone know if there's a way to explicitly set the stdout/stderr/ > stdin > encoding that python should use? > > The encoding can be set using the C API for file objects - from Python > code, use ctypes: > > Yeap, but that would leave me with the original problem: I need to run a script

Re: Checking if elements are empty

2007-09-10 Thread Neil Cerutti
On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Lawrence D'Oliveiro wrote: > if y[0]: Not a good idea. >>> Why not? >> >> Because there is a situation where your version of the test >> will fail even if the first element of y is non-null. > > Such as? Seriously people, a

Python-URL! - weekly Python news and links (Sep 10)

2007-09-10 Thread Gabriel Genellina
QOTW: "Python is a revelation to me as a language that grows with the ability of the programmer, which creates a multi-level community not too centered on one-upmanship to nurture new talent." - John K Masters "Python is a well designed language that focuses on a few simple ideas (name semantics,

Re: encoding latin1 to utf-8

2007-09-10 Thread Harshad Modi
thx for Reply , but I need some basic knowledge . how to encoding ? which algorithm use for that . bz my data has some special char , i have not confidence this function got proper result. i want to make my own function / script for encoding. -- http://mail.python.org/mailman/listinfo/python-l

Re: general function for sorting a matrix

2007-09-10 Thread Xah Lee
hi, just a quick reply. You are right, the python version i have is really terrible. I'll look at your solution and possibly reply later. Thanks for your code. It's great! Xah On Aug 29, 9:40 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 29 Aug 2007 08:47:27 -0700,XahLeewr

Re: /dev/null as a file-like object, or logging to nothing

2007-09-10 Thread Sion Arrowsmith
Torsten Bronger <[EMAIL PROTECTED]> wrote: >Marc 'BlackJack' Rintsch writes: >> `os.devnull`? >Yes, but I wasn't really sure how portable it is, in particular, on >Windows. Windows has a NUL: device which behaves like /dev/null . os.devnull is a wrapper around whatever the system-provided null de

XML: SAX and XInclude

2007-09-10 Thread Laurent Pointal
[python 2.5, Linux Mandriva 2007.1] Hello, does anybody know about an XML parser usable with the sax API (xml.sax) and with XInclude feature support (directly or via hacks). With specifying nothing (default parser), it simply transmit xinclude elements (i tried to call parser on included file

Re: encoding latin1 to utf-8

2007-09-10 Thread Carsten Haese
On Mon, 2007-09-10 at 13:11 +, Harshad Modi wrote: > thx for Reply , > but I need some basic knowledge . how to encoding ? which algorithm > use for that . bz my data has some special char , i have not > confidence this function got proper result. i want to make my own > function / script fo

Re: XML: SAX and XInclude

2007-09-10 Thread Stefan Behnel
Laurent Pointal wrote: > does anybody know about an XML parser usable with the sax API (xml.sax) > and with XInclude feature support (directly or via hacks). Try lxml.etree. http://codespeak.net/lxml/ http://codespeak.net/lxml/tutorial.html http://codespeak.net/lxml/api.html#xinclude-and-element

uninstall

2007-09-10 Thread Milos Prudek
I run "make install" of Python 2.4.4 and now I discovered that I do not like the default placement of my install. The Makefile does not support an "uninstall" option. Is there a way to uninstall Python compiled from sources? -- Milos Prudek -- http://mail.python.org/mailman/listinfo/python-li

Re: Python syntax wart

2007-09-10 Thread Jason
On Sep 8, 11:16 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > The one thing I don't like about Python syntax is using backslashes to > continue lines. Yes, you can avoid them if you can include parentheses > somehow, but this isn't always possible. > > Possible: > >

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread A.T.Hofkamp
On 2007-09-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to be able print out the Steps as a visual representation so > that I can show > 1. The order the steps started > 2. The duration of the steps > > i.e. a print out such as: > > > [a] >[ b ] > [

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread Carsten Haese
On Mon, 2007-09-10 at 15:48 +0200, A.T.Hofkamp wrote: > I have seen references to a module called datetime, but I have never used > such > module so no idea what it is or where to get it. You get it by using a non-ancient version of Python. It's been part of the standard library since Python 2.

Re: uninstall

2007-09-10 Thread Paul Boddie
On 10 Sep, 15:45, Milos Prudek <[EMAIL PROTECTED]> wrote: > I run "make install" of Python 2.4.4 and now I discovered that I do not like > the default placement of my install. The Makefile does not support > an "uninstall" option. > > Is there a way to uninstall Python compiled from sources? If yo

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 15:48:44 +0200, A.T.Hofkamp wrote: > (I have seen references to a module called datetime, but I have never used > such > a module so no idea what it is or where to get it). It's just an import away -- in the standard library. :-) Ciao, Marc 'BlackJack' Rintsch -- h

printing list containing unicode string

2007-09-10 Thread Xah Lee
If i have a nested list, where the atoms are unicode strings, e.g. # -*- coding: utf-8 -*- ttt=[[u"→",u"↑"], [u"αβγ"],...] print ttt how can i print it without getting the u'\u1234' notation? i.e. i want it print just like this: [[u"→"], ...] I can of course write a loop then for each string use

zlib

2007-09-10 Thread Milos Prudek
Although I have Python 2.5 with zlib in my Linux disto, I need to install my own Python (as most Zope developers do). Zope requires zlib. Python 2.4.4 does not contain zlib. What is the correct procedure for installing zlib from source into Python? -- Milos Prudek -- http://mail.python.org/m

How can I test 'warnings' from testsuite?

2007-09-10 Thread billiejoex
Hi there, into a module of mine I 'warn' a message if a certain situation occurs: def add_anonymous_user(permissions=('r'): if 'w' in p: import warnings warnings.warn("it's not rencommended assigning 'w' permission to anonymous user.", RuntimeWarning, stacklevel=2) I'd

Re: wxPython unexpected exit

2007-09-10 Thread kyosohma
Hi, > Thanks for your help! It seems work! > Another question: I create a progress bar, and on creation, it will be > displayed, > How can I invisualize it when later I no longer need it? I think this is also a good way to use threads. Take a look at the wxPython demo for the ProgressDialog code.

Re: Checking if elements are empty

2007-09-10 Thread Chris Mellon
On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > > Lawrence D'Oliveiro wrote: > > if y[0]: > Not a good idea. > >>> Why not? > >> > >> Because there is a situation where your version of the test > >> will fail even if t

How do I read and write to the same CSV file

2007-09-10 Thread Chris
I want to update one field in a row for a csv file. So far my code looks something like this cf_stream = open("\\config.csv","r+") csv_file = csv.DictReader(cf_stream, ['Algorithm','LastModified']) and then I know I can do something like this for row in csv_file name = row["Algorithm"]

Re: How do I read and write to the same CSV file

2007-09-10 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Sep 2007 07:27:46 -0700, Chris wrote: > if date == 0: > date = os.getmtime() > # now this is where I want to write into the row of the same csv > file but only updating that one field > > How can I do this? You can't. Modifying text files with variable length lines is "im

announcement: OpenOpt and GenericOpt

2007-09-10 Thread Alan Isaac
OpenOpt and GenericOpt == Introducing two new optimization packages. OpenOpt and GenericOpt are 100% Python with a single dependency: NumPy. For more detail see below and also https://projects.scipy.org/scipy/scikits/wiki/Optimization> OpenOpt --- OpenOpt is new open sour

shared memory pointer

2007-09-10 Thread Tim
Hello Everyone, I am getting shared memory in python using the following. szName = c_char_p(name) hMapObject = windll.kernel32.CreateFileMappingA(INVALID_HANDLE_VALUE, None, PAGE_READONLY, 0, TABLE_SHMEMSIZE, szName) if (hMapObject == 0): print "OpenKey: Could not open nam

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread cjt22
Thanks however I am still having a problem using the time module for arithmetic My string times are of values such as 09:55:17 and I have code such as: >from time import * >startPoint = strptime(step.sTime, "%H:%S:%M") >finishPoint = strptime(step.fTime, "%H:%S:%M") >duration = mktime(startPoin

Re: How do I read and write to the same CSV file

2007-09-10 Thread Steven D'Aprano
On Mon, 10 Sep 2007 07:27:46 -0700, Chris wrote: > I want to update one field in a row for a csv file. So far my code looks > something like this > > cf_stream = open("\\config.csv","r+") > csv_file = csv.DictReader(cf_stream, ['Algorithm','LastModified']) > > and then I know I can do something

Re: shared memory pointer

2007-09-10 Thread Tim Golden
Tim wrote: > Hello Everyone, > > I am getting shared memory in python using the following. > > szName = c_char_p(name) > hMapObject = windll.kernel32.CreateFileMappingA(INVALID_HANDLE_VALUE, > None, PAGE_READONLY, 0, TABLE_SHMEMSIZE, szName) > if (hMapObject == 0): > print

PyConUK 2007

2007-09-10 Thread Tim Golden
For those who don't follow the UK Python scene, we've just all come back from a *fantastic* weekend in Birmingham: the very first PyCon UK. Terrific kudos to John Pinner and the West Midlands Python team who made it all happen without any serious mishaps, including registration with badges, T-shirt

Re: printing list containing unicode string

2007-09-10 Thread Carsten Haese
On Mon, 2007-09-10 at 06:59 -0700, Xah Lee wrote: > If i have a nested list, where the atoms are unicode strings, e.g. > > # -*- coding: utf-8 -*- > ttt=[[u"→",u"↑"], [u"αβγ"],...] > print ttt > > how can i print it without getting the u'\u1234' notation? > i.e. i want it print just like this: [[

Re: How can I test 'warnings' from testsuite?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 7:08 am, billiejoex <[EMAIL PROTECTED]> wrote: > Hi there, > into a module of mine I 'warn' a message if a certain situation > occurs: > > def add_anonymous_user(permissions=('r'): > if 'w' in p: > import warnings > warnings.warn("it's not rencommended assigning

Re: shared memory pointer

2007-09-10 Thread Tim
On Sep 10, 10:11 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Tim wrote: > > Hello Everyone, > > > I am getting shared memory in python using the following. > > > szName = c_char_p(name) > > hMapObject = windll.kernel32.CreateFileMappingA(INVALID_HANDLE_VALUE, > > None, PAGE_READONLY, 0,

Re: Checking if elements are empty

2007-09-10 Thread Neil Cerutti
On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: >> > Lawrence D'Oliveiro wrote: >> > if y[0]: >> Not a good idea. >> >>> Why not? >> >> >> >> Because there is a s

Re: How can I test 'warnings' from testsuite?

2007-09-10 Thread billiejoex
On 10 Set, 17:15, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 10, 7:08 am, billiejoex <[EMAIL PROTECTED]> wrote: > > > Hi there, > > into a module of mine I 'warn' a message if a certain situation > > occurs: > > > def add_anonymous_user(permissions=('r'): > > if 'w' in p: > >

Re: Python syntax wart

2007-09-10 Thread Steven W. Orr
On Monday, Sep 10th 2007 at 08:34 -, quoth Marc 'BlackJack' Rintsch: =>On Mon, 10 Sep 2007 20:19:08 +1200, Lawrence D'Oliveiro wrote: => =>> In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch =>> wrote: =>> =>>> I see a tree structure here ... =>> =>> Good, you're improving. => =>Thank

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread cjt22
On Sep 10, 3:57 pm, [EMAIL PROTECTED] wrote: > Thanks however I am still having a problem using the time module for > arithmetic > > My string times are of values such as 09:55:17 > > and I have code such as: > > >from time import * > >startPoint = strptime(step.sTime, "%H:%S:%M") > >finishPoint =

Re: Checking if elements are empty

2007-09-10 Thread Chris Mellon
On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote: > > On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > >> > Lawrence D'Oliveiro wrote: > >> > if y[0]: > >> N

Silent SaveAs when using the Excel win32com module

2007-09-10 Thread Chris
I'm trying to create an excel file which will act as a log, however I want to overwrite the file if it exists. Looking at the SaveAs method I can't find anything that would allow it. I don't want the prompt to appear to ask whether to replace the file or not. I just want to replace it without thin

Re: shared memory pointer

2007-09-10 Thread Tim
On Sep 10, 10:11 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Tim wrote: > > Hello Everyone, > > > I am getting shared memory in python using the following. > > > szName = c_char_p(name) > > hMapObject = windll.kernel32.CreateFileMappingA(INVALID_HANDLE_VALUE, > > None, PAGE_READONLY, 0,

Re: Silent SaveAs when using the Excel win32com module

2007-09-10 Thread Tim Golden
Chris wrote: > I'm trying to create an excel file which will act as a log, however I > want to overwrite the file if it exists. > > Looking at the SaveAs method I can't find anything that would allow > it. I don't want the prompt to appear to ask whether to replace the > file or not. I just want t

Re: Silent SaveAs when using the Excel win32com module

2007-09-10 Thread Chris
On Sep 10, 11:57 am, Chris <[EMAIL PROTECTED]> wrote: > I'm trying to create an excel file which will act as a log, however I > want to overwrite the file if it exists. > > Looking at the SaveAs method I can't find anything that would allow > it. I don't want the prompt to appear to ask whether to

Re: shared memory pointer

2007-09-10 Thread MC
Hi! I agree ; on windows mmap use Memory-Mapped-file, who use virtual memory. And shared memory use physical memory. The difference is OS an not Python -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

RE: Silent SaveAs when using the Excel win32com module

2007-09-10 Thread Hamilton, William
> From: Chris > > I'm trying to create an excel file which will act as a log, however I > want to overwrite the file if it exists. > > Looking at the SaveAs method I can't find anything that would allow > it. I don't want the prompt to appear to ask whether to replace the > file or not. I just wa

Re: shared memory pointer

2007-09-10 Thread Tim Golden
Tim wrote: > I reviewed the mmap function and I have a question. In the example > code below, what is the connection between the data in shared memory > and the mmap function. The fileno is zero. Why is it zero? The size > makes sense because there is 256 bytes in shared memory. The tag is > MyFile

Question about PEP 8

2007-09-10 Thread Laszlo Nagy
Hi All, Here is what I read in PEP 8: > Package and Module Names > > Modules should have short, all-lowercase names. Underscores can be used > in the module name if it improves readability. Python packages should > also have short, all-lowercase names, although the use o

Re: Checking if elements are empty

2007-09-10 Thread Neil Cerutti
On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> Agreed; but I prefer 'if y[0] == ""', absent more context and >> better names. > > Probably should use u"" if you're going to take that route, as > this will fail spuriously if y[0] conta

Re: Modul (%) in python not like in C?

2007-09-10 Thread [EMAIL PROTECTED]
On Sep 10, 1:38 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 09 Sep 2007 22:57:24 -0700, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > > > But, in general, doesn't (-11,-4) also satisfy > > x = y * a + b > > -70 = 6 * -11 + (-4)? >

Re: /dev/null as a file-like object, or logging to nothing

2007-09-10 Thread Gabriel Genellina
En Sat, 08 Sep 2007 14:42:14 -0300, Torsten Bronger <[EMAIL PROTECTED]> escribi�: >> `os.devnull`? > > Yes, but I wasn't really sure how portable it is, in particular, on > Windows. So does > > open(os.devnull, "w").write("Schallalla") > > work on Windows like on Unix? Yes. os.devnull=='nul' o

C API (embedded Python): How to get and set named variables

2007-09-10 Thread mrabens
>From the C API (I'm using Python embedded), how can I get and set the value of named variables? Right now, I'm using hacks like PyRun_SimpleString("foobar = 12\n"), but I'd really like to access the named objects directly. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >