Re: os.access with wildcards

2005-10-07 Thread mike
thanks Leif. poor question on my part. I had been using glob.glob(path)==[] and was looking for something more readable, hence os.system('[ -e %s ]' % path ) but that doesn't seem like a good idiom for crossplatform. I thought there may either be a way to escape the wildcards, or an

Re: os.access with wildcards

2005-10-07 Thread mike
thanks Leif. poor question on my part. I had been using glob.glob(path)==[] and was looking for something more readable, hence os.system('[ -e %s ]' % path ) but that doesn't seem like a good idiom for crossplatform. I thought there may either be a way to escape the wildcards, or an

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Antoon Pardon
Op 2005-10-06, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> Suppose we have a typesystem which has the type ANY, which would mean >> such an object could be any type. You could then have homogenous lists >> in the sense that all elements should be of the same declared type and >> at the same ti

Re: non descriptive error

2005-10-07 Thread Terry Hancock
On Thursday 06 October 2005 11:57 pm, Timothy Smith wrote: > i try to run my app and i get this > > %python DutyShift.py > error > > thats it. thats the error. mya pp was previously working, and i did make > some fairly large changes to it, but i'd expect a more descriptive > message then just

Re: where to find information about errors/exceptions in socket.py

2005-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Version of python: 2.4 > O/S: Win2K > > I will be writing some python scripts to do some client-side > programming that involves socket.py. I expect that I will be making > calls to the following methods/functions: > > connect_ex() > setsockopt() > sendall() > recv() >

Can't extend function type

2005-10-07 Thread Paul Rubin
Oh well. I had wanted to be able to define two functions f and g, and have f*g be the composition of f and g. >>> func_type = type(lambda: None) >>> class composable_function(func_type): ... def __mult__(f,g): ... def c(*args, **kw): ... return f(g(*args, **kw))

Re: non descriptive error

2005-10-07 Thread [EMAIL PROTECTED]
You should tell us more about DutyShift.py, without the code it is very difficult for other people to guess what's going on. -- http://mail.python.org/mailman/listinfo/python-list

ANN: MathDOM 0.5.0 - MathML in Python

2005-10-07 Thread Stefan Behnel
Hi everyone, MathDOM 0.5 is ready for download from SourceForge. http://mathdom.sourceforge.net/ MathDOM is a set of Python modules (using PyXML and pyparsing) that import mathematical terms as a Content MathML DOM. It currently parses MathML and literal infix terms into a DOM and writes out Mat

Re: non descriptive error

2005-10-07 Thread Steve Holden
Timothy Smith wrote: > i try to run my app and i get this > > %python DutyShift.py > error > > > thats it. thats the error. mya pp was previously working, and i did make > some fairly large changes to it, but i'd expect a more descriptive > message then just "error". anyidea where i need to st

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Steve Holden
Antoon Pardon wrote: > Op 2005-10-06, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: > >>>Suppose we have a typesystem which has the type ANY, which would mean >>>such an object could be any type. You could then have homogenous lists >>>in the sense that all elements should be of the same declared

Re: Python, alligator kill each other

2005-10-07 Thread Duncan Booth
infidel wrote: > A 13-foot Burmese python recently burst after it apparently tried to > swallow a live 6-foot alligator whole, authorities said. > An allegory telling how Python the language really ought to stay slim and lean and not get bloated by incorporating lots of features from other langu

Re: PyObject_New

2005-10-07 Thread Martin v. Löwis
Jeremy Moles wrote: > PyObject* obj = _PyObject_New(&PyType_MyType); > obj = PyObject_Init(obj, &PyType_MyType); > > ... > > return obj; The call to PyObject_Init is redundant: _PyObject_New is malloc+init. However, this shouldn't cause any crashes (except in the de

Re: Controlling who can run an executable

2005-10-07 Thread Magnus Lycka
Cigar wrote: > What I want: > - the simplest thing that could possibly work! A splash screen that informs the user that it's confidential data, and that unauthorized use will lead to prosecution? Besides, I think it's not the program you need to protect, but the data. Think about that. Who cares

Re: semi-newbie module namespace confusion

2005-10-07 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > The main jist of the problem is that I'm trying add data from one > module to a list and a dictionary in another module, and it doesn't > seem to stick over there. It's probably best to avoid any circular depentencies, but as long as you make sure you really use your mod

Re: Python, alligator kill each other

2005-10-07 Thread Roel Schroeven
infidel wrote: > By Denise Kalette > Associated Press > > MIAMI - The alligator has some foreign competition at the top of the > Everglades food chain, and the results of the struggle are horror-movie > messy. > > A 13-foot Burmese python recently burst after it apparently tried to > swallow a li

Re: dcop module under Python 2.4

2005-10-07 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi all, > at the end I upgraded to 2.4, but now I am not able to load dcop module > (part of the Python-KDE3 bindings). > Any help? Install PyKDE for 2.4 Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > In other words, you want Python to be strongly-typed, but sometimes > you want to allow a reference to be to any object whatsoever. In which > case you can't possibly do any sensible type-checking on it, so this > new Python+ or whatever you want to call i

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Steve Holden
DaveM wrote: > On Fri, 07 Oct 2005 00:33:43 -, Grant Edwards <[EMAIL PROTECTED]> wrote: [...] > >>For example: In British English one uses a plural verb when the >>subject consists of more than one person. Sports teams, >>government departments, states, corporations etc. are >>grammatically

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Brian Quinlan
Paul Rubin wrote: > Brian Quinlan <[EMAIL PROTECTED]> writes: > >>Without a clear idea of the nature of the proposal, it is impossible >>to assess it's costs and benefits. So could a proponent of optional >>declarations please provide a more clear proposal? > > > There is no proposal on the tabl

Re: Can't extend function type

2005-10-07 Thread Diez B. Roggisch
Paul Rubin wrote: > Oh well. I had wanted to be able to define two functions f and g, and > have f*g be the composition of f and g. > > >>> func_type = type(lambda: None) > >>> class composable_function(func_type): > ... def __mult__(f,g): > ... def c(*args, **kw): > ...

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Steve Holden
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >>In other words, you want Python to be strongly-typed, but sometimes >>you want to allow a reference to be to any object whatsoever. In which >>case you can't possibly do any sensible type-checking on it, so this >>new Python+ or what

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Paul Rubin
Brian Quinlan <[EMAIL PROTECTED]> writes: > > There is no proposal on the table. There's a discussion of how this > > stuff can work, and whether it's useful. As for how the compiler > > deals with imported modules, see for example Common Lisp or Haskell or > > ML--how do they do it? > > Except

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
> Why do you call this a JAVA Object or C void*? Why don't you call > it a PYTHON object. It is this kind of reaction that IMO tells most > opponents can't think outside the typesystems they have already > seen and project the problems with those type systems on what > would happen with python shou

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
Paul Rubin wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >>In other words, you want Python to be strongly-typed, but sometimes >>you want to allow a reference to be to any object whatsoever. In which >>case you can't possibly do any sensible type-checking on it, so this >>new Python+ or what

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Ben Sizer
Paul Rubin wrote: > Let's see if I understand what you're saying: > > C and Java: you get useful type checking except when you declare > a reference as type ANY. This is a shortcoming compared to: > > Python: where you get no useful type checking at all. > > That is not very convinci

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Robin Becker
As mentioned earlier only a dictator can make such decisions and of course as with many dictatorships the wrong decision is often made. There's no such thing as a benevolent dictatorship. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: os.access with wildcards

2005-10-07 Thread Fredrik Lundh
Leif K-Brooks wrote: >>os.access(path,mode) >> >> where path may contain linux style wildcards. > > os.access(glob.glob(path), mode) Traceback (most recent call last): File "", line 1, in ? TypeError: access() argument 1 must be string, not list it's not clear from the OP if he wants

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Roy Smith
"Ben Sizer" <[EMAIL PROTECTED]> wrote: > It's started to get very misleading - Python gives you plenty of > type-checking, as we all know, just not at compile-time. There's more to it than just that. Python's type checking is not just not done at compile time, it's done as late in run time as po

Re: non descriptive error

2005-10-07 Thread Tomasz Lisowski
Timothy Smith wrote: > i try to run my app and i get this > > %python DutyShift.py > error > > > thats it. thats the error. mya pp was previously working, and i did make > some fairly large changes to it, but i'd expect a more descriptive > message then just "error". anyidea where i need to st

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Antoon Pardon
Op 2005-10-07, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Op 2005-10-06, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> Suppose we have a typesystem which has the type ANY, which would mean such an object could be any type. You could then have homogenous lists >>

Re: Question

2005-10-07 Thread contact
Hi, this email address does not exist. Please go to the site and use the correct form to send your message. No one has seen this message. Thanks Matchfinder -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Steven D'Aprano
On Fri, 07 Oct 2005 06:01:00 -0400, Roy Smith wrote: > There's more to it than just that. Python's type checking is not just not > done at compile time, it's done as late in run time as possible. One might > call it just-in-time type checking. Well there you go then. Instead of pulling our ha

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Christophe
Roy Smith a écrit : > There's more to it than just that. Python's type checking is not just not > done at compile time, it's done as late in run time as possible. One might > call it just-in-time type checking. It's more of a "Nearly too late" type checking I would say. Not that I complain bu

Re: New Python book

2005-10-07 Thread Maurice LING
I had the opportunity to glance through the book in Borders yesterday. On the whole, I think it is well covered and is very readable. Perhaps I was looking for a specific aspect, and I find that threads did not get enough attention. Looking at the index pages, the topics on threads (about 4-5 p

Re: check html file size

2005-10-07 Thread Xah Lee
Xah Lee wrote: « would anyone like to translate the following perl script to Python or Scheme (scsh)?» Here's the Python version. # -*- coding: utf-8 -*- # Python # Wed Oct 5 15:50:31 PDT 2005 # given a dir, report all html file's size. (counting inline images) # XahLee.org import re, os.path

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Fredrik Lundh
"Christophe" wrote: > It's more of a "Nearly too late" type checking I would say. Not that I > complain but it would be great if there were also some automatic type > checking to catch a few errors as soon as possible. use assert as the soonest possible point. implementing "type gates" is trivia

recursive function

2005-10-07 Thread mg
Hello, In a recursive function like the following : def foo( j ) : j += 1 while j < n : j = foo( j ) return j in found that the recursivity is limited (1000 iterations). Then, I have two questions : - why this mecanism has been implemented ? - it is possible to increase or remove (and h

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Antoon Pardon
Op 2005-10-07, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> Why do you call this a JAVA Object or C void*? Why don't you call >> it a PYTHON object. It is this kind of reaction that IMO tells most >> opponents can't think outside the typesystems they have already >> seen and project the problem

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Steven D'Aprano
On Fri, 07 Oct 2005 09:01:21 +0100, Steve Holden wrote: > and yes, I split that infinitive just to > annoy any pedants who may be reading *Real* pedants will know that English is not Latin, does not follow the grammatical rules of Latin, and that just because split infinitives are impossible --

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Christophe
Fredrik Lundh a écrit : > "Christophe" wrote: > > >>It's more of a "Nearly too late" type checking I would say. Not that I >>complain but it would be great if there were also some automatic type >>checking to catch a few errors as soon as possible. > > > use assert as the soonest possible point

Re: py2exe 0.6.3 released

2005-10-07 Thread could ildg
Nice job~Thank you.On 10/7/05, Jimmy Retzlaff <[EMAIL PROTECTED]> wrote: py2exe 0.6.3 released=py2exe is a Python distutils extension which converts Python scriptsinto executable Windows programs, able to run without requiring aPython installation. Console and Windows (GUI) appl

Re: recursive function

2005-10-07 Thread Juho Schultz
mg wrote: > Hello, > > In a recursive function like the following : > > > def foo( j ) : > j += 1 > while j < n : j = foo( j ) > return j > > > in found that the recursivity is limited (1000 iterations). Then, I have > two questions : > - why this mecanism has been implemented ? > - it is

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Richie Hindle
[Steve] > and yes, I split that infinitive just to > annoy any pedants who may be reading [Steven] > *Real* pedants will know that English is not Latin, does not follow the > grammatical rules of Latin, and that just because split infinitives are > impossible -- not forbidden, impossible -- in L

Re: recursive function

2005-10-07 Thread Brandon K
Is there no way to implement your idea in a classical loop? Usually the syntax is cleaner, and there is no limit (except the limit of the range function in certain cases). For example what would be wrong with. def foo(j): while j < n: j+=1 return j I don't know much about th

Re: recursive function

2005-10-07 Thread Brandon K
> def foo(j): > while j < n: > j+=1 > return j > of course I mean: def foo(j): while j < n: j+=1 return j sorry == Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups == Get Anonymous, Uncensored, Access to West and East Coast Server Fa

Re: divide

2005-10-07 Thread Andrew Gwozdziewycz
Do the divisions have to be themselves rectangles? xB_C___x x_Ax would be a representation of the problem? However, though, I think that what you mean with your Points being smaller and

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > use assert as the soonest possible point. implementing "type gates" is > trivial, if you think you need them. What this is about (to me at least) is the edit-debug cycle. Let's say I write some Python code, using assert to validate datatypes. Maybe I

Re: New Python book

2005-10-07 Thread Jeremy Jones
Maurice LING wrote: >I had the opportunity to glance through the book in Borders yesterday. >On the whole, I think it is well covered and is very readable. Perhaps I >was looking for a specific aspect, and I find that threads did not get >enough attention. Looking at the index pages, the topics

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
Antoon Pardon wrote: > Then argue against my ideas, and not your makings of it. > > If I just use 'ANY' and you fill that in with C void* like > implementation and argue against that, then you are arguing > against your own ghosts, but not against what I have in mind. Well, you didn't tell us wha

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Steven D'Aprano
On Thu, 06 Oct 2005 21:03:33 -0700, barnesc wrote: > I added some recipes to the Python Cookbook: > > - listmixin > >Use ListMixin to create custom list classes from a small subset of >list methods: > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440656 That looks great

Python interpreter bug

2005-10-07 Thread alainpoint
Hello, I came accross what i think is a serious bug in the python interpreter. Membership testing seems not to work for list of objects when these objects have a user-defined __cmp__ method. It is present in Python 2.3 and 2.4. I don't know about other versions. The following code illustrates the

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Michele Simionato
Well, suppose you have a class MyObject and you want to add to it some methods to make its instances into a database. You could put these methods into another class called Storable (the mixin class). Then you can mix MyObject with Storable and get what you want, a class StorableObject inheriting bo

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
> It is not about falling back on generic declarartion, it is about > how such object will be treated. Diez seems to think that > strongly-typed language can only deal with generic declarations > by using something that allows circumventing the type system. No, I don't - now it's you who makes ass

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Roy Smith
Paul Rubin wrote: > What this is about (to me at least) is the edit-debug cycle. Let's > say I write some Python code, using assert to validate datatypes. > Maybe I've made 4 errors. I then write a test function and run it. > Boom, the first assert fails. I fix the fir

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > That looks great. Now, if only I understood mixins: what are they, and > what they are for, and in particular, how they differ from mere > subclassing. I'm not sure what you mean by "mere subclassing" so maybe there is no difference. Mixins are sort o

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
> Now some of the Python-is-perfect crowd seems to suffer from a "Blub > paradox" (http://c2.com/cgi/wiki?BlubParadox). They see annoying, > static typed languages like C and Java, and they see pleasant, > dynamically typed languages like Python, and conclude that static > types = annoying, when i

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Paul Rubin
"Michele Simionato" <[EMAIL PROTECTED]> writes: > Once in a time, I thought mixins where a good idea; now I don't think > so since they are too easily abused (see Zope 2) and as a consequence > you get spaghetti-inheritance, where you have objects with methods > inherited from everywhere. So be ver

CSV like file format featured recently in Daily Python URL?

2005-10-07 Thread Alex Willmer
I'm trying to track down the name of a file format and python module, that was featured in the Daily Python URL some time in the last month or two. The format was ASCII with a multiline header defining types for the comma seperated column data below. It may have had the capability to store multipl

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > - FPs share their own set of problems - try writing a server. The > have inherent troubles with event-driven programs. Erlang? > Still, FP is cool. But python too. And just attaching some > type-inference to python won't work. Yeah, I've figured

Re: Continuous system simulation in Python

2005-10-07 Thread François Pinard
[Robert Kern] > [...] an ODE integrator would probably want to adaptively select its > timesteps as opposed to laying out a uniform discretization upfront. Eons ago, I gave myself such a little beast (but really found in an Appendix of a book on simulation), which I use since then whenever I need

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Steven D'Aprano
On Fri, 07 Oct 2005 05:11:00 -0700, Michele Simionato wrote: > Well, suppose you have a class MyObject and you want to add to it some > methods to make its instances into a database. You could put these > methods into another class called Storable (the mixin class). > Then you can mix MyObject wit

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > - FPs share their own set of problems - try writing a server. The > > have inherent troubles with event-driven programs. > > Erlang? Guess what, worked with that, too :) And let me assure you - it does have pretty much runtim

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Steve Holden
Richie Hindle wrote: > [Steve] > >>and yes, I split that infinitive just to >>annoy any pedants who may be reading > > > [Steven] > >>*Real* pedants will know that English is not Latin, does not follow the >>grammatical rules of Latin, and that just because split infinitives are >>impossible -

Re: Can Python replace TCL/Expect

2005-10-07 Thread Jorgen Grahn
On Thu, 06 Oct 2005 17:08:03 GMT, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Jorgen Grahn <[EMAIL PROTECTED]> wrote: > . > . > . >>It depends. I do not feel /that/ advanced, but I've been bitten by

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 06 Oct 2005 21:03:33 -0700, barnesc wrote: >> I added some recipes to the Python Cookbook: >> >> - listmixin >> >>Use ListMixin to create custom list classes from a small subset of >>list methods: >> >>http://aspn.activestate.com

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread Michele Simionato
Paul Rubin wrote: > Yeah, I wonder though how much of that is a result of Python's > cavalier approach to multiple inheritance. Does that happen much in > CLOS? In Java because of multiple interfaces? I've studied Flavors a > little and mix-ins were used in some extensive ways, but maybe > progr

Re: Can't extend function type

2005-10-07 Thread Christopher Subich
Diez B. Roggisch wrote: > Paul Rubin wrote: > >> Oh well. I had wanted to be able to define two functions f and g, and >> have f*g be the composition of f and g. >> >> >>> func_type = type(lambda: None) >> >>> class composable_function(func_type): >> ... def __mult__(f,g): >> ..

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Steve Holden
Christophe wrote: > Fredrik Lundh a écrit : > >>"Christophe" wrote: >> >> >> >>>It's more of a "Nearly too late" type checking I would say. Not that I >>>complain but it would be great if there were also some automatic type >>>checking to catch a few errors as soon as possible. >> >> >>use assert

BayPIGgies: October 13, 7:30pm (IronPort)

2005-10-07 Thread Aahz
The next meeting of BayPIGgies will be Thurs, October 13 at 7:30pm at IronPort. Tim Thompson will describe and demonstrate the interaction between Burning Man and Python using two applications, Radio Free Quasar and Ergo. BayPIGgies meetings alternate between IronPort (San Bruno, California) and

Re: Simple prototype text editor in python

2005-10-07 Thread thakadu
Thanks for everyones advice. I finally went for a very basic BSD style template that I found somewhere. Its really short and easy to understand, at least to me! -- http://mail.python.org/mailman/listinfo/python-list

Re: Book "Python and Tkinter Programming"

2005-10-07 Thread projecktzero
striker wrote: > Does anyone who has this book willing to sell it. Please e-mail me the > condition and any other details if you are interested. > Thanks, > Kevin half.com has a couple of people selling it. One for $35.24 and another for $129.97. -- http://mail.python.org/mailman/listinfo/pyth

How to run python scripts with IDLE

2005-10-07 Thread vyzasatya
Hi all, My problem is # I have to run a script which takes a command line parameter which is unicode text # I cant use Windows console as it doesnt support /display unicode # I dont seems to find a way to pass command line arguments to scripts in IDLE. Please suggest me what I can do. Thanks in Adv

Re: Continuous system simulation in Python

2005-10-07 Thread Robert Kern
François Pinard wrote: > [Robert Kern] > >>[...] an ODE integrator would probably want to adaptively select its >>timesteps as opposed to laying out a uniform discretization upfront. > > Eons ago, I gave myself such a little beast (but really found in an > Appendix of a book on simulation), which

Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread barnesc
>So mixins are just a sub-class [pun intended] of sub-classing? > >I've just found this: > >[quote] >A mixin class is a parent class that is inherited from - but not as >a means of specialization. Typically, the mixin will export services to a >child class, but no semantics will be implied about t

Re: Python interpreter bug

2005-10-07 Thread Simon Percivall
Why would it be a bug? You've made it so that every instance of OBJ is equal to every other instance of OBJ. The behaviour is as expected. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interpreter bug

2005-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hello, > > I came accross what i think is a serious bug in the python interpreter. > > Membership testing seems not to work for list of objects when these > objects have a user-defined __cmp__ method. > It is present in Python 2.3 and 2.4. I don't know about other versi

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-07 Thread George Sakkis
"Lasse Vågsæther Karlsen" <[EMAIL PROTECTED]> wrote: > Ok, that one looks more sleak than what I came up with. For the most efficient and elegant solution, check out Raymond Hettinger's reply to: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/141934 George -- http://mail.python.org

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Antoon Pardon
Op 2005-10-07, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: > > Antoon Pardon wrote: >> Then argue against my ideas, and not your makings of it. >> >> If I just use 'ANY' and you fill that in with C void* like >> implementation and argue against that, then you are arguing >> against your own ghost

Re: Python interpreter bug

2005-10-07 Thread alainpoint
There is definitely a bug. Maybe the follownig snippet is more clear: class OBJ: def __init__(self,identifier): self.id=identifier self.allocated=0 #def __cmp__(self,other): # return cmp(other.allocated,self.allocated) mylist=[OBJ(i) for

Re: Merging sorted lists/iterators/generators into one stream of values...

2005-10-07 Thread Lasse Vågsæther Karlsen
Thanks, that looks like Mike's solution except that it uses the built-in heapq module. While this one contains less code than Mike's solution it seems to lack the ability to control the comparison operation, which means it won't work in my case. I need to both be able to sort on an arbitrary field

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > Erlang? > > Guess what, worked with that, too :) And let me assure you - it does > have pretty much runtime type error issues. It's interpreted. Yes, it makes no attempt at being statically typed. It's like Python that way, AFAIK. > Easy cases

Python 2nd favorite language in Linux Journal poll

2005-10-07 Thread beliavsky
Linux Journal annually polls its readers on questions such as their favorite programming language. In the 2005 poll, Python is 2nd, its highest ranking ever. Below are the results by year. I wish that rankings beyond the first 3 were available and that the number of votes were shown. Nerds like num

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I came accross what i think is a serious bug in the python interpreter. > Membership testing seems not to work for list of objects when these > objects have a user-defined __cmp__ method. it does not work if they have *your* __cmp__ method, no. if you add a print stat

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Richie Hindle
[Richie] > Your previous post to this thread was chock-full of split nominatives: "The > Hollywood voice", "the specific regional accent", "the English-speaking > world", "the original French". And you call yourself a grammarian. [Steve] > I am presuming this post was meant to be a joke? It was

Re: Python interpreter bug

2005-10-07 Thread alainpoint
Sorry Fredrik but I don't understand. Just comment out the assert and you have different results depending on whether an unrelated sort function is defined. This seems weird to me ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't extend function type

2005-10-07 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Well - function inheritance is not known so far in python - and in no > other language I know. Yeah, I didn't really expect it to work, but it seems like a logical consequence of type/class unification. > Basically you want __mult__ being part of f

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-07 Thread Eric Nieuwland
Robin Becker wrote: > As mentioned earlier only a dictator can make such decisions and of > course as > with many dictatorships the wrong decision is often made. There's no > such thing > as a benevolent dictatorship. Ever cared to check what committees can do to a language ;-) --eric -- htt

Re: Python recipes: list mixin, improved timeit, etc

2005-10-07 Thread George Sakkis
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > I've just found this: > > [quote] > A mixin class is a parent class that is inherited from - but not as > a means of specialization. Typically, the mixin will export services to a > child class, but no semantics will be implied about the child "being

Re: Python interpreter bug

2005-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Sorry Fredrik but I don't understand. Just comment out the assert and > you have different results depending on whether an unrelated sort > function is defined. > This seems weird to me ! > Perhaps you don't understand what's going on. The test obj in excluded is

Re: Can't extend function type

2005-10-07 Thread Michele Simionato
If you google a bit on the newsgroup, you should find a message from me asking about the ability to subclass FunctionType, and a reply from Tim Peters saying that the only reason why this was not done is lack of developer time and the fact that this was not considered an important priority.

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Diez B. Roggisch
> > You just said "let's > > introduce something like any". I showed you existing implementations of > > such a concept that have problems. > > But as far as I can see that is a problem of the implementation > not necessarily of the concept. Without any concept, sure there can't be problems with

Re: Python interpreter bug

2005-10-07 Thread alainpoint
I understand this, Steve. I thought the _cmp_ method was a helper for sorting purposes. Why is it that a membership test needs to call the __cmp__ method? If this isn't a bug, it is at least unexpected in my eyes. Maybe a candidate for inclusion in the FAQ? Thank you for answering Alain -- http:/

Re: Lambda evaluation

2005-10-07 Thread Eric Nieuwland
Joshua Ginsberg wrote: > Try this one: > d = {} for x in [1,2,3]: > ... d[x] = lambda *args: args[0]*x > ... d[1](3) try it with: d[x] = (lambda x=x: (lambda *args: args[0]*x))() the outer lambda fixes the value of x and produces the inner lambda with the fixed x value

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Sorry Fredrik but I don't understand. Just comment out the assert and > you have different results depending on whether an unrelated sort > function is defined. > > This seems weird to me ! not if you look at what it prints. (if it seems weird to you that 0 equals 0, i

Re: in-memory db? gadfly?

2005-10-07 Thread chris
sqlite worked perfectly, thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Rocco Moretti
Steve Holden wrote: >> On Fri, 07 Oct 2005 00:33:43 -, Grant Edwards <[EMAIL PROTECTED]> >> wrote: >>> For example: In British English one uses a plural verb when the >>> subject consists of more than one person. Sports teams, >>> government departments, states, corporations etc. are gramma

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-10-07 Thread Grant Edwards
On 2005-10-07, DaveM <[EMAIL PROTECTED]> wrote: >>For example: In British English one uses a plural verb when the >>subject consists of more than one person. Sports teams, >>government departments, states, corporations etc. are >>grammatically plural. In American, the verb agrees with the >>wor

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
Your __cmp__ method will always return 0, so all objects will be equal when you add the method, as Simon and Steve pointed out. The result is all objects will pass the test of being a member of excluded. If you do not add a __cmp__ method objects will be compared on identy - call the id() function

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
Your __cmp__ method will always return 0, so all objects will be equal when you add the method, as Simon and Steve pointed out. The result is all objects will pass the test of being a member of excluded. If you do not add a __cmp__ method objects will be compared on identy - call the id() function

Re: "no variable or argument declarations are necessary."

2005-10-07 Thread Fredrik Lundh
"Christophe" wrote: > I mean, why not ? Why does the compiler let me do that when you know > perfectly that that code is incorrect : > def f(): > return "a" + 5 probably because the following set is rather small: bugs caused by invalid operations involving only literals, that are not

  1   2   3   >