Re: Parametric Polymorphism

2005-09-26 Thread Kay Schluehr
Catalin Marinas wrote: > Hi, > > Sorry if this was previously discussed but it's something I miss in > Python. I get around this using isinstance() but it would be cleaner > to have separate functions with the same name but different argument > types. I think the idea gets quite close to the Lisp/

Re: Will python never intend to support private, protected and public?

2005-09-28 Thread Kay Schluehr
Steve Holden wrote: > could ildg wrote: > > Python is wonderful except that it has no real private and protected > > properties and methods. > > Every py object has dict so that you can easily find what fields and > > methods an obj has, > > this is very convenient, but because of this, py is very

Re: Moronicity Xha Lee, Jargonizer

2005-09-29 Thread Kay Schluehr
Raymond Hettinger wrote: > James Stroud wrote: > > There needs to be an email filter that, when a thread is begun by a specific > > user . . . it cans every > > message in that thread. > > The tried-and-true solution is both simple and civil, "Don't feed the > trolls." > > > Raymond People like ve

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

2005-10-08 Thread Kay Schluehr
Alex Martelli wrote: > try it (and read the Timbot's article included in Python's sources, and the > sources themselves)... Just a reading advise. The translated PyPy source pypy/objectspace/listsort.py might be more accessible than the corresponding C code. Kay -- http://mail.python.org/mail

Re: How to delete yourself????

2005-10-14 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > Hello, > > > I got a problem deleting objects, which are placed in a hirarchy > > Asume we have the following code: > > class parent: > > MyChilds = [] # this list is filled with childs > > def AddC

Re: object inheritance and default values

2005-10-14 Thread Kay Schluehr
George Sakkis wrote: > "Ron Adam" <[EMAIL PROTECTED]> wrote: > > > I'm trying to implement simple svg style colored complex objects in > > tkinter and want to be able to inherit default values from other > > previously defined objects. > > > > I want to something roughly similar to ... > > > >

Re: can a cut-down Python still be Python?

2005-10-17 Thread Kay Schluehr
The Eternal Squire wrote: > My main question regarding this is: even if I am successful, would the > results be rejected out of hand by y'all as not meeting the Zen of > Python? Have you ever asked a Zen master about Zen? Kay -- http://mail.python.org/mailman/listinfo/python-list

Re: override a property

2005-10-18 Thread Kay Schluehr
Robin Becker wrote: > Is there a way to override a data property in the instance? Do I need to > create > another class with the property changed? > -- > Robin Becker It is possible to decorate a method in a way that it seems like property() respects overridden methods. The decorator cares polymo

Re: override a property

2005-10-20 Thread Kay Schluehr
Robin Becker wrote: > I thought that methods were always overridable. > In this case the lookup on the > class changes the behaviour of the one and only property. How can something be made overridable that is actually overridable? I didn't know how to better express the broken polymorphism of Pyt

Re: override a property

2005-10-22 Thread Kay Schluehr
Robin Becker wrote: > Kay Schluehr wrote: > > Robin Becker wrote: > > > > > >>I thought that methods were always overridable. > >>In this case the lookup on the > >>class changes the behaviour of the one and only property. > > > >

wxListbook layout problem

2005-10-25 Thread Kay Schluehr
Probably some of you know the amazing demo application for wxPython. When you open the Listbook demo in the Core Windows/Contols folder, replace there wx.LB_DEFAULT by wx.LB_RIGHT and resize the main window the listbox on the right side moves into the area of colored panel. This is a surprise to sa

Re: Getting Python Accepted in my Organisation

2005-11-03 Thread Kay Schluehr
Stefan Arentz wrote: > Stuart Turner <[EMAIL PROTECTED]> writes: > > > I'm already using it for a ton of things - I want to try and get broader > > acceptance in the organisation for it to be made and 'officially supported > > product'. > > IMO that is what you need to communicate: 'already using

Re: how to present Python's OO feature in design?

2005-11-06 Thread Kay Schluehr
pcmanlin wrote: > because i have a problem that python's oo feature is so great, but > maybe when the project become larger, python's no-declaration cannot > mapping the design to practice? > > I am not sure about it. As far cartoon-ware ( UML ) is concerned note that it is NOT Pythons non-declara

Re: Proposal for adding symbols within Python

2005-11-17 Thread Kay Schluehr
Steven Bethard wrote: > Pierre Barbier de Reuille wrote: > > Proposal > > > > > > First, I think it would be best to have a syntax to represent symbols. > > Adding some special char before the name is probably a good way to > > achieve that : $open, $close, ... are $ymbols. > > How about

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Kay Schluehr
Fredrik Lundh wrote: > huh? if you want a list, use a list. > > d = [('a', {...}), ('b', {})] If one wants uniform access to a nested data structure like this one usually starts writing a wrapper class. I do not think the requirement is anyhow deeper than a standard wrapper around such a

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Kay Schluehr
Christoph Zwerschke wrote: > That would be also biased (in favour of Python) by the fact that > probably very little people would look for and use the package in the > cheese shop if they were looking for ordered dicts. Does anyone actually use this site? While the Vaults offered a nice place and

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Kay Schluehr
A.M. Kuchling wrote: > On 22 Nov 2005 01:41:44 -0800, > Kay Schluehr <[EMAIL PROTECTED]> wrote: > > Does anyone actually use this site? While the Vaults offered a nice > > place and a nice interface the Cheese Shop has the appeal of a code > > slum. > &g

Re: Application Plugin Framework

2005-11-22 Thread Kay Schluehr
Ron wrote: > Hello, > > I'm attempting to develop a plugin framework for an application that I'm > working on. I wish to develop something in which all plugins exist in a > directory tree. The framework need only be given the root of the tree. The > framework then uses os.path.walk to search al

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Kay Schluehr
Bengt Richter wrote: > On Mon, 21 Nov 2005 01:27:22 +0100, Christoph Zwerschke <[EMAIL PROTECTED]> > wrote: > > >Fredrik Lundh wrote: > >> if you restructure the list somewhat > >> d = ( > >> ('pid', ('Employee ID', 'int')), > >> ('name', ('Employee name', 'varchar')), > >>

Re: Why are there no ordered dictionaries?

2005-11-23 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > Steve Holden wrote: > > Perhaps now the answer top your question is more obvious: there is by no > > means universal agreement on what an "ordered dictionary" should do. > > Given the ease with which Python allows you to implement your chosen > > functionality it would b

Re: user-defined operators: a very modest proposal

2005-11-23 Thread Kay Schluehr
Steve R. Hastings wrote: > It should be possible to define operators using punctuation, > alphanumerics, or both: > > ]+[ > ]add[ > ]outer*[ Seems like you look for advanced source-code editors.Some ideas are around for quite a while e.g. here http://en.wikipedia.org/wiki/Intentional_programming

Re: How to get started in GUI Programming?

2005-11-27 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > I am trying to learn GUI programming in Python, but have to confess I > am finding it difficult. Don't do it if you can prevent it. GUI - toolkits are very complex beasts and at least to me a source of pain far more as a joy. Python cannot help you making them signific

Re: python speed

2005-11-30 Thread Kay Schluehr
Harald Armin Massa wrote: > Dr. Armin Rigo has some mathematical proof, that High Level Languages > like esp. Python are able to be faster than low level code like > Fortran, C or assembly. > > I am not wise enough to understand that proof. > > Maybe I understood those papers totally wrong and he

Python package installing rationale

2005-12-03 Thread Kay Schluehr
In almost any case I install a Python package via distutils some directories in the package tree are left behind e.g. the docs, licenses, tests etc. I wonder if there is some rationale behind this? Should it be left to the "creative freedom" of the user to copy the docs whereever she wants or is th

Re: Lisp development with macros faster than Python development?..

2005-07-08 Thread Kay Schluehr
[EMAIL PROTECTED] schrieb: > I've been reading the beloved Paul Graham's "Hackers and Painters". > He claims he developed a web app at light speed using Lisp and lots > of macros. Yes, Paul is a postmodern hero who reininvents himself and his language every day and with every program: "Experien

Re: f*cking re module

2005-07-08 Thread Kay Schluehr
jwaixs schrieb: > arg... I've lost 1.5 hours of my precious time to try letting re work > correcty. 1.5 hours are not enough for understanding regular expressions. But to be honest: I never had the patience to learn them accurately and I guess I will never do so as well as I don't ever learn sed o

Re: removing list comprehensions in Python 3.0

2005-07-08 Thread Kay Schluehr
Steven Bethard schrieb: > I think the jury's still out on this one: > > * Alex Martelli expects list comprehensions to be removed. [1] > * Robert Kern wants list comprehensions removed. [2] > * Raymond Hettinger encourages continued use of list comprehensions [3] > * Jeremy Bowers thinks list comp

Re: removing list comprehensions in Python 3.0

2005-07-08 Thread Kay Schluehr
Leif K-Brooks schrieb: > Kay Schluehr wrote: > > Well, I want to offer a more radical proposal: why not free squared > > braces from the burden of representing lists at all? It should be > > sufficient to write > > > >>>>list() > > > >

Re: removing list comprehensions in Python 3.0

2005-07-08 Thread Kay Schluehr
Leif K-Brooks schrieb: > Kay Schluehr wrote: > >>>>list.from_str("abc") > > > > list("a", "b", "c" ) > > > I assume we'll also have list.from_list, list.from_tuple, > list.from_genexp, list.from_xrange, etc.? O

Re: Lisp development with macros faster than Python development?..

2005-07-09 Thread Kay Schluehr
Kirk Job Sluder schrieb: > "Kay Schluehr" <[EMAIL PROTECTED]> writes: > > > This might be a great self experience for some "great hackers" but just > > annoying for others who used to work with modular standard librarys and > > think that the b

Hosting Python projects

2005-07-09 Thread Kay Schluehr
Jacob Page schrieb: > I have created what I think may be a useful Python module, but I'd like > to share it with the Python community to get feedback, i.e. if it's > Pythonic. If it's considered useful by Pythonistas, I'll see about > hosting it on Sourceforge or something like that. Is this a go

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Kay Schluehr
Ralf W. Grosse-Kunstleve schrieb: > My initial proposal > (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't > exactly get a warm welcome... Well ... yes ;) Ralf, if you want to modify the class instantiation behaviour you should have a look on metaclasses. That's what they

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Kay Schluehr
> I stripped your code down to the essence. See attachment. > For the user your approach then becomes: > > class grouping: > __metaclass__ = autoattr > def __init__(self, x, y, z): > pass No. This is clearly NOT what I had in mind. I translated your original proposal which introdu

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-10 Thread Kay Schluehr
Dan Sommers schrieb: > How about this: > > def __init__(self, self.x, y, self.z): > # self.x, self.z from first and third explicit parameters > do_something_with_y() Can you tell me in which way it is anyhow better than the original proposal def __init__(self, .x, y, .z)

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-11 Thread Kay Schluehr
Reinhold Birkenfeld schrieb: > Kay Schluehr wrote: > > Dan Sommers schrieb: > > > >> How about this: > >> > >> def __init__(self, self.x, y, self.z): > >> # self.x, self.z from first and third explicit parameters > >>

Re: decorators as generalized pre-binding hooks

2005-07-11 Thread Kay Schluehr
George Sakkis schrieb: > > 1. classes have metaclasses, functions don't have metafunctions. No one > > gave an example for classes not handled at least as well with a metaclass. > > Would something like the following count ? > > @abstractclass > class AbstractFrame(object): > > @abstractclass

Re: decorators as generalized pre-binding hooks

2005-07-11 Thread Kay Schluehr
Christopher Subich schrieb: > Kay Schluehr wrote: > > I think it would be a good idea to pronounce the similarity between > > function decorators and metaclasses. Metaclasses were once introduced > > as an arcane art of fuzzy bearded hackers or supersmart 'enterprise &g

Ordering Products

2005-07-17 Thread Kay Schluehr
Here might be an interesting puzzle for people who like sorting algorithms ( and no I'm not a student anymore and the problem is not a students 'homework' but a particular question associated with a computer algebra system in Python I'm currently developing in my sparetime ). For motivation lets d

Re: Ordering Products

2005-07-17 Thread Kay Schluehr
Diez B.Roggisch wrote: > Kay Schluehr gmx.net> writes: > > > Now lets drop the assumption that a and b commute. More general: let be > > M a set of expressions and X a subset of M where each element of X > > commutes with each element of M: how can a product with fa

Re: Ordering Products

2005-07-17 Thread Kay Schluehr
Ron Adam wrote: > Kay Schluehr wrote: > > Here might be an interesting puzzle for people who like sorting > > algorithms ( and no I'm not a student anymore and the problem is not a > > students 'homework' but a particular question associated with a >

Re: Ordering Products

2005-07-18 Thread Kay Schluehr
Bernhard Holzmayer schrieb: > Kay Schluehr wrote: > > > > > Now lets drop the assumption that a and b commute. More general: let be > > M a set of expressions and X a subset of M where each element of X > > commutes with each element of M: how can a product with

Re: goto

2005-07-18 Thread Kay Schluehr
Hayri ERDENER schrieb: > hi, > what is the equivalent of C languages' goto statement in python? > best regards No, but some of goto's use cases can be covered by unconditional jumps provided by exceptions. Here is a C function using goto: void main() { int i, j; for ( i = 0; i < 10;

Re: Ordering Products

2005-07-18 Thread Kay Schluehr
Ron Adam wrote: > Kay Schluehr wrote: > > Here might be an interesting puzzle for people who like sorting > > algorithms ( and no I'm not a student anymore and the problem is not a > > students 'homework' but a particular question associated with a >

Re: Ordering Products

2005-07-19 Thread Kay Schluehr
Diez B.Roggisch wrote: > > I have to admit that I don't understand what you mean with the > > 'constant parts' of an expression? > > >From what I percieved of your example it seemed to me that you wanted to > evaluate the constants like 7*9 first, so that an expression like > > a * 7 * 9 * b > > wi

Documentation bug: Python console behaviour changed

2005-07-19 Thread Kay Schluehr
The documentation of the Python console behaviour is not correct anymore for Python 2.4.1. At least for the Win2K system I'm working on 'Ctrl-Z' does not shut down the console but 'Ctrl-D' etc. The Python interpreter tells me instead: >>> quit 'Use Ctrl-Z plus Return to exit.' Nah, 'Ctrl-Z' is n

Re: Documentation bug: Python console behaviour changed

2005-07-19 Thread Kay Schluehr
Peter Hansen schrieb: > Kay Schluehr wrote: > > The documentation of the Python console behaviour is not correct > > anymore for Python 2.4.1. At least for the Win2K system I'm working on > > 'Ctrl-Z' does not shut down the console but 'Ctrl-D'

Re: Ordering Products

2005-07-19 Thread Kay Schluehr
Ron Adam wrote: > Kay Schluehr wrote: > > > > Hi Ron, > > > > I really don't want to discourage you in doing your own CAS but the > > stuff I'm working on is already a bit more advanced than my > > mono-operational multiplicative algebra

Re: python certification

2005-07-20 Thread Kay Schluehr
[EMAIL PROTECTED] schrieb: > hi > i bassically need it cuz i am appyling to colleges this year and > i know this kind of stuff really helps. > besides since i am learning python i thought i might get some credit > for it as well. > its bassically for a mention in my resume/bio-data/appliccation >

Re: python certification

2005-07-20 Thread Kay Schluehr
Andreas Kostyrka schrieb: > (These are the people look for Pearl and Pyhton programmers ;) ) Or Phyton :) Kay -- http://mail.python.org/mailman/listinfo/python-list

Re: Lists & "pointers"

2005-07-23 Thread Kay Schluehr
Jan Danielsson wrote: > Hello all, > >I have written a simple whiteboard application. In my application, I > want to be able to set draw attributes. This part works. I have a > dictionary object which contains stuff like: > self.attr['Pen.Color'] = ... > self.attr['Pen.Thickness'] = ... > >

Re: A replacement for lambda

2005-07-30 Thread Kay Schluehr
Tim Roberts schrieb: > Scott David Daniels <[EMAIL PROTECTED]> wrote: > > > >What kind of shenanigans must a parser go through to translate: > > < > > > >this is the comparison of two functions, but it looks like a left- > >shift on a function until the second with is encountered. Then > >yo

Re: A replacement for lambda

2005-07-30 Thread Kay Schluehr
Mike Meyer schrieb: > I know, lambda bashing (and defending) in the group is one of the most > popular ways to avoid writing code. However, while staring at some Oz > code, I noticed a feature that would seem to make both groups happy - > if we can figure out how to avoid the ugly syntax. > > This

Re: A replacement for lambda

2005-07-30 Thread Kay Schluehr
Paul Rubin wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> writes: > > Examples: > >f = ( || x>=0 then f(x) || True then f(-x) from (x,) ) > >g = ( || x< 0 then self._a <-x || self._a <- 0 from (x,)) > > Is this an actual language? It lo

Re: Ten Essential Development Practices

2005-07-30 Thread Kay Schluehr
Dark Cowherd wrote: > -Quote - Phillip J. Eby from dirtsimple.org > Python as a community is plagued by massive amounts of > wheel-reinvention. The infamous web framework proliferation problem is > just the most egregious example. > > Why is Python "blessed" with so much reinvention? Because it's

Re: Comparison of functions

2005-07-30 Thread Kay Schluehr
Some indications: >>> for i in range(5): ... x = lambda x:x ... y = lambda y:y ... print x,y,x at 0x00EE83F0> at 0x00EE8FB0> True True at 0x00EE8AB0> at 0x00EE83F0> False False at 0x00EE8FB0> at 0x00EE8AB0> False False at 0x00EE83F0> at 0x00EE8FB0> True True at 0x00EE8AB0> at

Re: Wheel-reinvention with Python

2005-07-31 Thread Kay Schluehr
Ed Leafe wrote: > On Sunday 31 July 2005 01:02, phil hunt wrote: > > > You mightn't have, but I suspect more Python programers who've > > written GUI apps have used Tkinter than any of the other APIs. > > > > Not that I'm a particular fan of it, it's just I like > > standardisation, because then y

Re: Wheel-reinvention with Python

2005-07-31 Thread Kay Schluehr
Cliff Wells wrote: > > My objection with wrappers around wrappers around wrappers is that I > > have no hope ever watching the ground. If some error occurs, which > > layer has to be addressed? Which developing group is reponsible? My own > > or that of team A, team B, team C ... ? The baroque con

Re: namespaces

2005-07-31 Thread Kay Schluehr
Paolino wrote: > The second point also shows my perplexities about functions namespace: > > def function(): >function.foo='something' > > a=function.foo > > Traceback (most recent call last): >File "", line 1, in ? > AttributeError: 'function' object has no attribute 'foo' > > How should I

Re: Wheel-reinvention with Python

2005-08-01 Thread Kay Schluehr
Reinhold Birkenfeld wrote: > > In practise any Python GUI is going to contain code from otyher > > languages since if it was coded all the way down in python it would > > be too slow. > > Oh, I could imagine that a MFC-like wrapper around win32gui, or another > one around Xlib wouldn't be slower t

Decline and fall of scripting languages ?

2005-08-06 Thread Kay Schluehr
No good news for scripting-language fans: http://www.phpmag.net/itr/news/psecom,id,23284,nodeid,113.html Regards Kay -- http://mail.python.org/mailman/listinfo/python-list

python-list@python.org

2005-08-06 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > I've heard 2 people complain that word 'global' is confusing. > > Perhaps 'modulescope' or 'module' would be better? > > Am I the first peope to have thought of this and suggested it? > > Is this a candidate for Python 3000 yet? > > Chris Maybe a solution would be best t

Re: Fat and happy Pythonistas (was Re: Replacement for keyword 'global' good idea? ...)

2005-08-06 Thread Kay Schluehr
John Roth wrote: > Another thing that stands out: the explicit versus dynamic typing debate > has moved on from program correctness (which is a wash) to > other areas that explicit (or derived) type information can be used > for. I see this in PyFit: the languages where explicit type information >

Re: Decline and fall of scripting languages ?

2005-08-06 Thread Kay Schluehr
Paul Rubin wrote: > Cliff Wells <[EMAIL PROTECTED]> writes: > > It didn't say what they left PHP, Perl and Python for (if you are to > > even believe their findings). > > > > PHP has been losing programmers in droves... to Ruby on Rails, but I'm > > not sure how that is bad news for scripting-langu

Re: Python -- (just) a successful experiment?

2005-08-07 Thread Kay Schluehr
Eric Pederson wrote: > Raise your hand if you think the best technology wins! Who is interested in such a matter? Is this a forum dedicated to some programming language or a popularity contest? If Python dies in a few years / looses attention but the Python Zen survives in another language I have

Re: Python -- (just) a successful experiment?

2005-08-07 Thread Kay Schluehr
Martin P. Hellwig wrote: > Kay Schluehr wrote: > > Eric Pederson wrote: > > > >>Raise your hand if you think the best technology wins! > > > > > > Who is interested in such a matter? Is this a forum dedicated to some > > programming language or a pop

Re: Chopping off spaces at both ends

2005-08-07 Thread Kay Schluehr
Use the strip() method. Example: >>> "\t abc\n".strip() "abc" Variants are lstrip() and rstrip(). Regards, Kay -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP: Specialization Syntax

2005-08-07 Thread Kay Schluehr
Nicolas Fleury wrote: > It is necessary to maintain a > dictionary of types (to avoid redundacy) and simple things like: > > def makeType(someArgument): > class MyObject: > someArgument = someArgument > return MyObject > > are not allowed. def makeClass(cls_name, **kw): ret

Re: PEP: Specialization Syntax

2005-08-08 Thread Kay Schluehr
Nicolas Fleury schrieb: > Kay Schluehr wrote: > > def makeClass(cls_name, **kw): > > return type(cls_name,(), kw) > > > >>>>MyObject = makeClass("MyObject",a=8) > >>>>MyObject > > As said to Bengt, a place is needed to write

Re: Python -- (just) a successful experiment?

2005-08-08 Thread Kay Schluehr
Paul Rubin schrieb: > Having a good FFI is certainly an important feature but Python > programs should first and foremost be Python programs. Python was originally created as an extension language for C. In some sense it is an abstraction layer for C libs. > Compare the > situation with Java or

Re: Python -- (just) a successful experiment?

2005-08-08 Thread Kay Schluehr
Bengt Richter wrote: > It occurs to me that we have the PEP process for core python, but no PEP > process > for the python app/lib environment. What about starting a PEEP process > (Python Environment Enhancement Proposals) modeled on PEPs, where those > motivated > to formalize their pet projec

Re: python for microcontrollers

2005-08-08 Thread Kay Schluehr
Hi Bastard, one of the main reasons PyPy gets funded by the EU was the promise to port Python to embedded systems ( but not necessarily very memory restricted ones ). The project seems to be in a state where the team tries to get rid of the CPython runtime alltogether and reaching some autonomy. T

Re: Python -- (just) a successful experiment?

2005-08-08 Thread Kay Schluehr
EP wrote: > But sometimes a rugged individual can be even more rugged and more individual > if said individual has the support of friends by which to vet ideas and, by > absorbing counterpoint, to develop one's own thoughts even further. > > > And it is kind of nice when you have two teams drill

Re: Python supports LSP, does it?

2005-08-11 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > On Thu, 11 Aug 2005 01:19:19 +0100 > phil hunt wrote: > > > According to Wikipedia, the Liskov substitution principle is: > > > > Let q(x) be a property provable about objects x of type T. Then > > q(y) should be true for objects y of type S where S is a subtype of T

Re: Library vs Framework (was Dr. Dobb's Python-URL!)

2005-08-17 Thread Kay Schluehr
Simon Brunning wrote: > On 8/15/05, Rocco Moretti <[EMAIL PROTECTED]> wrote: > > Which lead me to the question - what's the difference between a library > > and a framework? > > If you call its code, it's a library. If it calls yours, it's a framework. Pretty! I don't think it is an oversimplific

Re: Bug in slice type

2005-08-21 Thread Kay Schluehr
Steven Bethard wrote: > "The slice of s from i to j with step k is defined as the sequence of > items with index x = i + n*k such that 0 <= n < (j-i)/k." > > This seems to contradict list behavior though. > range(10)[9:-1:-2] == [] No, both is correct. But we don't have to interpret the seco

Re: Proposed PEP: New style indexing, was Re: Bug in slice type

2005-08-21 Thread Kay Schluehr
Bryan Olson wrote: > Steven Bethard wrote: > > Well, I couldn't find where the general semantics of a negative stride > > index are defined, but for sequences at least[1]: > > > > "The slice of s from i to j with step k is defined as the sequence of > > items with index x = i + n*k such that 0

Re: Yielding a chain of values

2005-08-31 Thread Kay Schluehr
Reinhold Birkenfeld wrote: > > x = [ yield r for r in iterable ] > > Which is quite different from > > x = (yield) in iterable > > which is currently (PEP 342) equivalent to > > _ = (yield) > x = _ in iterable > > So, no further tinkering with yield, I'm afraid. > > Reinhold Is the statement

Re: Bicycle Repair Man usability

2005-08-31 Thread Kay Schluehr
Sybren Stuvel wrote: > > -Get rid of extra variables by shifting them inline (e.g.: > > a=1;b=2;c=a+b --> c=1+2) > > This is already excess functionality IMO. I don't think that Rex talked about his programming style but about three and only three refactoring methods survived in BRM from ~30 Fow

Infinity syntax. Re: Bug in string.find; was...

2005-08-31 Thread Kay Schluehr
Bengt Richter wrote: > How about interpreting seq[i] as an abbreviation of seq[i%len(seq)] ? > That would give a consitent interpretation of seq[-1] and no errors > for any value ;-) Cool, indexing becomes cyclic by default ;) But maybe it's better to define it explicitely: seq[!i] = seq[i%

Infinity syntax. Re: Bug in string.find; was...

2005-08-31 Thread Kay Schluehr
Bengt Richter wrote: > How about interpreting seq[i] as an abbreviation of seq[i%len(seq)] ? > That would give a consitent interpretation of seq[-1] and no errors > for any value ;-) Cool, indexing becomes cyclic by default ;) But maybe it's better to define it explicitely: seq[!i] = seq[i%

Re: Infinity syntax. Re: Bug in string.find; was...

2005-08-31 Thread Kay Schluehr
Bengt Richter wrote: > range(9)[4:-!0:-1] == range(5) > >True > Interesting, but wouldn't that last line be > >>> range(9)[4:-!0:-1] == range(5)[::-1] Ups. Yes of course. > >Life can be simpler with unbound limits. > Hm, is "!0" a di-graph symbol for infinity? > What if we get full unicode

Re: Yielding a chain of values

2005-08-31 Thread Kay Schluehr
Reinhold Birkenfeld wrote: > Kay Schluehr wrote: > > Reinhold Birkenfeld wrote: > > > >> > x = [ yield r for r in iterable ] > >> > >> Which is quite different from > >> > >> x = (yield) in iterable > >> > >> which

Re: Epydoc - Documenting class members?

2005-08-31 Thread Kay Schluehr
This should help: http://epydoc.sourceforge.net/fields.html Kay -- http://mail.python.org/mailman/listinfo/python-list

PEP-able? Expressional conditions

2005-09-07 Thread Kay Schluehr
One of the main reasons Pythons anonymous function lambda is considered to be "broken" is Pythons disability to put statements into expressions and support full functionality. Many attempts to improve lambdas syntax had also been attempts to break the expression/statement distinction in one or the

Re: PEP-able? Expressional conditions

2005-09-07 Thread Kay Schluehr
Terry Hancock wrote: > On Wednesday 07 September 2005 05:29 am, Kay Schluehr wrote: > > Instead of pushing statements into expressions one can try to do it the > > other way round and model expressions with the functionality of > > statements. > > > Alternativ

Re: PEP-able? Expressional conditions

2005-09-07 Thread Kay Schluehr
Terry Reedy wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > No, as I explained it is not a ternary operator and it can't easily be > > implemented using a Python function efficiently because Python does not > &g

Re: Yielding a chain of values

2005-09-07 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > dude - this business is so confusing that you actually have to *think* > about it! > but python is all about simplicity. > with python, when I program - I don't think *about* it - I think it. or > something - don't make me think about it. > > so how about a "reyield" or

Re: Migrate PYD Files

2005-09-08 Thread Kay Schluehr
David Duerrenmatt wrote: > Is there a way to use old pyd files (Python 1.5.2) with a newer version > of Python without recompiling them? > > Because the source code is not available anymore, I'm wondering whether > it's possible or not to change few bytes with a hex editor (version > number?). I'd

Re: Question about consistency in python language

2005-09-08 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > Let's say I define a list of pairs as follows: > >>l = [('d', 3), ('a', 2), ('b', 1)] > > Can anyone explain why this does not work? > >>h = {}.update(l) > > and instead I have to go: > >>h = {} > >>h.update(l) > to initialize a dictionary with the given list of pairs? >

Re: Question about consistency in python language

2005-09-09 Thread Kay Schluehr
Mike Meyer wrote: > Yes, but the function "sorted" is more useful than a list method > "sorted" in a duck typing language. I don't see what this has to do with "duck typing"? sorted() is simply a generic function accepting different types. I'm not aware that sorted() requires a specific interface

Re: Question about consistency in python language

2005-09-09 Thread Kay Schluehr
Terry Reedy wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On the other hand there exists no sorted() method for tuples or lists > > like join() for strings but it is implemented as a function in Python24 > >

Re: Why do Pythoneers reinvent the wheel?

2005-09-10 Thread Kay Schluehr
Tim Daneliuk wrote: > 1) The existing tool is inadequate for the task at hand and OO subclassing > is overrated/overhyped to fix this problem. Even when you override > base classes with your own stuff, you're still stuck with the larger > *architecture* of the original design. You real

Re: Question about consistency in python language

2005-09-11 Thread Kay Schluehr
Steve Holden wrote: > Kay Schluehr wrote: > > Mike Meyer wrote: > > > > > >>Yes, but the function "sorted" is more useful than a list method > >>"sorted" in a duck typing language. > > > > > > I don't see what this

Re: Grouping lists

2005-09-12 Thread Kay Schluehr
PyPK wrote: > If I have a list say > > lst = [1,1,1,1,3,5,1,1,1,1,7,7,7] > I want to group the list so that it returns groups such as > [(0,3),4,5,(6,9),(10,12)]. which defines the regions which are similar. > > Thanks, Hi, I got a solution without iterators and without comparing adjecent elemen

Re: Self reordering list in Python

2005-09-15 Thread Kay Schluehr
Laszlo Zsolt Nagy wrote: > Hello, > > Do you know how to implement a really efficient self reordering list in > Python? (List with a maximum length. When an item is processed, it > becomes the first element in the list.) I would like to use this for > caching of rendered images. I wonder why you d

Re: C#3.0 and lambdas

2005-09-20 Thread Kay Schluehr
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > On Slashdot there is a discussion about the future C#3.0: > > http://developers.slashdot.org/developers/05/09/18/0545217.shtml?tid=109&tid=8 > > > > http://msdn.microsoft.com/vcsharp/future/ > > "The extensions enable construction of composi

Lisp-likeness

2005-03-15 Thread Kay Schluehr
Maybe You can answer my question what this simple LISP function does ? (defun addn (n) #'(lambda (x) (+ x n))) This is correct LISP-syntax if You bear in mind LISPs powerwull macro language... I think Guido and python-dev are very carefull in adding new power to Python. T

Re: Python becoming less Lisp-like

2005-03-16 Thread Kay Schluehr
Torsten Bronger wrote: > Hallöchen! Moin! > [First, I wanted to say "descriptors" instead of "decorators" (I > superseded my post).] > > The goal is to trigger function calls when attributes are accessed. > This is called properties in C# (and maybe in Ruby, too). Python > now also has this conc

Re: Python becoming less Lisp-like

2005-03-17 Thread Kay Schluehr
Paul Boddie wrote: > The principal advantage of the property function was to permit the > definition of "active" attributes without having a huge > "if...elif...else" statement in the __getattr__ method. So the > motivation was seemingly to externalize the usually simple logic in > __getattr__ so

Re: Why tuple with one item is no tuple

2005-03-18 Thread Kay Schluehr
Antoon Pardon wrote: > for instance I have written once somekind of vector class where > it was natural for these vectors to be added as well as te be > concatenated. Unfortunately python uses "+" for both so I had > no way to have both operators in a natural way in python. Yes this is a quite co

  1   2   3   4   5   6   7   8   >