Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Anton van Straaten
Joachim Durchholz wrote: > Anton van Straaten schrieb: > >> Marshall wrote: >> >>> Can you be more explicit about what "latent types" means? >> >> >> Sorry, that was a huge omission. (What I get for posting at 3:30am.) >> >> The short answer is that I'm most directly referring to "the types in >

Re: Python database access

2006-06-26 Thread Dave Cook
On 2006-06-26, Serge Orlov <[EMAIL PROTECTED]> wrote: > On 25 Jun 2006 21:19:18 -0700, arvind <[EMAIL PROTECTED]> wrote: >> I am going to work on Python 2.4.3 and MSSQL database server on >> Windows platform. > The module you're looking for is the first result if you search > "python mysql" on g

Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: >... let's try some google searches and see the number of million hits...: But how reliable are those estimates of numbers of hits, anyway? More than once I've got a page showing something like "Results 1 - 10 of about 36

Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Mirco Wahab <[EMAIL PROTECTED]> wrote: >C++ programming requires you to massively invest your thinking >first into the setup of your build environment ... I don't understand why. It's easy enough to build small programs with a single g++ command. -- http://mail.

Re: Duplex communication with pipes - is possible ?

2006-06-26 Thread Dara Durum
Hi ! See this shortened, simplified example. It is not working, but I don't understand why... # Client Process import os, sys from subprocess import Popen, PIPE from time import sleep, time from cPickle import loads, dumps from binascii import hexlify, unhexlify from base64 import encodestring,

Re: What technologies should I use for my application manager?

2006-06-26 Thread Adam Jones
MrBlueSky wrote: > Hello! I've just finished working on my first Python app (a > Tkinter-based program that displays the content of our application log > files in graphical format). It was a great experience that's had a > very positive response from my colleagues. > > So I'd like to try somethi

Re: list problem 4 newbie

2006-06-26 Thread Duncan Booth
manstey wrote: > for index in reversed(range(0,len(a)-1)): >if '75' in b[index][1]: > b[index][1].remove('75') > b[index][1].append('99') > What on earth is all that messing around in the for loop intended to do? If you want a range from len(a)-2 to 0 inclusive then just do it i

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
"Rob Thorpe" <[EMAIL PROTECTED]> writes: >> I think statements like this are confusing, because there are >> different interpretations of what a "value" is. > But I mean the value as the semantics of the program itself sees it. > Which mostly means the datum in memory. I don't agree with that.

Re: Pygame.draw challenge is over!

2006-06-26 Thread Duncan Booth
Richard Jones wrote: > spiffy wrote: >> Congrats to Seth Yastrov for 'gravity.py' ... THE ONLY ONE THAT >> WORKED! > > I did test that they all worked on my machine before putting them > online... > > What issues are you having? What OS? The only issue I found is that goop dies with "IndexErro

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Chris Smith
Anton van Straaten <[EMAIL PROTECTED]> wrote: > I'm not trying to call programmer reasoning in general a type system. > I'd certainly agree that a programmer muddling his way through the > development of a program, perhaps using a debugger to find all his > problems empirically, may not be reaso

Re: Kamaelia 0.4.0 RELEASED - Faster! More Tools! More Examples! More Docs! ; -)

2006-06-26 Thread Matt Hammond
>> This allows somethings to run eg >> >> AxonVisualiser.py --navelgaze >> >> but I'm not sure if the results are really unaffected by not having a >> real yielder. The diagram appears, but doesn't seem to settle down. > > I don't think the AxonVisualiser would be particularly affected by > this -

Re: Python taught in schools?

2006-06-26 Thread Duncan Booth
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Alex Martelli) wrote: > >>... let's try some google searches and see the number of million >>hits...: > > But how reliable are those estimates of numbers of hits, anyway? More > than once I've got a page showing

Re: Interactive debugging

2006-06-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi, is there a way in python to place some sort of keyboard() type > statement which stops the script and puts you back at the console? I'm > looking for something like in matlab, where you place a keyboard() > command (I think), then you're in debug mode in the console

Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: (snip) > Two additional questions though: 1) is there a way for a function to > get a reference to its caller automatically (as in, without the caller > having to pass it in)? It's possible with sys._getframe() and a decorator - but consider it a hack. > and 2) what's th

Re: error with string (beginner)

2006-06-26 Thread Bruno Desthuilliers
Jason wrote: > I believe what you are trying to do is something like the following. > > [code] > def isIntLike(x): > try:int(x) > except: return False *Never* ever use a bare except clause. *Always* specify wich exceptions you are expecting. (NB : here, TypeError and ValueError).

style question

2006-06-26 Thread Hari Sekhon
Is it better to do: message = """This is line1. This is line2 This is line3\n""" or message = "This is line1.\n message = message + "This is line2\n" message = message + "This is line3\n" Since the first method does not follow python's clean and easy looking indentation structure but the seco

Re: Python question

2006-06-26 Thread Bruno Desthuilliers
Harry wrote: > Hi All, (snip) > I have the following object which is like a list of tuples > row= [('name', 'x1'), ('min', 15.449041129349528), ('max', > 991.6337818245629), ('range', 976.18474069521335), ('mean', > 496.82174193958127), ('stddev', 304.78275004920454), ('variance', > 92892.52472755

Re: style question

2006-06-26 Thread MTD
Hari Sekhon wrote: > Is it better to do: > > message = """This is line1. > This is line2 > This is line3\n""" > > or > > message = "This is line1.\n > message = message + "This is line2\n" > message = message + "This is line3\n" Is there any reason you can't do it in one line? message = "This is

Re: style question

2006-06-26 Thread Hari Sekhon
MTD wrote: Hari Sekhon wrote: Is it better to do: message = """This is line1. This is line2 This is line3\n""" or message = "This is line1.\n message = message + "This is line2\n" message = message + "This is line3\n" Is there any reason you can't do it in one line?

Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread bearophileHUGS
I can't give much answers, I am not that expert yet. Bruno Desthuilliers: > newstyle classes can do whatever oldstyle classes > did, *and much more* (descriptors and usable > metaclasses) - and they are somewhat faster too. In the past I have done few tests, and it seemed that new style classes a

Re: style question

2006-06-26 Thread Frank Millman
Hari Sekhon wrote: > Is it better to do: > > message = """This is line1. > This is line2 > This is line3\n""" > > or > > message = "This is line1.\n > message = message + "This is line2\n" > message = message + "This is line3\n" > > > Since the first method does not follow python's clean and easy

Re: style question

2006-06-26 Thread Frank Millman
Frank Millman wrote: > > How about > > message = ("This is line1. " > "This is line2 " > "This is line3\n") > > The brackets mean that the lines are automatically treated as > continuous, without the need for the ugly '\' continuation character. > > The

Re: style question

2006-06-26 Thread Laurent Rahuel
Hari Sekhon wrote: > Is it better to do: > > message = """This is line1. > This is line2 > This is line3\n""" > > or > > message = "This is line1.\n > message = message + "This is line2\n" > message = message + "This is line3\n" > > > Since the first method does not follow python's clean and

Re: style question

2006-06-26 Thread Fredrik Lundh
Frank Millman wrote: >> How about >> >> message = ("This is line1. " >> "This is line2 " >> "This is line3\n") >> >> The brackets mean that the lines are automatically treated as >> continuous, without the need for the ugly '\' continuation character. >>

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Chris Smith <[EMAIL PROTECTED]> writes: > I've since abandoned any attempt to be picky about use of the word > "type". That was a mistake on my part. I still think it's legitimate > to object to statements of the form "statically typed languages X, but > dynamically typed languages Y", in whi

Re: style question

2006-06-26 Thread Frank Millman
Fredrik Lundh wrote: > Frank Millman wrote: > > >> How about > >> > >> message = ("This is line1. " > >> "This is line2 " > >> "This is line3\n") > >> > >> The brackets mean that the lines are automatically treated as > >> continuous, without the need fo

Re: Python taught in schools?

2006-06-26 Thread Mirco Wahab
Thus spoke Lawrence D'Oliveiro (on 2006-06-26 09:21): > In article <[EMAIL PROTECTED]>, > Mirco Wahab <[EMAIL PROTECTED]> wrote: > >>C++ programming requires you to massively invest your thinking >>first into the setup of your build environment ... > > I don't understand why. It's easy enough t

Re: style question

2006-06-26 Thread Duncan Booth
Hari Sekhon wrote: > Since the first method does not follow python's clean and easy looking > indentation structure but the second just looks crude and ugly anyway. If you want indented and pretty is important to you: >>> from textwrap import dedent as D >>> message = D("""\ This is

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Chris Smith <[EMAIL PROTECTED]> writes: > Joachim Durchholz <[EMAIL PROTECTED]> wrote: >> Assume a language that >> a) defines that a program is "type-correct" iff HM inference establishes >> that there are no type errors >> b) compiles a type-incorrect program anyway, with an establishes >> rig

Re: pypy-0.9.0: stackless, new extension compiler

2006-06-26 Thread cfbolz
Hi all! Michael Hudson wrote: > The PyPy development team has been busy working and we've now packaged > our latest improvements, completed work and new experiments as > version 0.9.0, our fourth public release. Unfortunately the download links for the release tarballs did not work until very rec

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Ketil Malde
Anton van Straaten <[EMAIL PROTECTED]> writes: > But a program as seen by the programmer has types: the programmer > performs (static) type inference when reasoning about the program, and > debugs those inferences when debugging the program, finally ending up > with a program which has a perfectly

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Andreas Rossberg
Gabriel Dos Reis wrote: > [EMAIL PROTECTED] writes: > > | think that it is too relevant for the discussion at hand. Moreover, > | Harper talks about a relative concept of "C-safety". > > Then, I believe you missed the entire point. I think the part of my reply you snipped addressed it well enoug

About python 2.5 and its try statement.

2006-06-26 Thread defcon8
I can't remember the proposal number, but many of you reading will have probably read the features that will be added to python 2.5. The actual part I wanted to talk about was the finally part of try. Isn't it totally defeating a compiler's job by executing the finally part even if there is an erro

Re: Python database access

2006-06-26 Thread defcon8
arvind wrote: > Hi all, > I am going to work on Python 2.4.3 and MSSQL database server on > Windows platform. > But I don't know how to make the connectivity or rather which module to > import. > I searched for the modules in the Python library, but I couldn't find > which module to go for. > Ple

Re: About python 2.5 and its try statement.

2006-06-26 Thread Tim N. van der Leeuw
Hi, defcon8 wrote: > I can't remember the proposal number, but many of you reading will have > probably read the features that will be added to python 2.5. The actual > part I wanted to talk about was the finally part of try. Isn't it > totally defeating a compiler's job by executing the finally

RE: SWIG problems with gcc and Cygwin?

2006-06-26 Thread Michael Yanowitz
No response yet. The SWIG test works fine in Linux no problems. However, I still have the problem in Cygwin. Also, not sure if related but I do have a win32 Python 2.4.3 and Cygwin Python 2.4.1. Not sure if there are any conflicts. Any advice in making these two co-exist? The only C/C++ compi

Help with conversion VB script to Python : COM objects

2006-06-26 Thread mitsura
Hi, I need to re-write a VB script into Python (because I really don't like VB). The VB script is used to create a Windows COM object. (I am more of Unix guy, so COM objects are a little bit alien for me). At a certain point in the VB script, I have the following line: objPolTypes = objPmad.Cvar

Re: About python 2.5 and its try statement.

2006-06-26 Thread Bruno Desthuilliers
defcon8 wrote: > I can't remember the proposal number, http://docs.python.org/dev/whatsnew/pep-341.html but many of you reading will have > probably read the features that will be added to python 2.5. The actual > part I wanted to talk about was the finally part of try. It has been here from th

automatic debugger?

2006-06-26 Thread micklee74
hi is there something like an automatic debugger module available in python? Say if i enable this auto debugger, it is able to run thru the whole python program, print variable values at each point, or print calls to functions..etc...just like the pdb module, but now it's automatic. thanks -- htt

Re: About python 2.5 and its try statement.

2006-06-26 Thread Fredrik Lundh
"defcon8" wrote: >I can't remember the proposal number, but many of you reading will have > probably read the features that will be added to python 2.5. The actual > part I wanted to talk about was the finally part of try. Isn't it > totally defeating a compiler's job by executing the finally part

Re: SWIG problems with gcc and Cygwin?

2006-06-26 Thread Istvan Albert
Michael Yanowitz wrote: > Also, not sure if related but I do have a win32 Python 2.4.3 and > Cygwin Python 2.4.1. Not sure if there are any conflicts. Any advice > in making these two co-exist? SWIG will work with the windows and cygwin python, just make sure you don't mix the various platforms

Re: String negative indices?

2006-06-26 Thread Antoon Pardon
On 2006-06-23, Filip Wasilewski <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> Logically, I should be able to enter x[-2:-0] to get the last and next to >> last characters. However, since Python doesn't distinguish between positive >> and negative zero, this doesn't work. Instead, I h

Re: automatic debugger?

2006-06-26 Thread Paul Rubin
[EMAIL PROTECTED] writes: > is there something like an automatic debugger module available in > python? Say if i enable this auto debugger, it is able to run thru the > whole python program, print variable values at each point, or print > calls to functions..etc...just like the pdb module, but now

Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread digitalorganics
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > (snip) > > > Two additional questions though: 1) is there a way for a function to > > get a reference to its caller automatically (as in, without the caller > > having to pass it in)? > > It's possible with sys._getframe() and a decorator - b

DictProxy? What is this?

2006-06-26 Thread digitalorganics
When I tried to update a class's __dict__, I got an error saying that there is no 'update' attribute for dictproxy object. What is a dictproxy object? I thought that __dict__ is always suppose to be a, no kidding, dictionary? Hence there should indeed be an update method. What's this proxy business

Re: DictProxy? What is this?

2006-06-26 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > When I tried to update a class's __dict__, I got an error saying that > there is no 'update' attribute for dictproxy object. What is a > dictproxy object? a CPython implementation detail, used to protect an internal data structure used by new-style objects from unexpect

Re: DictProxy? What is this?

2006-06-26 Thread digitalorganics
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > When I tried to update a class's __dict__, I got an error saying that > > there is no 'update' attribute for dictproxy object. What is a > > dictproxy object? > > a CPython implementation detail, used to protect an internal data structure > us

A game idea.

2006-06-26 Thread defcon8
I have had what I think is quite a nice game idea, but I don't really have the experience or knowledge to go about it. Would anyone be willing to start a game project? The game I am thinking about is a virtual IRC stock exchange. There will be a bot in the channel which gets the live stock quotes a

Re: Python database access

2006-06-26 Thread BartlebyScrivener
> But I don't know how to make the connectivity or rather which module to > import. Try mxODBC http://www.egenix.com/files/python/mxODBC.html -- http://mail.python.org/mailman/listinfo/python-list

Re: DictProxy? What is this?

2006-06-26 Thread Maric Michaud
Le lundi 26 juin 2006 16:06, [EMAIL PROTECTED] a écrit : > Fredrik Lundh wrote: > > [EMAIL PROTECTED] wrote: > > > When I tried to update a class's __dict__, I got an error saying that > > > there is no 'update' attribute for dictproxy object. What is a > > > dictproxy object? > > > > a CPython imp

Questions on Threading

2006-06-26 Thread j.c.sackett
Hello--I'm using the threading module to accomplish some distributed processing on a project, and have a basic (I hope) question that I can't find an answer to elsewhere.I've noted that there's a lot of documentation saying that there is no external way to stop a thread, and yet when creating a thr

Re: DictProxy? What is this?

2006-06-26 Thread digitalorganics
All right. Thanks for explaining that Maric. Maric Michaud wrote: > Le lundi 26 juin 2006 16:06, [EMAIL PROTECTED] a écrit : > > Fredrik Lundh wrote: > > > [EMAIL PROTECTED] wrote: > > > > When I tried to update a class's __dict__, I got an error saying that > > > > there is no 'update' attribute

Re: languages with full unicode support

2006-06-26 Thread Oliver Wong
"Oliver Bandel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Xah Lee wrote: > >> >> As far as i know, Java and JavaScript are languages with full, complete >> unicode support. That is, they allow names to be defined using unicode. > > Can you explain what you mena with the name

Get List of Classes

2006-06-26 Thread digitalorganics
Is there a method or attribute I can use to get a list of classes defined or in-use within my python program? I tried using pyclbr and readmodule but for reason that is dogslow. Thanks in advance DigiO -- http://mail.python.org/mailman/listinfo/python-list

Search String for Word

2006-06-26 Thread digitalorganics
What's the best way to search a string for a particular word and get a booleen value indicating whether it exists in the string or not? Thanks... -- http://mail.python.org/mailman/listinfo/python-list

Re: What is Expressiveness in a Computer Language [off-topic]

2006-06-26 Thread David Hopwood
Matthias Blume wrote: > I agree with Bob Harper about safety being language-specific and all > that. But, with all due respect, I think his characterization of C is > not accurate. [...] > AFAIC, C is C-unsafe by Bob's reasoning. Agreed. > Of course, C can be made safe quite easily: > > Define

Re: Search String for Word

2006-06-26 Thread Tim Chase
> What's the best way to search a string for a particular word and get a > booleen value indicating whether it exists in the string or not? >>> substring = 'foo' >>> targetstring = 'blah foo bar' >>> substring in targetstring True >>> if substring in targetstring: print 'yup' yup http://docs.

Re: 2Qs

2006-06-26 Thread JW
> > 2nd question: > [snip] > > if x>10 and y>10 and z>10 and summ(tritup(x,y,z)): print "OK" > > Others have already suggested you use the built-in sum() function. > > I'll suggest you don't need it at all, because it is redundant. > > If the sum is zero, either all three values are zero or at leas

Re: Formatted string to object

2006-06-26 Thread janama
Thankyou everyone for help last time: The following works ok when setting a wx.lib.buttons.GenBitmapTextButton's disabled bitmap in using wxpython instead of this: self.b1.SetBitmapDisabled(self.yellow) i can use this: aaa = 1 result1 = eval("self.b%s.SetBitmapDisabled(self.yellow)" % aaa) resul

Re: Search String for Word

2006-06-26 Thread digitalorganics
I thought I'd seen that somewhere! Thanks Tim. I was previously using re.search(substring, targetstring). Tim Chase wrote: > > What's the best way to search a string for a particular word and get a > > booleen value indicating whether it exists in the string or not? > > >>> substring = 'foo' > >

Re: Python taught in schools?

2006-06-26 Thread Alex Martelli
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Alex Martelli) wrote: > > >... let's try some google searches and see the number of million hits...: > > But how reliable are those estimates of numbers of hits, anyway? More > than once I've g

Re: pypy-0.9.0: stackless, new extension compiler

2006-06-26 Thread Carl Friedrich Bolz
Hi all! Michael Hudson wrote: > The PyPy development team has been busy working and we've now packaged > our latest improvements, completed work and new experiments as > version 0.9.0, our fourth public release. Unfortunately the download links for the release tarballs did not work until very

Dr. Dobb's Python-URL! - weekly Python news and links (Jun 26)

2006-06-26 Thread Cameron Laird
QOTW: "In short, it's never what you think it is ;-)" - timbot, probably on the subject of performance "Real efficiency comes from elegant solutions, not optimized programs. Optimization is always just a few correctness-preserving transformations away." - Jonathan Sobel http://www.cs.indiana.

Re: What is Expressiveness in a Computer Language [off-topic]

2006-06-26 Thread Matthias Blume
David Hopwood <[EMAIL PROTECTED]> writes: > Matthias Blume wrote: >> I agree with Bob Harper about safety being language-specific and all >> that. But, with all due respect, I think his characterization of C is >> not accurate. > [...] >> AFAIC, C is C-unsafe by Bob's reasoning. > > Agreed. > >>

Re: Get List of Classes

2006-06-26 Thread Tim Chase
> Is there a method or attribute I can use to get a list of > classes defined or in-use within my python program? I tried > using pyclbr and readmodule but for reason that is dogslow. Well, given that so much in python is considered a class, the somewhat crude code below walks an object/module a

Re: Python database access

2006-06-26 Thread vasudevram
The odbc module is part of the Python Standard Library. So you can search for docs on using it in the Python2x.chm help file (or the HTML version of the same docs) that comes with the Windows Python disttribution. Its quite easy to use ODBC from Python, at least for simple tasks like "select * fro

Re: Search String for Word

2006-06-26 Thread digitalorganics
And what if I want to search for an item in a tuple, is there a similarly easy method? Tim Chase wrote: > > What's the best way to search a string for a particular word and get a > > booleen value indicating whether it exists in the string or not? > > >>> substring = 'foo' > >>> targetstring = '

Re: style question

2006-06-26 Thread Claudio Grondi
Hari Sekhon wrote: > Is it better to do: > > message = """This is line1. > This is line2 > This is line3\n""" > > or > > message = "This is line1.\n > message = message + "This is line2\n" > message = message + "This is line3\n" > > > Since the first method does not follow python's clean and e

Re: Termination and type systems

2006-06-26 Thread Dirk Thierbach
David Hopwood <[EMAIL PROTECTED]> wrote: > Marshall wrote: >> David Hopwood wrote: >>> A type system that required an annotation on all subprograms that >>> do not provably terminate, OTOH, would not impact expressiveness >>> at all, and would be very useful. >> Interesting. I have always imagine

Re: Get List of Classes

2006-06-26 Thread digitalorganics
Wow, more than I had asked for, thank you Tim! I ended up doing this: def isClass(object): if 'classobj' in str(type(object)): return 1 elif "'type'" in str(type(object)): return 1 else: return 0 def listClasses(): classes = [] for eachobj in globals().

Re: Python taught in schools?

2006-06-26 Thread Gary Duzan
In article <[EMAIL PROTECTED]>, Mirco Wahab <[EMAIL PROTECTED]> wrote: >Thus spoke Cameron Laird (on 2006-06-25 13:08): > >> I'll gratuitously add that, even though I'm personally fond of >> C++, I think teaching it as is done in colleges and high schools >> (!) amounts to child abuse. It's wildl

Re: Get List of Classes

2006-06-26 Thread Maric Michaud
Le lundi 26 juin 2006 17:25, Tim Chase a écrit : >  I couldn't find any nice > method for determining if a variable referenced a module other > than checking to see if that item had both a "__file__" and a > "__name__" attribute. Why not : In [8]: import types, sys In [9]: isinstance(sys, types.M

Re: Search String for Word

2006-06-26 Thread Tim Williams
On 26 Jun 2006 08:24:54 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > And what if I want to search for an item in a tuple, is there a > similarly easy method? > > Tim Chase wrote: > > > What's the best way to search a string for a particular word and get a > > > booleen value indicating whe

Re: Get List of Classes

2006-06-26 Thread Tim Chase
>> I couldn't find any nice method for determining if a >> variable referenced a module other than checking to see if >> that item had both a "__file__" and a "__name__" attribute. > > Why not : > > In [8]: import types, sys > > In [9]: isinstance(sys, types.ModuleType) > Out[9]: True Yes...this

Replace Whole Object Through Object Method

2006-06-26 Thread digitalorganics
How can an object replace itself using its own method? See the following code: class Mixin: def mixin(object, *classes): NewClass = type('Mixin', (object.__class__,) + classes, {}) newobj = NewClass() newobj.__dict__.update(object.__dict__) return newobj def is

Re: Pygame.draw challenge is over!

2006-06-26 Thread Matthew Nuzum
Hey, just a quick note... when I visit http://pyweek.org I get a message that the site is not configured. www.pyweek.org works as expected. When I received this e-mail my e-mail client made pyweek.org clickable which is how I noticed the problem. On 6/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> w

Re: Search String for Word

2006-06-26 Thread digitalorganics
Thank you thank you! Tim Williams wrote: > On 26 Jun 2006 08:24:54 -0700, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > And what if I want to search for an item in a tuple, is there a > > similarly easy method? > > > > Tim Chase wrote: > > > > What's the best way to search a string for a part

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Joe Marshall
Marshall wrote: > > I stand corrected: if one is using C and writing self-modifying > code, then one *can* zip one's pants. Static proofs notwithstanding, I'd prefer a dynamic check just prior to this operation. I want my code to be the only self-modifying thing around here. -- http://mail.pyt

Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: > >>[EMAIL PROTECTED] wrote: (snip) >>>and 2) what's the reason to use newstyle classes >>>versus the old? >> >>All this is explained on python.org (there's a menu entry for this in >>the documentation menu). AFAICT, newstyle classes can do wh

Re: Replace Whole Object Through Object Method

2006-06-26 Thread Maric Michaud
Le lundi 26 juin 2006 17:57, [EMAIL PROTECTED] a écrit : > How can an object replace itself using its own method? See the > following code: > > class Mixin: > def mixin(object, *classes): > NewClass = type('Mixin', (object.__class__,) + classes, {}) > newobj = NewClass() >

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Joe Marshall
David Hopwood wrote: > > Joe Marshall wrote: > >> > >>I do this quite often. Sometimes I'll develop `in the debugger'. I'll > >>change some piece of code and run the program until it traps. Then, > >>without exiting the debugger, I'll fix the immediate problem and > >>restart the program at the

Re: Replace Whole Object Through Object Method

2006-06-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > How can an object replace itself using its own method? AFAIK, It can't (but I can be wrong - some guru around ?). > See the > following code: > > class Mixin: > def mixin(object, *classes): > NewClass = type('Mixin', (object.__class__,) + classes, {}) >

Re: Replace Whole Object Through Object Method

2006-06-26 Thread digitalorganics
Maric Michaud wrote: > Le lundi 26 juin 2006 17:57, [EMAIL PROTECTED] a écrit : > > How can an object replace itself using its own method? See the > > following code: > > > > class Mixin: > > def mixin(object, *classes): > > NewClass = type('Mixin', (object.__class__,) + classes, {}) >

Re: style question

2006-06-26 Thread Scott David Daniels
Claudio Grondi wrote: <<>> > When necessary to skip first line _and_ indentation: > message = """ > This is line 1 > This is line 2 > This is line 3 > """.replace('\n ', '\n')[1:] # adjust here '\n ' to indentation Riffing on this idea: message = """ This is line 1

Beginner Programmer Question

2006-06-26 Thread kydavis77
I am doing alot of reading and trying to teach myself how to program. I can not figure out how to make "Write a program that continually reads in numbers from the user and adds them together until the sum reaches 100." this work. If someone could show me the correct code so i can learn from that it

Re: Replace Whole Object Through Object Method

2006-06-26 Thread digitalorganics
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > > How can an object replace itself using its own method? > > AFAIK, It can't (but I can be wrong - some guru around ?). > > > ... > > FWIW: > Python 2.4.3 (#1, Jun 3 2006, 17:26:11) > [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] o

VPW: Talk schedule available

2006-06-26 Thread Brian Quinlan
What's New? === The talk schedule for the Vancouver Python Workshop is now available: http://www.vanpyz.org/conference/talkschedule.html This years line-up might be even stronger than in 2004, so check it out! About the Vancouver Python Workshop === The c

Re: Beginner Programmer Question

2006-06-26 Thread Claudio Grondi
[EMAIL PROTECTED] wrote: > I am doing alot of reading and trying to teach myself how to program. > I can not figure out how to make "Write a program that continually > reads in numbers from the user and adds them together until the sum > reaches 100." this work. If someone could show me the correct

Re: Beginner Programmer Question

2006-06-26 Thread [EMAIL PROTECTED]
Claudio Grondi wrote: > [EMAIL PROTECTED] wrote: > > I am doing alot of reading and trying to teach myself how to program. > > I can not figure out how to make "Write a program that continually > > reads in numbers from the user and adds them together until the sum > > reaches 100." this work. If

Re: Beginner Programmer Question

2006-06-26 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > Claudio Grondi wrote: > > [EMAIL PROTECTED] wrote: > > > I am doing alot of reading and trying to teach myself how to program. > > > I can not figure out how to make "Write a program that continually > > > reads in numbers from the user and adds them together until the s

Re: Beginner Programmer Question

2006-06-26 Thread Rune Strand
> > I am doing alot of reading, and the problem didnt come with an answer. > I dont understand how to get it to continually input numbers and add > all those together Use while, raw_input, sys.argv[1] and int() and break the loop when the sum is above 100. ;-) -- http://mail.python.org/mailman/

Re: What is a type error?

2006-06-26 Thread Pascal Costanza
David Hopwood wrote: > Pascal Costanza wrote: >> Chris Smith wrote: >> >>> While this effort to salvage the term "type error" in dynamic >>> languages is interesting, I fear it will fail. Either we'll all have >>> to admit that "type" in the dynamic sense is a psychological concept >>> with no pre

Re: Beginner Programmer Question

2006-06-26 Thread [EMAIL PROTECTED]
Rune Strand wrote: > > > > I am doing alot of reading, and the problem didnt come with an answer. > > I dont understand how to get it to continually input numbers and add > > all those together > > Use while, raw_input, sys.argv[1] and int() and break the loop when the > sum is above 100. > > ;-)

break the loop in one object and then return

2006-06-26 Thread Alex Pavluck
I am trying to write the following code to block up evaluation and prompting for entering new information. However, when I break the loop in one object and then return it does not start at the beginning again but rather at the point where it exited. Can someone look at the following code and give

Re: Beginner Programmer Question

2006-06-26 Thread SuperHik
[EMAIL PROTECTED] wrote: > I am doing alot of reading and trying to teach myself how to program. > I can not figure out how to make "Write a program that continually > reads in numbers from the user and adds them together until the sum > reaches 100." this work. If someone could show me the correct

Re: Beginner Programmer Question

2006-06-26 Thread SuperHik
Rune Strand wrote: >> I am doing alot of reading, and the problem didnt come with an answer. >> I dont understand how to get it to continually input numbers and add >> all those together > > Use while, raw_input, sys.argv[1] and int() and break the loop when the > sum is above 100. > > ;-) > I d

Re: Mix-In Class Methods At Run-Time

2006-06-26 Thread digitalorganics
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > > Bruno Desthuilliers wrote: > > > >>[EMAIL PROTECTED] wrote: > (snip) > > >>>and 2) what's the reason to use newstyle classes > >>>versus the old? > >> > >>All this is explained on python.org (there's a menu entry for this in > >>the documen

mac findertools restart() does not work?

2006-06-26 Thread nate
>>> import findertools >>> findertools.restart() Traceback (most recent call last): File "", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/plat-mac/findertools.py", line 90, in restart finder.restart() File "/Library/Frameworks/Python.framework/Versio

Re: Beginner Programmer Question

2006-06-26 Thread Rune Strand
[EMAIL PROTECTED] wrote: > Rune Strand wrote: > > > > > > I am doing alot of reading, and the problem didnt come with an answer. > > > I dont understand how to get it to continually input numbers and add > > > all those together > > > > Use while, raw_input, sys.argv[1] and int() and break the loo

Re: Beginner Programmer Question

2006-06-26 Thread [EMAIL PROTECTED]
Rune Strand wrote: > [EMAIL PROTECTED] wrote: > > Rune Strand wrote: > > > > > > > > I am doing alot of reading, and the problem didnt come with an answer. > > > > I dont understand how to get it to continually input numbers and add > > > > all those together > > > > > > Use while, raw_input, sys.

  1   2   3   >