Re: OverflowError: math range error...

2006-06-23 Thread Sheldon
Thanks for the tips! I am going to look into this some more. /Sheldon Simon Forman skrev: > Sheldon wrote: > > Hi, > > > > I have a written a script that will check to see if the divisor is zero > > before executing but python will not allow this: > > > > if statistic_array[0:4] > 0.0: > > stat

Re: OverflowError: math range error...

2006-06-23 Thread Sheldon
Thanks for the tips! I am going to look into this some more. I am not used to using Numeric and the logical functions. I didn't think about what you pointed out and somewhere the returned values from these logical methods are not what I expect. I will rewrite the whole thing using alltrue instead.

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Anton van Straaten
Marshall wrote: >>The short answer is that I'm most directly referring to "the types in >>the programmer's head". > > > In the database theory world, we speak of three levels: conceptual, > logical, physical. In a dbms, these might roughly be compared to > business entities described in a require

Re: Help req: Problems with MySQLdb

2006-06-23 Thread [EMAIL PROTECTED]
for x in range(self.MAX_CRAWL_THREADS+1): self.con.append( [MySQLdb.connect(host,username,passwor,database,PORT),0]) PORT is an extra argument you might not have perhaps rodmc wrote: > I have written an application that connects to a database on a remote > machine which uses MySQLdb 1.

Re: map() return of flat tuple list

2006-06-23 Thread Mirco Wahab
Thus spoke [EMAIL PROTECTED] (on 2006-06-23 00:57): > Maybe you want something like this (but this doesn't use map): > [(r,c) for r, row in enumerate(m) for c in xrange(len(row))] Ahh, its a 'list comprehension', nice. Now, lets see how the decorate/undecorate sort turns out to look in Python:

reaching to the notification area

2006-06-23 Thread Bayazee
Hi i want to make an icon in the notification area by python . how can I make a notification area button likewise windows system tray and show custem menu on right click or ... (i want to use pyqt ...) ThanX -- http://mail.python.org/mailman/listinfo/python-list

Re: Using SQLite3 with python 2.5 beta

2006-06-23 Thread Fredrik Lundh
Harold Shore wrote: > I do have SQLite3 installed on my system, but after doing a > plain vanilla compilation of the the 2.5 beta and trying > the SQLite code given in the release notes I get the message > "NameError: name 'sqlite3' is not defined". > > I wonder what the requirement means that

Re: code is data

2006-06-23 Thread Fredrik Lundh
Ravi Teja wrote: > You blogged on Django. Let's use that. Don't you think model creation > in Django can be represented better, given that it is done often > enough? nope, because 1) it's not done very often, and 2) the existing syntax is already very minimal, and defined in terms of a languag

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Rob Thorpe
David Hopwood wrote: > Rob Thorpe wrote: > > David Hopwood wrote: > > > >>As far as I can tell, the people who advocate using "typed" and "untyped" > >>in this way are people who just want to be able to discuss all languages in > >>a unified terminological framework, and many of them are specifical

Re: map() return of flat tuple list

2006-06-23 Thread bearophileHUGS
Mirco: >He, this looks more like Haskell than like Python (for me, it looks awful ;-) Maybe this is more readable: ar = [[3,3,3,3], [3,3,3,1], [3,3,4,3]] print sorted( [(r,c) for r,row in enumerate(ar) for c in xrange(len(row))], key=lambda (r,c): ar[r][c] )

Is there any good methods to read a encrypted password file?

2006-06-23 Thread [EMAIL PROTECTED]
Is there any good methods to read a encrypted password file? hi, all: I've a zipped file with a password . currently i use it by this method: $ unzip -p secret.zip | python my-pexpect.py but i want to remove the unzip -p secret.zip process. that is : $ python my-pexpect.py [whe py

Re: String negative indices?

2006-06-23 Thread Filip Wasilewski
[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 have to enter x[-2:]. Hooray! Logically there is no such thing as

Re: Help req: Problems with MySQLdb

2006-06-23 Thread Bruno Desthuilliers
Simon Forman wrote: > rodmc wrote: > >>Hi, >> >>Thanks for your email. Well I am kind of new to exceptions in Python, >>but here is the code used below, as you can see it is somewhat basic. >>Is there a way to display more information about the exception? >> >>Best, >> >>rod >> > > > Use the tra

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi > > I'd like to use metaclasses to dynamically generate a class based on a > parameter to the objects init function. Do you really need a metaclass for this ? > For example: > > class MetaThing(type): > def __init__(cls, name, bases, dict, extra_information): >

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Andreas Rossberg
Marshall wrote: > > What we generally (in programming) call variables are locals > and globals. If the languages supports an update operation > on those variables, then calling them variables makes sense. > But "variable" has become such a catch-all term that we call > > public static final int

Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Vesa Karvonen
In comp.lang.functional Anton van Straaten <[EMAIL PROTECTED]> wrote: [...] > I reject this comparison. There's much more to it than that. The point > is that the reasoning which programmers perform when working with an > program in a latently-typed language bears many close similiarities to >

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread rossberg
Anton van Straaten wrote: > > Languages with latent type systems typically don't include type > declarations in the source code of programs. The "static" type scheme > of a given program in such a language is thus latent, in the English > dictionary sense of the word, of something that is present

Re: Program slowing down with greater memory use

2006-06-23 Thread Rene Pijlman
Dan Stromberg: >What's the deal here? The sketchy information in your post doesn't rule out any possibility. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Andreas Rossberg
David Hopwood wrote: >> >>"Values" refers to the concrete values existent in the semantics of a >>programming language. This set is usually infinite, but basically fixed. >>To describe the set of "values" of an abstract type you would need >>"fresh" values that did not exist before (otherwise the a

Unicode problem with exec

2006-06-23 Thread Thomas Heller
I'm using code.Interactive console but it doesn't work correctly with non-ascii characters. I think it boils down to this problem: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print u"ä" ä

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Patricia Shanahan
Vesa Karvonen wrote: ... > An example of a form of informal reasoning that (practically) every > programmer does daily is termination analysis. There are type systems > that guarantee termination, but I think that is fair to say that it is not > yet understood how to make a practical general purpo

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread sashang
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > > Hi > > > > I'd like to use metaclasses to dynamically generate a class based on a > > parameter to the objects init function. > > Do you really need a metaclass for this ? > > > For example: > > > > class MetaThing(type): > > def __init

* in Python

2006-06-23 Thread placid
Hi all, Can someone tell me what * in the following code means/does a Google search didnt turn up anything as i dont know what the * is called (related to Python and i dont think Python has pointers) def test(*args): pass and sometimes its; def test(**args): pass Cheers -- http://

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Michele Simionato
[EMAIL PROTECTED] wrote: > However I do think the solution to my problem lies with > them since I have to dynamically generate a class and metaclasses > provide a mechanism for doing this. You rarely need a custom metaclass to generate classes. A class factory def makeclass(classname, *attributes

Re: What is a type error?

2006-06-23 Thread Pascal Costanza
Matthias Blume wrote: > Pascal Costanza <[EMAIL PROTECTED]> writes: > >> 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 psychologica

Re: What is a type error?

2006-06-23 Thread Pascal Costanza
Chris Smith wrote: > Pascal Costanza <[EMAIL PROTECTED]> wrote: >> What about this: You get a type error when the program attempts to >> invoke an operation on values that are not appropriate for this operation. >> >> Examples: adding numbers to strings; determining the string-length of a >> numb

Re: * in Python

2006-06-23 Thread Fredrik Lundh
placid wrote: > Can someone tell me what * in the following code means/does a Google > search didnt turn up anything as i dont know what the * is called see sections 4.7.2 and 4.7.3 in the tutorial: http://docs.python.org/tut/node6.html#SECTION00674 for more details, see th

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Pascal Costanza
Marshall wrote: > I am sceptical of the idea that when programming in a dynamically > typed language one doesn't have to think about both models as well. > I don't have a good model of the mental process of working > in a dynamically typed language, but how could that be the case? > (I'm not askin

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Pascal Costanza
Marshall wrote: > Pascal Costanza wrote: >> Consider a simple expression like 'a + b': In a dynamically typed >> language, all I need to have in mind is that the program will attempt to >> add two numbers. In a statically typed language, I additionally need to >> know that there must a guarantee th

Re: * in Python

2006-06-23 Thread Duncan Booth
placid wrote: > Hi all, > > Can someone tell me what * in the following code means/does a Google > search didnt turn up anything as i dont know what the * is called > (related to Python and i dont think Python has pointers) > * is for variable number of positional arguments, ** is for variable

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Piet van Oostrum
> "Marshall" <[EMAIL PROTECTED]> (M) wrote: >M> Torben Ægidius Mogensen wrote: >>> >>> That's not true. ML has variables in the mathematical sense of >>> variables -- symbols that can be associated with different values at >>> different times. What it doesn't have is mutable variables (thou

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Anton van Straaten
Vesa Karvonen wrote: > I think that we're finally getting to the bottom of things. While reading > your reponses something became very clear to me: latent-typing and latent- > types are not a property of languages. Latent-typing, also known as > informal reasoning, is something that all programme

windows and socket.dup

2006-06-23 Thread gangesmaster
what uses do you have to socket.dup? on *nixes it makes, to dup() the socket before forking, but how can that be useful on windows? -tomer -- http://mail.python.org/mailman/listinfo/python-list

Re: code is data

2006-06-23 Thread Anton Vredegoor
Paul Boddie wrote: > Anton Vredegoor wrote: >> Yes, but also what some other posters mentioned, making Pythons internal >> parsing tree available to other programs (and to Python itself) by using >> a widely used standard like XML as its datatype. > > http://pysch.sourceforge.net/ast.html Very

Leo 4.4.1 beta 2 released

2006-06-23 Thread Edward K. Ream
Leo 4.4.1 beta 2 is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html The highlights of Leo 4.4.1: -

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Pascal Costanza
Marshall wrote: > Joe Marshall wrote: >> That's the important point: I want to run broken code. > > I want to make sure I understand. I can think of several things > you might mean by this. It could be: > 1) I want to run my program, even though I know parts of it > are broken, because I think th

Reuseable iterators - which is better?

2006-06-23 Thread zefciu
In the tutorial there is an example iterator class that revesrses the string given to the constructor. The problem is that this class works only once, unlike built-in types like string. How to modify it that it could work several times? I have tried two approaches. They both work, but which of

Re: bug in Makepy

2006-06-23 Thread Jim
> Always interpret it as hex, or always interpret it as decimal. I see what you mean. But I don't think I'll worry about it. -- Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: * in Python

2006-06-23 Thread placid
Duncan Booth wrote: > placid wrote: > > > Hi all, > > > > Can someone tell me what * in the following code means/does a Google > > search didnt turn up anything as i dont know what the * is called > > (related to Python and i dont think Python has pointers) > > > * is for variable number of positi

Re: Status of optional static typing in Python?

2006-06-23 Thread John Roth
Christian Convey wrote: > Hi guys, > > I'm looking at developing a somewhat complex system, and I think some > static typing will help me keep limit my confusion. I.e.: > > http://www.artima.com/weblogs/viewpost.jsp?thread=87182 > > Does anyone know if/when that feature may become part of Python?

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Pascal Costanza
Vesa Karvonen wrote: > In comp.lang.functional Anton van Straaten <[EMAIL PROTECTED]> wrote: > [...] >> I reject this comparison. There's much more to it than that. The point >> is that the reasoning which programmers perform when working with an >> program in a latently-typed language bears ma

Re: Specifing arguments type for a function

2006-06-23 Thread George Sakkis
Dennis Lee Bieber wrote: > On 22 Jun 2006 22:55:00 -0700, "George Sakkis" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > Ok, I'll try once more: What does __setitem__ have to do with > > **iterability**, not mutability or indexability ? I was commenting on > > Maric's po

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Pascal Costanza
Patricia Shanahan wrote: > Vesa Karvonen wrote: > ... >> An example of a form of informal reasoning that (practically) every >> programmer does daily is termination analysis. There are type systems >> that guarantee termination, but I think that is fair to say that it is >> not >> yet understood

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Chris Uppal
Andreas Rossberg wrote: > Chris Uppal wrote: > > > > > > It's worth noting, too, that (in some sense) the type of an object > > > > can change over time[*]. > > > > > > No. Since a type expresses invariants, this is precisely what may > > > *not* happen. If certain properties of an object may chang

Re: What is a type error?

2006-06-23 Thread Chris Uppal
Eliot Miranda wrote: [me:] > > Taking Smalltalk /specifically/, there is a definite sense in which it > > is typeless -- or trivially typed -- in that in that language there are > > no[*] operations which are forbidden[**], > > Come one Chris U. One has to distinguish an attempt to invoke an > o

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Chris Uppal
Anton van Straaten wrote: > In that case, you could say that the conceptual type is different than > the inferred static type. But most of the time, the human is reasoning > about pretty much the same types as the static types that Haskell > infers. Things would get a bit confusing otherwise. O

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Chris Uppal
David Hopwood wrote: > > But some of the advocates of statically > > typed languages wish to lump these languages together with assembly > > language a "untyped" in an attempt to label them as unsafe. > > A common term for languages which have defined behaviour at run-time is > "memory safe". For

Re: What is a type error?

2006-06-23 Thread Chris Uppal
Chris Smith wrote: [me:] > > I think we're agreed (you and I anyway, if not everyone in this thread) > > that we don't want to talk of "the" type system for a given language. > > We want to allow a variety of verification logics. So a static type > > system is a logic which can be implemented bas

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Anton van Straaten
[EMAIL PROTECTED] wrote: > I very much agree with the observation that every programmer performs > "latent typing" in his head Great! > (although Pascal Constanza's seems to have > the opposite opinion). I'll have to catch up on that. > But I also think that "latently typed language" is not a

Re: code is data

2006-06-23 Thread Max Erickson
Anton Vredegoor <[EMAIL PROTECTED]> wrote: > > However, I knew of the existence of such languages but I am > mostly interested in standardized code interchange, like for > example with JSONP which fetches some external javascriptcode > from another server using JSON and places the translated

Re: code is data

2006-06-23 Thread Kay Schluehr
Anton Vredegoor wrote: > Paul Boddie wrote: > > > Anton Vredegoor wrote: > > >> Yes, but also what some other posters mentioned, making Pythons internal > >> parsing tree available to other programs (and to Python itself) by using > >> a widely used standard like XML as its datatype. > > > > http:

Re: Network Programming in Python

2006-06-23 Thread diffuser78
How will Pyon help my cause ? Bill Maxwell wrote: > On 22 Jun 2006 12:02:14 -0700, [EMAIL PROTECTED] wrote: > > >I am a newbie in python. I want to learn and implement a small > >networking concept. Please help me. Every help is appreciated. > > > >I have one Linux Box and one Windows PC. I want t

Re: Reuseable iterators - which is better?

2006-06-23 Thread Diez B. Roggisch
zefciu schrieb: > In the tutorial there is an example iterator class that revesrses the > string given to the constructor. The problem is that this class works > only once, unlike built-in types like string. How to modify it that it > could work several times? I have tried two approaches. They

Re: Unicode problem with exec

2006-06-23 Thread Diez B. Roggisch
Thomas Heller schrieb: > I'm using code.Interactive console but it doesn't work correctly > with non-ascii characters. I think it boils down to this problem: > > Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" fo

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Matthias Blume
Pascal Costanza <[EMAIL PROTECTED]> writes: > Patricia Shanahan wrote: >> Vesa Karvonen wrote: >> ... >>> An example of a form of informal reasoning that (practically) every >>> programmer does daily is termination analysis. There are type systems >>> that guarantee termination, but I think that

re question

2006-06-23 Thread Daniel Sch
Hello re gurus, I wrote this pattern trying to get the "name" and the "content" of VHDL package I know that the file is a valid VHDL code, so actually there is no need to perform validation after 'end' token is found, but since it works fine I don't want to touch it. this is the pattern patte

Re: serial port servo control

2006-06-23 Thread Si Ballenger
On 22 Jun 2006 08:18:08 -0700, [EMAIL PROTECTED] wrote: >So I ordered a mini SSC II (the servo controller), in order to >control some servos from the computer. I was hoping to use python to >do the control but have two questions... > >1) How should I write to the serial port with python? I found

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Hi >>> >>>I'd like to use metaclasses to dynamically generate a class based on a >>>parameter to the objects init function. >> >>Do you really need a metaclass for this ? >> >> >>>For example: >>> >>>class Met

Flight search automation

2006-06-23 Thread George Sakkis
I'm trying to use mechanize to fill in a "find a flight" form and then get back the results, but I'm not sure how to make it wait until the results page appears; the response after submitting the form is the "please wait while we are searching for your flights" page. Any ideas ? George -- http:/

Re: * in Python

2006-06-23 Thread Bruno Desthuilliers
placid wrote: > Duncan Booth wrote: > >>placid wrote: >> >> >>>Hi all, >>> >>>Can someone tell me what * in the following code means/does a Google >>>search didnt turn up anything as i dont know what the * is called >>>(related to Python and i dont think Python has pointers) >>> >> >>* is for vari

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Andreas Rossberg
Chris Uppal wrote: >>> >>>Well, it seems to me that you are /assuming/ a notion of what kinds of >>>logic can be called type (theories), and I don't share your >>>assumptions. No offence intended. >> >>OK, but can you point me to any literature on type theory that makes a >>different assumption? >

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Pascal Costanza
Matthias Blume wrote: > Pascal Costanza <[EMAIL PROTECTED]> writes: > >> Patricia Shanahan wrote: >>> Vesa Karvonen wrote: >>> ... An example of a form of informal reasoning that (practically) every programmer does daily is termination analysis. There are type systems that guarante

Re: Specifing arguments type for a function

2006-06-23 Thread Bruno Desthuilliers
George Sakkis wrote: > Dennis Lee Bieber wrote: > >>On 22 Jun 2006 16:48:47 -0700, "George Sakkis" <[EMAIL PROTECTED]> >>declaimed the following in comp.lang.python: >> >> >>>What does __setitem__ have to do with iterability ? >> >> It confirms that the object is indexable, and mutable -- ie;

Re: Specifing arguments type for a function

2006-06-23 Thread Bruno Desthuilliers
George Sakkis wrote: > Dennis Lee Bieber wrote: > >>On 22 Jun 2006 22:55:00 -0700, "George Sakkis" <[EMAIL PROTECTED]> >>declaimed the following in comp.lang.python: >> >> >> >>>Ok, I'll try once more: What does __setitem__ have to do with >>>**iterability**, not mutability or indexability ? I was

Re: embedded Python calling app via COM

2006-06-23 Thread Jim
> Pythoncom.GetActiveObject will retrieve the running instance of the app. Thanks Roger, that does seem to do the trick. I haven't tested to see what happens if there are two instances of the app running, I'm hoping it will return the frontmost visible one. -- Jim -- http://mail.python.org/m

Re: Flight search automation

2006-06-23 Thread mkPyVS
Is there an http page redirect call to the client once the java releases it's wait que? George Sakkis wrote: > I'm trying to use mechanize to fill in a "find a flight" form and then > get back the results, but I'm not sure how to make it wait until the > results page appears; the response after su

Re: code is data

2006-06-23 Thread Bruno Desthuilliers
Anton Vredegoor wrote: (snip) > However, I knew of the existence of such languages but I am mostly > interested in standardized code interchange, like for example with JSONP > which fetches some external javascriptcode from another server using > JSON and places the translated javascript into a we

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread J�rgen Exner
Vesa Karvonen wrote: > In comp.lang.functional Anton van Straaten <[EMAIL PROTECTED]> > wrote: [...] >> I reject this comparison. There's much more to it than that. The > > I think that we're finally getting to the bottom of things. While > reading your reponses something became very clear to me

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Carl Banks
[EMAIL PROTECTED] wrote: > Hi > > I'd like to use metaclasses to dynamically generate a class based on a > parameter to the objects init function. > > For example: > > class MetaThing(type): > def __init__(cls, name, bases, dict, extra_information): > super(MetaThing, cls).__init__(name

hard to explain for a french ;-)

2006-06-23 Thread AZAIS Bruce
Title: Message hi everybody,   i have a problem with a script. after a research with my directory, i want to do a popup of a person's photo but i don't know the syntax (i'm a newbie) :   with a _javascript_ : Popup don't work   with the function window.open : Popupintranet/nom_agents/'+re

what exceptions may file() and read() throw?

2006-06-23 Thread Daniel Sch
Hello, currently I am using this instance method def getFilecontent(self, filename): try: return file(filename).read() except IOError, err_msg: print err_msg sys.exit(1)

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Patricia Shanahan
Pascal Costanza wrote: > Matthias Blume wrote: >> Pascal Costanza <[EMAIL PROTECTED]> writes: >> >>> Patricia Shanahan wrote: Vesa Karvonen wrote: ... > An example of a form of informal reasoning that (practically) every > programmer does daily is termination analysis. There are

Re: * in Python

2006-06-23 Thread Duncan Booth
Bruno Desthuilliers wrote: >> so * basically means that args is a list > > A tuple IIRC In a function definition * means that any remaining position arguments will be passed in as a tuple. In a function call the * means that any sequence will be unpacked as positional arguments: it doesn't hav

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Carl Banks
[EMAIL PROTECTED] wrote: > The extra_information is used in MetaThing to tell it what attributes > to add to the class. For example: > > class MetaThing(type): > def __init__(cls, name, bases, dict, extra_information): > super(MetaThing, cls).__init__(name, bases, dict) > #se

Re: * in Python

2006-06-23 Thread placid
Bruno Desthuilliers wrote: > placid wrote: > > Duncan Booth wrote: > > > >>placid wrote: > >> > >> > >>>Hi all, > >>> > >>>Can someone tell me what * in the following code means/does a Google > >>>search didnt turn up anything as i dont know what the * is called > >>>(related to Python and i dont

Re: what exceptions may file() and read() throw?

2006-06-23 Thread Duncan Booth
Daniel Schüle wrote: > Hello, > > currently I am using this instance method > > def getFilecontent(self, filename): > try: > return file(filename).read() > except IOError, err_msg: > print err_msg >

Re: re question

2006-06-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Daniel Schüle wrote: > this is the pattern > > pattern = > re.compile(r'^\s*package\s+(?P\w+)\s+is\s+(?P.*?)\s+end(\s+package)?(\s+(?P=name))?\s*;', > > re.DOTALL | re.MULTILINE | re.IGNORECASE) > > and the problem is that > package TEST is xyz end; > works but >

Re: * in Python

2006-06-23 Thread Duncan Booth
placid wrote: > i did try it in a Python shell after i learnt what it was. Like i said > *args will be a list, but when i try **args with the following code it > doesnt work > > def test(**args): > keys = args.keys() > for key in keys: > print key+"="+args(key) > When you post

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Matthias Blume
Pascal Costanza <[EMAIL PROTECTED]> writes: > Matthias Blume wrote: >> Pascal Costanza <[EMAIL PROTECTED]> writes: >> >>> Patricia Shanahan wrote: Vesa Karvonen wrote: ... > An example of a form of informal reasoning that (practically) every > programmer does daily is terminatio

Re: Flight search automation

2006-06-23 Thread George Sakkis
mkPyVS wrote: > Is there an http page redirect call to the client once the java > releases it's wait que? Sorry, I've no idea.. not even sure if they use java or whether this matters. Can you guess by trying, say, http://www.travelocity.com/ ? Expedia and Orbitz have also a waiting page, hopefull

Re: what exceptions may file() and read() throw?

2006-06-23 Thread Daniel Sch
Hi > You can't easily list the exceptions that your code could throw. There are > some obvious ones apart from IOError: say filename was an int (or even > certain strings) you would get TypeError, or you might get MemoryError or > KeyboardInterrupt. More obscurely, if you reused file as a global v

Re: * in Python

2006-06-23 Thread Bruno Desthuilliers
Duncan Booth wrote: > Bruno Desthuilliers wrote: > > >>>so * basically means that args is a list >> >>A tuple IIRC > > > In a function definition * means that any remaining position arguments will > be passed in as a tuple. In a function call the * means that any sequence > will be unpacked a

Re: * in Python

2006-06-23 Thread Bruno Desthuilliers
placid wrote: > Bruno Desthuilliers wrote: > (snip) >>Why don't you try by yourself in the Python shell ? One of the nice >>things with Python is that it's quite easy to explore and experiment. > > > i did try it in a Python shell after i learnt what it was. Like i said > *args will be a list,

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Pascal Costanza
Patricia Shanahan wrote: > Pascal Costanza wrote: >> Matthias Blume wrote: >>> Pascal Costanza <[EMAIL PROTECTED]> writes: >>> Patricia Shanahan wrote: > Vesa Karvonen wrote: > ... >> An example of a form of informal reasoning that (practically) every >> programmer does daily i

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Maric Michaud
Le Vendredi 23 Juin 2006 16:03, Carl Banks a écrit : > Don't follow?  The actual source code won't be much easier.  Here's an > example. > >     class MetaThing(type): >         def __new__(metacls,name,bases,clsdict,extra_information): >             # use extra_information >             return typ

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Alex Martelli
Carl Banks <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > The extra_information is used in MetaThing to tell it what attributes > > to add to the class. For example: > > > > class MetaThing(type): > > def __init__(cls, name, bases, dict, extra_information): > > super(MetaT

Re: what exceptions may file() and read() throw?

2006-06-23 Thread Bruno Desthuilliers
Daniel Schüle wrote: > Hi > > >>You can't easily list the exceptions that your code could throw. There are >>some obvious ones apart from IOError: say filename was an int (or even >>certain strings) you would get TypeError, or you might get MemoryError or >>KeyboardInterrupt. More obscurely, if y

Re: Using metaclassed to dynamically generate a class based on a parameter to the objects init function.

2006-06-23 Thread Maric Michaud
Le Vendredi 23 Juin 2006 17:09, Maric Michaud a écrit : > Hmmm, rigourously speaking, metaclasses in OOP are classes whose instances > are class. Ooops, sorry i didn't notice you were calling type's __new__ (and not object'sone). -- _ Maric Michaud _ Aristote - www.ari

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Chris Smith
Patricia Shanahan <[EMAIL PROTECTED]> wrote: > Vesa Karvonen wrote: > ... > > An example of a form of informal reasoning that (practically) every > > programmer does daily is termination analysis. There are type systems > > that guarantee termination, but I think that is fair to say that it is not

Re: Absolute noob to Linux programming needs language choice help

2006-06-23 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Hey guys, > > I am absolutely new to Linux programming, with no w##s programming > experience except a small amount of C++ console apps. > Reasonably new to Linux, BSD etc, got good sound networking base of > knowledge and dont have any problem working the command

Re: re question

2006-06-23 Thread Daniel Sch
Hi [...] hm, that's wired I just tried it in python shell and it works but same code as script file fails for anyone who want to see for himself # package.vhd file bash % cat package.vhd library ieee; use ieee.std_logic_1164.all; package TEST123 is constant BASE End Package Test; #

Re: String negative indices?

2006-06-23 Thread Steven D'Aprano
On Fri, 23 Jun 2006 02:17:39 -0700, Filip Wasilewski 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,

Re: what exceptions may file() and read() throw?

2006-06-23 Thread [EMAIL PROTECTED]
Daniel Schüle wrote: > Hello, > > currently I am using this instance method > > def getFilecontent(self, filename): > try: > return file(filename).read() > except IOError, err_msg: > print err_msg >

Re: Network Programming in Python

2006-06-23 Thread Grant Edwards
On 2006-06-23, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How will Pyon help my cause ? What's Pyon? -- Grant Edwards grante Yow! We are now enjoying at total mutual interaction in

Python profiler and decorators

2006-06-23 Thread warspir
HiI was wondering about this while working on profiling my program using the profile module.Say we have the following:@decdef func: blah blah blahWhen profiling the whole program, what would the total time for func represent? The time spent just in the original function or the time spent spent

Python in HTML

2006-06-23 Thread brochu121
Does anyone know of a way to embed python scripts into html, much like you would javascript or php? I do not want to use this to connect to a database, but rather for a functional script to be called when a user clicks on a link to open a page. -- http://mail.python.org/mailman/listinfo/python-li

Re: Python in HTML

2006-06-23 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Does anyone know of a way to embed python scripts into html, much like > you would javascript or php? I think you'd better learn the profound difference between client-side and server-side scripting. > I do not want to use this to connect to a > database, but rather fo

Opening a file with system default application

2006-06-23 Thread [EMAIL PROTECTED]
I'm writing a GUI application in Jython which takes a database text file and performs some operations on the data, finally spitting out a group of CSV files. I generate a log file and several CSV files and I thought it would be helpful if I could add a button the user could click on to automatical

Re: Python in HTML

2006-06-23 Thread [EMAIL PROTECTED]
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > > Does anyone know of a way to embed python scripts into html, much like > > you would javascript or php? > > I think you'd better learn the profound difference between client-side > and server-side scripting. Indeed. You really should Google

Re: Saying "latently-typed language" is making a category mistake

2006-06-23 Thread Chris Smith
Vesa Karvonen <[EMAIL PROTECTED]> wrote: > I think that we're finally getting to the bottom of things. While reading > your reponses something became very clear to me: latent-typing and latent- > types are not a property of languages. Latent-typing, also known as > informal reasoning, is somethin

  1   2   3   >