Re: a Python person's experience with Ruby

2007-12-08 Thread Kay Schluehr
On Dec 8, 8:56 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > --- Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > Colin J. Williams a écrit : > > > I'm not sure that I like add 3, 5, 7 > > > > but it would be nice to be able to drop the > > parentheses > > > when no argument is required. > >

Re: how to convert 3 byte to float

2007-12-08 Thread Tim Roberts
"Mario M. Mueller" <[EMAIL PROTECTED]> wrote: >Bjoern Schliessmann wrote: > >[...] >> BTW, who in his mind designs three byte floats? Memory isn't that >> expensive anymore. Even C bool is four bytes long. > >It's output of a digitizer (but not that old). I was also wondering about >the reason for

python/regex question... hope someone can help

2007-12-08 Thread charonzen
I have a list of strings. These strings are previously selected bigrams with underscores between them ('and_the', 'nothing_given', and so on). I need to write a regex that will read another text string that this list was derived from and replace selections in this text string with those from my l

Re: Advice for editing xml file using ElementTree and wxPython

2007-12-08 Thread Waldemar Osuch
On Dec 8, 8:35 pm, Rick Muller <[EMAIL PROTECTED]> wrote: > I'm a computational chemist who frequently dabbles in Python. A > collaborator sent me a huge XML file that at one point was evidently > modified by a now defunct java application. A sample of this file > looks something like: > > > T

Re: how to convert 3 byte to float

2007-12-08 Thread Hendrik van Rooyen
"Tommy Nordgren" <[EMAIL PROTECTED]> wrote: > > On 8 dec 2007, at 12.52, Mario M. Mueller wrote: > > > Bjoern Schliessmann wrote: > > > > [...] > >> BTW, who in his mind designs three byte floats? Memory isn't that > >> expensive anymore. Even C bool is four bytes long. > > > > It's output of a di

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Steve Howell
--- Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > Steve Howell <[EMAIL PROTECTED]> wrote: > > > > > --- Jeremy C B Nicoll <[EMAIL PROTECTED]> > wrote: > > > > What command (in XP) does one need to issue to > > > syntax check a saved python > > > script without running it? > > > > Perhaps ove

Re: Advice for editing xml file using ElementTree and wxPython

2007-12-08 Thread Steve Howell
--- Rick Muller <[EMAIL PROTECTED]> wrote: > If I want to do this, it seems like I need to keep a > connection > between the gui element and the original value in > the elementtree, so > I can update it. But I'm having a hard time > visualizing exactly how > this works. Can someone help me out he

Advice for editing xml file using ElementTree and wxPython

2007-12-08 Thread Rick Muller
I'm a computational chemist who frequently dabbles in Python. A collaborator sent me a huge XML file that at one point was evidently modified by a now defunct java application. A sample of this file looks something like: Test File Name fileName Name of the input f

Re: Different kinds of Import Errors

2007-12-08 Thread Steven D'Aprano
On Sun, 09 Dec 2007 00:25:53 +, Jeremy C B Nicoll wrote: > > for app_name in settings.INSTALLED_APPS: > > try: > > __import__(app_name + '.management', {}, {}, ['']) > > except ImportError, exc: > > if exc.args[0]!='No module named manageme

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Jeremy C B Nicoll
Steve Howell <[EMAIL PROTECTED]> wrote: > > --- Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > > What command (in XP) does one need to issue to > > syntax check a saved python > > script without running it? > > Perhaps oversimplifying a bit, running "python" does a > syntax check, and if it pas

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Steve Howell
--- Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote: > Steve Howell <[EMAIL PROTECTED]> wrote: > > > There are a zillion powerful editors out there. > I've > > been productive in EditPlus, MultiEdit, SlickEdit, > > vim, and emacs, just to throw out a few examples. > > What command (in XP) does one

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Steve Howell
--- Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 08 Dec 2007 16:58:25 -0800, Karthik Gurusamy > wrote: > > > Why are the following accepted even without a > warning about syntax > > error? > > (I would expect the python grammar should catch > these kind of syntax > > errors) > >

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Jeremy C B Nicoll
Steve Howell <[EMAIL PROTECTED]> wrote: > There are a zillion powerful editors out there. I've > been productive in EditPlus, MultiEdit, SlickEdit, > vim, and emacs, just to throw out a few examples. What command (in XP) does one need to issue to syntax check a saved python script without runnin

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Dec 2007 16:58:25 -0800, Karthik Gurusamy wrote: > Why are the following accepted even without a warning about syntax > error? > (I would expect the python grammar should catch these kind of syntax > errors) > n = 1 2 * + n > 2 n += 1 n > 2 ++n > 2 There i

Re: auto-increment operator - why no syntax error?

2007-12-08 Thread Chris M
On Dec 8, 7:58 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > I see python doesn't have ++ or -- operators unlike say, C. > I read some reasonings talking about immutable scalars and using ++/-- > doesn't make much sense in python (not sure if ++i is that far-fetched > compared to the allowed i

auto-increment operator - why no syntax error?

2007-12-08 Thread Karthik Gurusamy
I see python doesn't have ++ or -- operators unlike say, C. I read some reasonings talking about immutable scalars and using ++/-- doesn't make much sense in python (not sure if ++i is that far-fetched compared to the allowed i += 1) In any case, I accidentally wrote ++n in python and it silently

Re: Minimalistic Software Transactional Memory

2007-12-08 Thread Michael Sparks
Fuzzyman wrote: > Wouldn't it be more useful having a store (possibly with a mapping > API?) that stored several values. Then a single commit can be done at > the end of the transaction. > > If the transaction fails, then the whole process can be repeated with > none of the changes having been co

Re: new style class

2007-12-08 Thread Steven D'Aprano
On Sat, 08 Dec 2007 23:14:44 +, Bruce Coram wrote: >> http://www.catb.org/~esr/faqs/smart-questions.html >> > Eric Raymond's advice on how to ask questions the smart way would seem > to provide an excuse for people with ego control problems to indulge > themselves at the expense of others.

Re: Different kinds of Import Errors

2007-12-08 Thread Jeremy C B Nicoll
Thomas Guettler <[EMAIL PROTECTED]> wrote: > If you look at this code, you see there are two kind of ImportErrors: > > 1. app_name has no attribute or file managment.py: That's OK. > 2. managment.py exists, but raises an ImportError: That's not OK: reraise > > # Import the 'management' m

Re: Distinguishing attributes and methods

2007-12-08 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > On Dec 8, 2:51 pm, Glenn Hutchings <[EMAIL PROTECTED]> wrote: > > > >>On Dec 8, 7:44 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > >> > >> > >>>I think it muddies the water to say that a.a() a

Re: a Python person's experience with Ruby

2007-12-08 Thread Bruno Desthuilliers
Richard Jones a écrit : > Bruno Desthuilliers wrote: > >>class A(object): >> @apply >> def a(): >> def fget(self): >> return self._a >> def fset(self, val): >> self._a = val >> return property(**locals()) >> def __init__(self): >> self.a = "foo" > > > That prope

Re: a Python person's experience with Ruby

2007-12-08 Thread Steve Howell
--- Richard Jones <[EMAIL PROTECTED]> wrote: > > class A(object): > def set_a(self, value): > self._a = value > a = property(lambda self: self._a, set_a) > > Note that this differs from a regular attribute > because "a" is not deletable > from instances (the property defines no d

Re: File to dict

2007-12-08 Thread Jeremy C B Nicoll
Chris <[EMAIL PROTECTED]> wrote: > For the first one you are parsing the entire file everytime you want > to lookup just one domain... Is the file sorted? If so wouldn't it be easier either to read the whole thing and then binary-chop search it, or if the file is vast to use seek creatively to b

Re: Minimalistic Software Transactional Memory

2007-12-08 Thread Fuzzyman
On Dec 8, 10:53 pm, Michael Sparks <[EMAIL PROTECTED]> wrote: > Hi, > > I'm interested in writing a simple, minimalistic, non persistent (at this > stage) software transactional memory (STM) module. The idea being it should > be possible to write such a beast in a way that can be made threadsafe fa

Re: a Python person's experience with Ruby

2007-12-08 Thread Steve Howell
--- Bruno Desthuilliers > > > Another aspect of Ruby is that the final > expression > > evaluated in a method actually gets returned as > the > > result of a method, > > Unless there's an explict return before... > > > which has further implications on > > whether "close" is simply evaluated or

Re: a Python person's experience with Ruby

2007-12-08 Thread Richard Jones
Bruno Desthuilliers wrote: > class A(object): >@apply >def a(): > def fget(self): >return self._a > def fset(self, val): >self._a = val > return property(**locals()) >def __init__(self): > self.a = "foo" That property setup seems overly complicated.

Re: a Python person's experience with Ruby

2007-12-08 Thread Bruno Desthuilliers
Steve Howell a écrit : > --- Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > > >>Colin J. Williams a écrit : >> >>>I'm not sure that I like add 3, 5, 7 >>> >>>but it would be nice to be able to drop the >> >>parentheses >> >>>when no argument is required. >>> >>>Thus: close; >>>could r

Re: new style class

2007-12-08 Thread Bruce Coram
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Nigel Rantor <[EMAIL PROTECTED]> wrote: > >> I think what Boris was being exceedingly unhelpful in saying was "why >> should it work when you're calling methods that do not exist" >> > > http://www.catb.org/~esr/faqs/smart-questions.html >

Re: highscores list

2007-12-08 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : (snip) > # hiscores.py > import sys > > def _read_scores(path): > f = open(path) > # we don't expect a huge file so it's simpler to > # read it all in memory > lines = f.readlines() > f.close() > > scores = [] > for line in filter(None, ma

Re: a Python person's experience with Ruby

2007-12-08 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 8, 12:42 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >>MonkeeSage a écrit : >> >> >>>On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: >> >>(snip) >> 4) Ruby forces you to explicitly make attributes for instance variables. At first I fou

Minimalistic Software Transactional Memory

2007-12-08 Thread Michael Sparks
Hi, I'm interested in writing a simple, minimalistic, non persistent (at this stage) software transactional memory (STM) module. The idea being it should be possible to write such a beast in a way that can be made threadsafe fair easily. For those who don't know, STM is a really fancy way of say

Re: Distinguishing attributes and methods

2007-12-08 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 8, 2:51 pm, Glenn Hutchings <[EMAIL PROTECTED]> wrote: > >>On Dec 8, 7:44 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: >> >> >>>I think it muddies the water to say that a.a() and a.a are the same >>>thing--obviously they are not. >> >>A thing is not what it is; >>A thing

Re: Distinguishing attributes and methods

2007-12-08 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 8, 12:56 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >>MonkeeSage a écrit : >> >> >> >> >>>On Dec 8, 2:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Fri, 07 Dec 2007 23:19:40 -0800, tjhnson wrote: >> >With properties, attributes a

Re: Python too complex ?!?!?!

2007-12-08 Thread Jacob Hallen
In article <[EMAIL PROTECTED]>, Chris Mellon <[EMAIL PROTECTED]> wrote: >On Nov 22, 2007 3:04 PM, Brian <[EMAIL PROTECTED]> wrote: > >> / Chime Mode >> I have, in fact, sent this thread to my friend. >> His limiting factors are >> >> - money-control people favor MS platforms >> - C# and VS have mi

Re: download complete webpage with python

2007-12-08 Thread James Matthews
from urllib import urlopen url = urlopen("http://www.google.com";).read() Enjoy! On 12/8/07, Larry Bates <[EMAIL PROTECTED]> wrote: > > Gabriel Genellina wrote: > > En Fri, 07 Dec 2007 17:58:43 -0300, yi zhang <[EMAIL PROTECTED]> > > escribió: > > > >> The urllib.urlretrieve() can only download t

Re: Ruby's Template Engine for Python

2007-12-08 Thread Samuel
On Sat, 08 Dec 2007 13:06:15 -0800, Steve Howell wrote: > This is what I came up with: > > http://pylonshq.com/pastetags/form_remote_tag I see that Pylons uses a standard templating systems with all the JS renderers hooked into it as standard template function calls. That's great, now I just h

Re: highscores list

2007-12-08 Thread Bruno Desthuilliers
Shawn Minisall a écrit : > I'm writing a game that uses two functions to check and see if a file > called highScoresList.txt exists in the main dir of the game program. > If it doesn, it creates one. That part is working fine. The problem is > arising when it goes to read in the high scores f

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | What don't I know that I should know to just edit/run, preferably at | the tap of a function key? In IDLE, which come with Python, it is F5. (See Options/General/Autosave) Startup is about .1 sec since the program runs in a window of

Recommendations for writing a user guide with examples?

2007-12-08 Thread Neal Becker
I'm looking for recommendations for writing a user manual. It will need lots of examples of command line inputs and terminal outputs. I'd like to minimize the effort to integrate the terminal input/output into my document. I have lots of experience with latex, but I wonder if there may be some o

Re: a Python person's experience with Ruby

2007-12-08 Thread I V
On Sat, 08 Dec 2007 11:23:57 -0800, MonkeeSage wrote: >> > The equivalent python idiom is something like: >> >> > class A: >> > __a = "foo" >> > def __init__(self): >> > self.a = A.__a [...] >> > Which roughly translates to this in ruby: >> >> > class A >> > attr_accessor :a >> > def in

Re: Running unmodified CGI scripts persistently under mod_wsgi.

2007-12-08 Thread Graham Dumpleton
On Dec 9, 12:26 am, Michael Ströder <[EMAIL PROTECTED]> wrote: > Jeffrey Froman wrote: > > > I'd still be interested in a mod_wsgi wrapper for 3rd-party CGI scripts. > > I doubt that this is possible, not because of the interface. But > conventional CGI scripts are implemented with the assumption o

Re: Distinguishing attributes and methods

2007-12-08 Thread MonkeeSage
On Dec 8, 2:51 pm, Glenn Hutchings <[EMAIL PROTECTED]> wrote: > On Dec 8, 7:44 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > I think it muddies the water to say that a.a() and a.a are the same > > thing--obviously they are not. > > A thing is not what it is; > A thing is what it does. > This is t

Re: Ruby's Template Engine for Python

2007-12-08 Thread Steve Howell
--- Samuel <[EMAIL PROTECTED]> wrote: > Hi, > > Following the masses I was drawn to RoR's website > today and I saw the > following HTML template in one of the screencasts: > I know a lot of Rails goodies have been ported to Python, so you might want to google some variations on "form_remote_

Re: highscores list

2007-12-08 Thread Samuel
On Sat, 08 Dec 2007 13:32:08 -0500, Shawn Minisall wrote: > I'm writing a game that uses two functions to check and see if a file > called highScoresList.txt exists in the main dir of the game program. If > it doesn, it creates one. That part is working fine. The problem is > arising when it goe

Re: Distinguishing attributes and methods

2007-12-08 Thread Glenn Hutchings
On Dec 8, 7:44 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > I think it muddies the water to say that a.a() and a.a are the same > thing--obviously they are not. A thing is not what it is; A thing is what it does. This is the Way of the Duck. -- Basho (in his "3 extra syllables" phase) -- http

Re: Distinguishing attributes and methods

2007-12-08 Thread Roberto Bonvallet
On Dec 8, 4:19 am, [EMAIL PROTECTED] wrote: > With properties, attributes and methods seem very similar. I was > wondering what techniques people use to give clues to end users as to > which 'things' are methods and which are attributes. Methods are verbs, attributes are nouns :) -- Roberto Bonv

Ruby's Template Engine for Python

2007-12-08 Thread Samuel
Hi, Following the masses I was drawn to RoR's website today and I saw the following HTML template in one of the screencasts: -- <% form_remote_tag :url => { :action => :search }, :update => :results, :complete => visual_effect(:blind_down, 'image') :before => %(Element

Re: download complete webpage with python

2007-12-08 Thread Larry Bates
Gabriel Genellina wrote: > En Fri, 07 Dec 2007 17:58:43 -0300, yi zhang <[EMAIL PROTECTED]> > escribió: > >> The urllib.urlretrieve() can only download the text part of a webpage, >> not the image associated. How can I download the whole, complete >> webpage with python? Thanks! > > The images

Re: Distinguishing attributes and methods

2007-12-08 Thread Marc 'BlackJack' Rintsch
On Sat, 08 Dec 2007 11:44:36 -0800, MonkeeSage wrote: > On Dec 8, 12:56 pm, Bruno Desthuilliers >> callable attributes are not necessarily methods, and are still >> 'variables' anyway. > > I think it muddies the water to say that a.a() and a.a are the same > thing--obviously they are not. In the

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Steve Howell
--- Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > I'm a java guy used to the effective edit/run > cycle you get with a > > good IDE. > > > > Today I'm writing my first Python, but can't seem > to find the way to > > use Python's inherent edit/run cycle. > > >

Re: Securely distributing python source code as an application?

2007-12-08 Thread Larry Bates
xkenneth wrote: > Hi All, > > I'll shortly be distributing a number of python applications that > use proprietary. The software is part of a much larger system and it > will need to be distributed securely. How can i achieve this? > > Regards, > Ken We have partnered with developers to use

Re: highscores list

2007-12-08 Thread Chris
On Dec 8, 10:07 pm, Chris <[EMAIL PROTECTED]> wrote: > On Dec 8, 8:32 pm, Shawn Minisall <[EMAIL PROTECTED]> wrote: > > > > > I'm writing a game that uses two functions to check and see if a file > > called highScoresList.txt exists in the main dir of the game program. > > If it doesn, it creates o

Re: highscores list

2007-12-08 Thread Zepo Len
> I'm writing a game that uses two functions to check and see if a file > called highScoresList.txt exists in the main dir of the game program. > If it doesn, it creates one. That part is working fine. The problem is > arising when it goes to read in the high scores from the file when I

Re: Tkinter Newbie Question

2007-12-08 Thread robbie
Hi Mark, Thank you so much for the help. I figured it was something pretty simple like that. And I was also puzzled by the concept of the lambda function, so now I know what they do too. I just tried it out, and it works well. Much appreciated, Ciao back at you, Robbie -- http://mail.python.or

Re: how to convert 3 byte to float

2007-12-08 Thread jdsahr
On Dec 8, 6:05 am, "Mario M. Mueller" <[EMAIL PROTECTED]> wrote: > Tommy Nordgren wrote: > > [...] > > > One thing to consider: It is possible that one of the bytes > > contributes bits to BOTH the mantissa and the exponent ; > > From todays point of view I cannot exclude this. > > > Do you know th

Re: highscores list

2007-12-08 Thread Chris
On Dec 8, 8:32 pm, Shawn Minisall <[EMAIL PROTECTED]> wrote: > I'm writing a game that uses two functions to check and see if a file > called highScoresList.txt exists in the main dir of the game program. > If it doesn, it creates one. That part is working fine. The problem is > arising when it g

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Steve Howell
--- [EMAIL PROTECTED] wrote: > > What don't I know that I should know to just > edit/run, preferably at > the tap of a function key? Most good editors let you do these things: 1) Save a file. 2) Run a script from the shell. 3) Turn steps 1 and 2 into a macro. 4) Allow you to map th

Re: a Python person's experience with Ruby

2007-12-08 Thread Steve Howell
--- Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Colin J. Williams a écrit : > > I'm not sure that I like add 3, 5, 7 > > > > but it would be nice to be able to drop the > parentheses > > when no argument is required. > > > > Thus: close; > > could replace close(); > > This just cou

Re: Newbie edit/compile/run cycle question

2007-12-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I'm a java guy used to the effective edit/run cycle you get with a > good IDE. > > Today I'm writing my first Python, but can't seem to find the way to > use Python's inherent edit/run cycle. > > I edit my source, import it into Python, run it. Fine. Then I edit > ag

Re: Distinguishing attributes and methods

2007-12-08 Thread MonkeeSage
On Dec 8, 12:56 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > > > On Dec 8, 2:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > >>On Fri, 07 Dec 2007 23:19:40 -0800, tjhnson wrote: > > >>>With properties, attributes and methods seem very similar. I wa

Re: a Python person's experience with Ruby

2007-12-08 Thread MonkeeSage
On Dec 8, 12:42 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > MonkeeSage a écrit : > > > On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > > (snip) > >> 4) Ruby forces you to explicitly make attributes for > >> instance variables. At first I found this clumsy, but > >> I've got

Highscores list

2007-12-08 Thread Shawn Minisall
I'm writing a game that uses two functions to check and see if a file called highScoresList.txt exists in the main dir of the game program. If it doesn, it creates one. That part is working fine. The problem is arising when it goes to read in the high scores from the file when I play again.

Re: Distinguishing attributes and methods

2007-12-08 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 8, 2:10 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > >>On Fri, 07 Dec 2007 23:19:40 -0800, tjhnson wrote: >> >>>With properties, attributes and methods seem very similar. I was >>>wondering what techniques people use to give clues to end users as to >>>w

Re: Distinguishing attributes and methods

2007-12-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi, > > With properties, attributes and methods seem very similar. I was > wondering what techniques people use to give clues to end users as to > which 'things' are methods and which are attributes. Documentation. > With ipython, I > use tab completion all the ti

Re: Gnu/Linux dialogue boxes in python

2007-12-08 Thread Paul Boddie
On 7 Des, 17:43, [EMAIL PROTECTED] wrote: > > If you built a GUI with wxPython, it would just use the OS's native > dialogs unless it didn't have one and then it would use a generic > dialog. I would think creating a installer with wxPython and threads > would be fairly trivial. I'm not convinced

Re: a Python person's experience with Ruby

2007-12-08 Thread Bruno Desthuilliers
Colin J. Williams a écrit : > Steve Howell wrote:> > Thanks for the interesting comparison. > > [snip] > >> 3) I actually like being able to omit parentheses in >> method definitions and method calls. In Ruby you can >> express "add(3,5,7)" as both "add(3,5,7)" and "add 3, >> 5, 7." The latte

Re: a Python person's experience with Ruby

2007-12-08 Thread Bruno Desthuilliers
MonkeeSage a écrit : > On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: > (snip) >> 4) Ruby forces you to explicitly make attributes for >> instance variables. At first I found this clumsy, but >> I've gotten used to it, and I actually kind of like it >> in certain circumstances. > 4

highscores list

2007-12-08 Thread Shawn Minisall
I'm writing a game that uses two functions to check and see if a file called highScoresList.txt exists in the main dir of the game program. If it doesn, it creates one. That part is working fine. The problem is arising when it goes to read in the high scores from the file when I play again.

Nice Python Cartoon!

2007-12-08 Thread James Matthews
http://xkcd.com/353/ -- http://search.goldwatches.com/?Search=Movado+Watches http://www.jewelerslounge.com http://www.goldwatches.com -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils & OS X universal binaries

2007-12-08 Thread Robin Becker
Martin v. Löwis wrote: >> OK I need to use something a bit more complex then; I figure this should >> work >> >> #if defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__) >> #ifdef __BIG_ENDIAN__ >> #ifdef WORDS_BIGENDIAN >> #endif > > I don't understand. If you assume that ei

Newbie edit/compile/run cycle question

2007-12-08 Thread MartinRinehart
I'm a java guy used to the effective edit/run cycle you get with a good IDE. Today I'm writing my first Python, but can't seem to find the way to use Python's inherent edit/run cycle. I edit my source, import it into Python, run it. Fine. Then I edit again, but the next import doesn't notice that

Re: eof

2007-12-08 Thread jjnoakes
On Nov 24, 12:03 am, MonkeeSage <[EMAIL PROTECTED]> wrote: > > class open(file): > def __init__(self, name): > self.size = os.stat(name).st_size > file.__init__(self, name) > def eof(self): > return self.tell() == self.size > > f = open('tmp.py') > print f.eof() # False > f.read() >

Re: eof

2007-12-08 Thread jjnoakes
On Nov 22, 10:37 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > > def read(self, size=None): > if size is None: > val = file.read(self) > self.eof = True > else: > val = file.read(self, size) > if len(val) < size: > self.eof = True

Re: callback confusion

2007-12-08 Thread Donn Ingle
> As far as I can tell, you have a bit more code in boo, and somewhere in > that code (after the print statement), you rebind the name 'kills'. Okay, yes: def boo() kills += 1 print kills > the absence of a global declaration, this makes this name a local > variable. I think I see what you mean

Re: distutils & OS X universal binaries

2007-12-08 Thread Martin v. Löwis
> OK I need to use something a bit more complex then; I figure this should > work > > #if defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__) > #ifdef __BIG_ENDIAN__ > #ifdef WORDS_BIGENDIAN > #undef WORDS_BIGENDIAN > #endif > #define WORDS_BIGENDIAN 1 > #

Re: setattr getattr confusion

2007-12-08 Thread Donn Ingle
Thanks Bruno, I had to keep coding, so I used the long form [Object.subobject.property = blah] anyway. It's long-winded, but unambiguous. \d -- http://mail.python.org/mailman/listinfo/python-list

Re: Calculate an age

2007-12-08 Thread Pierre Quentel
On Dec 8, 10:04 am, Shane Geiger <[EMAIL PROTECTED]> wrote: > What is so obvious about dealing with months that vary in length and the > leap-year issue? Nothing. If you were born on a day that does not > exist every year (Feb 29th), how old are you on Feb 28th? X years, 11 months, 28 days or M

Re: distutils & OS X universal binaries

2007-12-08 Thread Robin Becker
Martin v. Löwis wrote: ... >> I'm puzzled why WORDS_BIGENDIAN is undefined if both __BIG_ENDIAN__ and >> __LITTLE_ENDIAN__ are undefined. Surely in that case WORDS_BIGENDIAN >> should be left alone (if it is already defined). If there's a compiler >> for a bigendian architecture which doesn't d

Re: a Python person's experience with Ruby

2007-12-08 Thread James Matthews
I have been waiting for something like this! Thanks! On Dec 8, 2007 6:08 AM, Steve Howell <[EMAIL PROTECTED]> wrote: > Python is my favorite programming language. I've used > it as my primary language for about six years now, > including four years of using it full-time in my day > job. Three m

Re: setattr getattr confusion

2007-12-08 Thread Bruno Desthuilliers
Donn Ingle a écrit : >>class Key(object): >>def __init__self): >>self.__dict__['props'] = KeyProps() > > Okay - that's weird. No, that's coherent. The default behavior (I mean, when there's no descriptor involved etc) of __setattr__ is to store attributes in instance.__dict__. So as long a you

Re: distutils & OS X universal binaries

2007-12-08 Thread Martin v. Löwis
> PIL may also have a similar problem as the 1.1.6 setup.py script also > defines WORDS_BIGENDIAN like this > > if struct.unpack("h", "\0\1")[0] == 1: > defs.append(("WORDS_BIGENDIAN", None)) > > probably I borrowed/stole this as we have something very similar in our > setup.p

Re: distutils & OS X universal binaries

2007-12-08 Thread Martin v. Löwis
> #ifdef __BIG_ENDIAN__ > #define WORDS_BIGENDIAN 1 > #else > #ifndef __LITTLE_ENDIAN__ > #undef WORDS_BIGENDIAN > #endif > #endif > > > I'm puzzled why WORDS_BIGENDIAN is undefined if both __BIG_ENDIAN__ and > __LITTLE_ENDIAN__ are undefined. Surely in that case WORDS_BIGENDIAN > should be left

Re: "Python" is not a good name, should rename to "Athon"

2007-12-08 Thread Steve Howell
--- Jan Claeys <[EMAIL PROTECTED]> wrote: > Op Mon, 03 Dec 2007 14:20:52 +1300, schreef greg: > > > If you want a really appropriate name for a > programming language, I'd > > suggest Babbage. (not for Python, though!) > > Konrad Zuse wrote the first high-level programming > language, so I thin

Re: callback confusion

2007-12-08 Thread Bruno Desthuilliers
Donn Ingle a écrit : (snip) > [in one.py] > kills=0 > def boo(): > print kills > > It will abort with: > print kills > UnboundLocalError: local variable 'kills' referenced before assignment As far as I can tell, you have a bit more code in boo, and somewhere in that code (after the print st

Re: Basic animation in Python - how to

2007-12-08 Thread Donn Ingle
> Please refer me to some basic Python code for animation like that . You are in for a wild ride! Depending on your platform you can use dozens of different tools. Try wxPython, pyCairo, pyGTK and PIL (Python Imaging Library) for the most capable. Basically you are looking at a fairly complex thin

Re: distutils & OS X universal binaries

2007-12-08 Thread Robin Becker
Martin v. Löwis wrote: . > > In the specific case, just use the WORDS_BIGENDIAN macro defined in > pyconfig.h; it will be defined if the target is bigendian, and > undefined otherwise. In the case of a universal build, it will be > undefined in the x86 compiler invocation, and defined in t

Re: "Python" is not a good name, should rename to "Athon"

2007-12-08 Thread Jan Claeys
Op Mon, 03 Dec 2007 14:20:52 +1300, schreef greg: > If you want a really appropriate name for a programming language, I'd > suggest Babbage. (not for Python, though!) Konrad Zuse wrote the first high-level programming language, so I think his name would be a better candidate... -- JanC -- ht

Re: setattr getattr confusion

2007-12-08 Thread Donn Ingle
> class Key(object): > def __init__self): > self.__dict__['props'] = KeyProps() Okay - that's weird. Is there another way to spin this? > def __setattr__(self,var,val): > setattr(self.props,var,val) Perhaps by changing this one? \d -- http://mail.python.org/mailman/listinfo/python-list

Re: Running unmodified CGI scripts persistently under mod_wsgi.

2007-12-08 Thread Istvan Albert
On Dec 8, 8:26 am, Michael Ströder <[EMAIL PROTECTED]> wrote: > But conventional CGI scripts are implemented with the assumption of being > stateless. while it might be that some CGI scripts must be executed in a new python process on each request, common sense and good programming practices wou

callback confusion

2007-12-08 Thread Donn Ingle
Hi, I have two modules, the second is imported by the first. Let's call them one.py and two.py (two being my API) In the first I register a function into the second. [in one.py] def boo(): ... ... two.register( boo ) two.startLoop() In two.py it starts a loop (GTK timeout), so processing remains

Re: a Python person's experience with Ruby

2007-12-08 Thread Arkanes
Colin J. Williams wrote: > Steve Howell wrote:> > Thanks for the interesting comparison. > > [snip] > >> 3) I actually like being able to omit parentheses in >> method definitions and method calls. In Ruby you can >> express "add(3,5,7)" as both "add(3,5,7)" and "add 3, >> 5, 7." The latter

Re: distutils & OS X universal binaries

2007-12-08 Thread Christian Heimes
Martin v. Löwis wrote: > At first, I also thought that Robin suggested that there is a problem > with Python. Upon re-reading, I now believe he rather sees the bug > in the reportlabs code, and is asking for an approach to solve it there. I saw your posting after I sent mine. The gmane web interfa

Re: distutils & OS X universal binaries

2007-12-08 Thread Robin Becker
Martin v. Löwis wrote: >>> A user reports problems with one of our extensions when running the >>> intel compiled extension on ppc and vice versa. He is building the >>> extension as a universal binary. Although the intel compiled version >>> runs fine it displays a known bug when run on a ppc.

Re: distutils & OS X universal binaries

2007-12-08 Thread Martin v. Löwis
>> A user reports problems with one of our extensions when running the >> intel compiled extension on ppc and vice versa. He is building the >> extension as a universal binary. Although the intel compiled version >> runs fine it displays a known bug when run on a ppc. > > Have you reported the

Re: a Python person's experience with Ruby

2007-12-08 Thread Colin J. Williams
MonkeeSage wrote: > On Dec 7, 11:08 pm, Steve Howell <[EMAIL PROTECTED]> wrote: >> Python is my favorite programming language. I've used >> it as my primary language for about six years now, >> including four years of using it full-time in my day >> job. Three months ago I decided to take a posit

Re: a Python person's experience with Ruby

2007-12-08 Thread Colin J. Williams
Steve Howell wrote:> Thanks for the interesting comparison. [snip] > 3) I actually like being able to omit parentheses in > method definitions and method calls. In Ruby you can > express "add(3,5,7)" as both "add(3,5,7)" and "add 3, > 5, 7." The latter syntax is obviously more error > prone, b

Re: distutils & OS X universal binaries

2007-12-08 Thread Christian Heimes
Robin Becker wrote: > A user reports problems with one of our extensions when running the > intel compiled extension on ppc and vice versa. He is building the > extension as a universal binary. Although the intel compiled version > runs fine it displays a known bug when run on a ppc. Have you r

Re: distutils & OS X universal binaries

2007-12-08 Thread Martin v. Löwis
> One proposed fix is to make the endian variable code dynamically change > at run time. I would advise against that. Endianness depdency should be resolved at compile time, with appropriate conditional compilation. Endianness won't change at run-time (and no, not even for a fat binary - the x86 c

Re: setattr getattr confusion

2007-12-08 Thread Steven D'Aprano
On Sat, 08 Dec 2007 14:26:00 +0200, Donn Ingle wrote: >> So you might want to describe your use-case. > Um.. I wanted an object with Key to hold other data. I wanted a way to > set that *other* data within Key without having to specify the "object > in-between" everytime. That's called "automatic

Re: Basic animation in Python - how to

2007-12-08 Thread Peter Wang
On Dec 8, 6:37 am, "http://members.lycos.co.uk/dariusjack/"; <[EMAIL PROTECTED]> wrote: > I need to draw a shaded rectangle and have flashing (gif animated) > points on it > so not to refresh all objects a rectangle, but points, changing their > colors, attributes. > Please refer me to some basic P

  1   2   >