Re: defining classes

2005-09-02 Thread Michael Hoffman
LeRoy Lee wrote: > class foo2: >def __init__(self): >self.j = 5 > >>> h = foo2() >>> h.j > > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: foo2 instance has no attribute 'j' Try again: >>> class foo2: ...def __init__(self): ...self.j = 5

Re: defining classes

2005-09-02 Thread Grant Edwards
On 2005-09-02, LeRoy Lee <[EMAIL PROTECTED]> wrote: > Now take this example > > class foo2: > def __init__(self): > self.j = 5 > >>>h = foo2() >>>h.j > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: foo2 instance has no attribute 'j' Works fine for me e

Re: defining classes

2005-09-02 Thread Benji York
LeRoy Lee wrote: > I have been searching for the answer to this as it will determine how I use > classes. Here are two bits of code. > class foo2: > def __init__(self): > self.j = 5 > > >>>h = foo2() >>>h.j > > Traceback (most recent call last): > File "", line 1, in ? > Attribu

Re: Problem building Python on HP-UX

2005-09-02 Thread sponix2ipfw
I don't know much about HP-UX, and I'm sure someone will shoot me down for saying this, but all *nix is about the same to me. I'd just try a ./configure --prefix=/opt/tcl_tk on both the TCL and TK installs, and then just drop the ./configure params in there to use /opt/tcl_tk/ as the prefix to the

Re: defining classes

2005-09-02 Thread Steve Horsley
LeRoy Lee wrote: > I have been searching for the answer to this as it will determine how I > use classes. Here are two bits of code. > > class foo1: >def __init__(self, i): >self.r = i >self.j = 5 > >>> h = foo1(1) >>> h.r > > 1 > >>> h.j > > 5 > > > Now take this examp

Re: Find day of week from month and year

2005-09-02 Thread Laguna
> What do you mean by, "the 9 element tuple need to be populated > correctly"? Do you need someone to tell you what values it > needs? What happens if you use (2005, 9, 1, 0, 0, 0, 0, 0, 0), > for example? If you make this tuple with localtime or gmtime, > do you know what the 7th (tm[6]) elemen

Re: Proposal: add sys to __builtins__

2005-09-02 Thread Paul Watson
Steve Holden wrote: > Rick Wotnaz wrote: > >> Michael Hoffman <[EMAIL PROTECTED]> wrote in >> news:[EMAIL PROTECTED]: >> >>> What would people think about adding sys to __builtins__ so that >>> "import sys" is no longer necessary? This is something I must >>> add to every script I write that's not

Problems with os.system

2005-09-02 Thread alexLIGO
Hi, I am trying to run a python script that executes several other programs on the bash (under linux) and reads some of the output of those programs. This works fine for a couple of os.system() calls, but then it does not work anymore. os.system() returns always -1, but when executing exactly the

Re: Find day of week from month and year

2005-09-02 Thread Laguna
Paul, Thanks for the suggestion on calendar module. Here is my solution and it works: def expiration(year, month): weekday = calendar.weekday(year, month, 1) table = [19, 18, 17, 16, 15, 21, 20] return table[weekday] Cheers, Laguna -- http://mail.python.org/mailman/list

Re: Find day of week from month and year

2005-09-02 Thread Carsten Haese
On Fri, 2005-09-02 at 16:46, Laguna wrote: > Paul, > > Thanks for the suggestion on calendar module. Here is my solution and > it works: > > def expiration(year, month): > weekday = calendar.weekday(year, month, 1) > table = [19, 18, 17, 16, 15, 21, 20] > return table[weekday] >

Re: Jargons of Info Tech industry

2005-09-02 Thread John Bokma
[EMAIL PROTECTED] wrote: > Of course what the original poster did not consider is why > the standard line length was laid down... the VT100 terminals > (and related ones) had a line length which was 80 characters > (ok, with some options to switch to 132 characters if I > remember correctly)... an

Re: Problems with os.system

2005-09-02 Thread marduk
On Fri, 2005-09-02 at 13:45 -0700, alexLIGO wrote: > Hi, > > I am trying to run a python script that executes several other programs > on the bash (under linux) and reads some of the output of those > programs. This works fine for a couple of os.system() calls, but then > it does not work anymore.

Re: Decrypting GPG/PGP email messages

2005-09-02 Thread Piet van Oostrum
> François Pinard <[EMAIL PROTECTED]> (FP) wrote: >FP> Protection against replay is easily guaranteed by sequencing requests, >FP> that is, including a sequence number within the message, each originator >FP> his sequence. A digital signature prevents someone from tampering with >FP> the seq

Re: Find day of week from month and year

2005-09-02 Thread Laguna
Thanks for the "hint" :) I may use your solution if this becomes my bottleneck! I try to get away from Perl-ish syntax though. Best, L -- http://mail.python.org/mailman/listinfo/python-list

ANN: Python Computer Graphics Kit v2.0.0alpha5

2005-09-02 Thread Matthias Baas
The fifth alpha release of version 2 of the Python Computer Graphics Kit is available at http://cgkit.sourceforge.net What is it? --- The Python Computer Graphics Kit is a generic 3D package written in C++ and Python that can be used for a variety of domains such as scientific visualizat

Re: Problems with os.system

2005-09-02 Thread alexLIGO
No I read some other data files that has been created by the other program. I am not interested in the stdout or err of that program... -- http://mail.python.org/mailman/listinfo/python-list

Record separator for readlines()

2005-09-02 Thread Angelic Devil
I know this has been asked before (I already consulted the Google Groups archive), but I have not seen a definative answer. Is there a way to change the record separator in readlines()? The documentation does not mention any way to do this. I know way back in 1998, Guido said he would consider

Re: Find day of week from month and year

2005-09-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Laguna" <[EMAIL PROTECTED]> wrote: > > What do you mean by, "the 9 element tuple need to be populated > > correctly"? Do you need someone to tell you what values it > > needs? What happens if you use (2005, 9, 1, 0, 0, 0, 0, 0, 0), > > for example? If you make

Re: 'isa' keyword

2005-09-02 Thread phil hunt
On Thu, 01 Sep 2005 20:39:14 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: >phil hunt wrote: >> It could be argued of course, that an OOPL should allow methods to >> be sent with a grammar: >> >>receiver selector argument >> >> (which is almost what Smalltalk does), but you're not arguing f

Re: Problems with os.system

2005-09-02 Thread jepler
Repeated calls to system() seem to cause no problem here. I ran the following program: import os for i in xrange(1): assert os.system("true") == 0 in around 25 seconds, the 'for' loop completed, and the 'true' command always returned 0 from system, as expected.

urllib.urlopen doesn't work

2005-09-02 Thread Josef Cihal
Hallo,   i need a help with module URLLIB.   I am trying to open url via: -    urllib.urlopen ('http://brokerjet.ecetra.com/at/markets/stocks/indices.phtml?notation=92866')     Problem is, that I am always redirecting to - LOGIN page (www.brokerjet.at), and cannot get my page with "news", whi

Re: Problems with os.system

2005-09-02 Thread Michael Hoffman
alexLIGO wrote: > I am trying to run a python script that executes several other programs > on the bash (under linux) and reads some of the output of those > programs. This works fine for a couple of os.system() calls, but then > it does not work anymore. os.system() returns always -1, but when > e

Fw: urllib.urlopen doesn't work

2005-09-02 Thread Josef Cihal
  - Original Message - From: Josef Cihal To: python-list@python.org Sent: Saturday, September 03, 2005 12:09 AM Subject: urllib.urlopen doesn't work Hallo,   i need a help with module URLLIB.   I am trying to open url via: -    urllib.urlopen ('http://brokerjet.ecetra.com/at/market

Re: Sockets: code works locally but fails over LAN

2005-09-02 Thread Bryan Olson
n00m wrote: > My today's tests (over LAN). > I think *it* will drive me mad very soon. Network programming is like that. Just because something worked once doesn't mean it really works. I had guessed two causes for the behavior you were seeing, and either could result in sporadic failures. >

Re: Record separator for readlines()

2005-09-02 Thread gene tani
universal newlines? http://www.python.org/doc/2.3.3/whatsnew/node7.html Angelic Devil wrote: > I know this has been asked before (I already consulted the Google > Groups archive), but I have not seen a definative answer. Is there a > way to change the record separator in readlines()? The documen

Re: Find day of week from month and year

2005-09-02 Thread Laguna
Hey Donn, I don't mean to offend anyone here. I was just saying that the other solution is better suited for my problem. I truly appreciate your analysis and suggestions. BTW, I am not a programmer :( and I like the simplest solution whenever possible. Cheers, L -- http://mail.python.org/mailm

Re: To the python-list moderator

2005-09-02 Thread Terry Reedy
"Neil Schemenauer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In the future, sending a message to [EMAIL PROTECTED] is > suggested rather than posting to only to python-list. Thank you information. Since python.org is mostly stuff other than the mailing lists, I did not thin

unicode and os.system

2005-09-02 Thread Dumbkiwi
I've got a rather large python script that I write and maintain. It has some interaction with other programmes on the linux/kde desktop through the dcop interface. This script also uses the gettext module to enable the output of the script to be translated into several languages, including utf-8

Re: unicode and os.system

2005-09-02 Thread Erik Max Francis
Dumbkiwi wrote: > Can anyone help me to work through this issue? I'm a bit lost as to where > to start. If you want to convert it to UTF-8, then do so with u.decode('utf-8') -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W &

Re: unicode and os.system

2005-09-02 Thread Dumbkiwi
On Fri, 02 Sep 2005 16:11:48 -0700, Erik Max Francis wrote: > Dumbkiwi wrote: > >> Can anyone help me to work through this issue? I'm a bit lost as to where >> to start. > > If you want to convert it to UTF-8, then do so with > > u.decode('utf-8') I've tried that previously, and get: T

Re: unicode and os.system

2005-09-02 Thread Erik Max Francis
Dumbkiwi wrote: > I've tried that previously, and get: > > Traceback (most recent call last): > File "/home/matt/karamba/lwbkup/liquid_weather.py", line 2765, in initWidget > os.system('dcop kxdocker docker addIcon Current %s "%s : %s" /dev/null > GIcon lwp none none none none' %(icopath,

Re: Add lists to class?

2005-09-02 Thread BBands
> Why don't you use a real list instead? I am using lists... I just showed the naming schema. Here is how they are implemented. for var in range(len(self.symbols)): setattr(self, "_" + str(var), []) > I don't understand what > self.__dict__["_" + str(var)] gets you. It let's me access lists

Re: Epydoc - Documenting class members?

2005-09-02 Thread Terry Hancock
On Friday 02 September 2005 08:28 am, Michael Ekstrand wrote: > On Thu, 1 Sep 2005 22:38:03 -0500 > Terry Hancock <[EMAIL PROTECTED]> wrote: > > > I don't like this, I want to document where I declare the variable > > > below. Doxygen (www.doxygen.org), for one example, knows how to do > > > this.

Re: Find day of week from month and year

2005-09-02 Thread Peter Hansen
Carsten Haese wrote: > On Fri, 2005-09-02 at 16:46, Laguna wrote: >>def expiration(year, month): >> weekday = calendar.weekday(year, month, 1) >> table = [19, 18, 17, 16, 15, 21, 20] >> return table[weekday] >> > This, of course, can be "optimized" into > > def expiration(year, mont

Re: Find day of week from month and year

2005-09-02 Thread Paul Rubin
Peter Hansen <[EMAIL PROTECTED]> writes: > (And, if I were "optimizing", I would of course dispense with the > dynamic creation of the static table upon every execution of > expiration(), and move it outside the function.) Replacing it with a tuple might be enough for that. -- http://mail.python.

Re: Find day of week from month and year

2005-09-02 Thread John Machin
Peter Hansen wrote: > Carsten Haese wrote: > >> On Fri, 2005-09-02 at 16:46, Laguna wrote: >> >>> def expiration(year, month): >>> weekday = calendar.weekday(year, month, 1) >>> table = [19, 18, 17, 16, 15, 21, 20] >>> return table[weekday] >>> >> This, of course, can be "optimized" in

Re: Bug in string.find

2005-09-02 Thread Ron Adam
Terry Reedy wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Fredrik Lundh wrote: >> >>>Ron Adam wrote: >>> The problem with negative index's are that positive index's are zero based, but negative index's are 1 based. Which leads to a non symmetri

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-09-02 Thread Bengt Richter
On Wed, 31 Aug 2005 14:16:28 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: [...] > >The problem with negative index's are that positive index's are zero >based, but negative index's are 1 based. Which leads to a non >symmetrical situations. > >Note that you can insert an item before the first item us

Re: Record separator for readlines()

2005-09-02 Thread jepler
I think you still have to roll your own. Here's a start: def ireadlines(f, s='\n', bs=4096): if not s: raise ValueError, "separator must not be empty" r = [] while 1: b = f.read(bs) if not b: break ofs = 0

Re: unicode and os.system

2005-09-02 Thread jepler
I think you need u.encode('utf-8') .encode() turns unicode into a byte string, .decode() turns a byte string into unicode. Jeff pgpCGSuYcXhRF.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with os.system

2005-09-02 Thread jepler
On Fri, Sep 02, 2005 at 01:45:42PM -0700, alexLIGO wrote: > Can I force python to execute the program on the bash? What can > I do? os.system() is a wrapper on system(3), which invokes /bin/sh. If you want to use a different shell, you can use os.spawnv(os.P_WAIT, '/bin/bash', ['bash', '-c',

Re: Bug in string.find

2005-09-02 Thread Terry Reedy
"Ron Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry Reedy wrote: >> "Ron Adam" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>>So how do I express a -0? >> >> >> You just did ;-) but I probably do not know what you mean. > > b[-1:] = ['Z']# rep

Re: Record separator for readlines()

2005-09-02 Thread Bengt Richter
On Fri, 2 Sep 2005 22:10:18 -0500, [EMAIL PROTECTED] wrote: > >--SkvwRMAIpAhPCcCJ >Content-Type: text/plain; charset=us-ascii >Content-Disposition: inline > >I think you still have to roll your own. > >Here's a start: > def ireadlines(f, s='\n', bs=4096): > if not s: raise ValueErr

RE: To the python-list moderator

2005-09-02 Thread Tony Meyer
> What still puzzles me is why the spamblocker that embargoed > me and others did not catch such obvious spam as Subject: Re: > The penis is way too delicate for masturbation (and occasional > others like this). I know nothing about how spambayes is setup for python-list, but my guess would be

Re: 'isa' keyword

2005-09-02 Thread Steve Holden
phil hunt wrote: > On Thu, 01 Sep 2005 20:39:14 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: > >>phil hunt wrote: >> >>>It could be argued of course, that an OOPL should allow methods to >>>be sent with a grammar: >>> >>> receiver selector argument >>> >>>(which is almost what Smalltalk does)

Re: 'isa' keyword

2005-09-02 Thread Bengt Richter
On Thu, 01 Sep 2005 21:25:20 -0500, D H <[EMAIL PROTECTED]> wrote: >talin at acm dot org wrote: >> Although I realize the perils of even suggesting polluting the Python >> namespace with a new keyword, I often think that it would be useful to >> consider defining an operator for testing whether or

Re: defining classes

2005-09-02 Thread Steve Holden
LeRoy Lee wrote: > I have been searching for the answer to this as it will determine how I use > classes. Here are two bits of code. [snip already well-quoted examples] > > I can't figure out why it is working this way. I figure I must be thinking > about this wrong. I was thinking that I c

Re: urllib.urlopen doesn't work

2005-09-02 Thread Steve Holden
Josef Cihal wrote: > Hallo, > > i need a help with module URLLIB. > > I am trying to open url via: > -urllib.urlopen > ('http://brokerjet.ecetra.com/at/markets/stocks/indices.phtml?notation=92866') > > > Problem is, that I am always redirecting to > - LOGIN page (www.brokerjet.at

Re: Problem with response object

2005-09-02 Thread Steve Holden
Harish Kotian wrote: > Hi Steve > I copied the lines from your mail and again got the error. > I am only pasting the relevant error lines below. > > • Error Type: > Python ActiveX Scripting Engine (0x80020009) > Traceback (most recent call last): File "

Re: Problem with response object

2005-09-02 Thread Steve Holden
Harish Kotian wrote: > Hi Steve > Thank you for getting back. I suspect I am having problem with the > response object in Python. > > I also tried with response.write it didn't work. > I pasted your code into my page and tried it. I am again pasting the > code followed by the error page. > I sh

python logo

2005-09-02 Thread Xah Lee
i noticed that Python uses various logos: http://python.org/pics/pythonHi.gif http://python.org/pics/PyBanner038.gif http://python.org/pics/PyBanner037.gif http://python.org/pics/PythonPoweredSmall.gif http://wiki.python.org/pics/PyBanner057.gif is this some decision that python should use vario

Re: To the python-list moderator

2005-09-02 Thread Fredrik Lundh
Terry Reedy wrote: >> What's >> happening is that Spambayes is marking the message as UNSURE. The >> message that mailman sends to the sender is unfortunate. The >> "Message has a suspicious header" notice is misleading because the >> user did not have any header in their message that caused it

<    1   2