Re: Intro to Pyparsing Article at ONLamp

2006-01-30 Thread Christopher Subich
Anton Vredegoor wrote: And pave the way for a natural language parser. Maybe there's even some (sketchy) path now to link computer languages and natural languages. In my mind Python has always been closer to human languages than other programming languages. From what I learned about it,

Re: Can a simple a==b 'hang' in and endless loop?

2006-01-19 Thread Christopher Subich
Claudio Grondi wrote: The Python tutorial '3.2 The standard type hierarchy' says: Ellipsis: This type has a single value. There is a single object with this value. This object is accessed through the built-in name Ellipsis. It is used to indicate the presence of the ... syntax in a

Re: OT: excellent book on information theory

2006-01-18 Thread Christopher Subich
Tim Peters wrote: Probably not, if Paul's American. For example, here in the states we have Python Parks, where you go to look at scenery from inside your python. As an American residing in Canada, I'll say that Python Parks are only fun if they spring for hydro -- otherwise it's kind of

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-11 Thread Christopher Subich
Fredrik Lundh wrote: TAG.did.you.just.call.me.a.kook.questionmark TAG.no.dash.but.if.you.keep.replying.to.them.all.the.time.i.may.have.to.plonk.you.too.smiley TAG.you're.it.exclamation.point. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why keep identity-based equality comparison?

2006-01-10 Thread Christopher Subich
Antoon Pardon wrote: Op 2006-01-10, Peter Decker schreef [EMAIL PROTECTED]: I don't see the two comparisons as equivalent at all. If two things are different, it does not follow that they can be ranked. That a b returns false doesn't imply that a and b can be ranked. take sets. set([1,2])

Re: inline function call

2006-01-05 Thread Christopher Subich
Diez B. Roggisch wrote: No. That is simply impossible in python as well as in java where functions are always virtual, meaning they are looked up at runtime. Because you'd never know _which_ code to insert of all the different foo()-methods that might be around there. Not quite simply

Re: Optimize function similiar to dict.update() but adds common values

2005-12-15 Thread Christopher Subich
Peter Otten wrote: def add_freqs3(freq1, freq2): total = dict(freq1) for key, value in freq2.iteritems(): try: total[key] += value except KeyError: total[key] = value return total Untested, but replacing the try/except pair with the

Re: const objects (was Re: Death to tuples!)

2005-12-14 Thread Christopher Subich
Gabriel Zachmann wrote: I was wondering why python doesn't contain a way to make things const? If it were possible to declare variables at the time they are bound to objects that they should not allow modification of the object, then we would have a concept _orthogonal_ to data types

Re: OO in Python? ^^

2005-12-14 Thread Christopher Subich
Antoon Pardon wrote: Suppose we would add type declarations in python. So we could do things like int: a object: b Some people seem to think that this would introduce static typing, but the only effect those staments need to have is that each time a variable is rebound an assert

Re: Newbie needs help with regex strings

2005-12-14 Thread Christopher Subich
Paul McGuire wrote: This isn't a regex solution, but uses pyparsing instead. Pyparsing helps you construct recursive-descent parsers, and maintains a code structure that is easy to compose, read, understand, maintain, and remember what you did 6-months after you wrote it in the first place.

Re: lambda (and reduce) are valuable

2005-12-13 Thread Christopher Subich
Chris Mellon wrote: functions with real names is crucial to maintainable code. The only reason to ever use a lamdba in Python is because you don't want to give a function a name, and that is just not a compelling use case for GUI events. Ah, but that neglects the sheer utility of

Re: Overloading

2005-12-09 Thread Christopher Subich
Johannes Reichel wrote: Hi! In C++ you can overload functions and constructors. For example if I have a class that represents a complex number, than it would be nice if I can write two seperate constructors class Complex: Please do note, if you want this for the exact use of a Complex

Re: Bitching about the documentation...

2005-12-07 Thread Christopher Subich
Fredrik Lundh wrote: Steven D'Aprano wrote: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. Did you mean: Badger badger Badger badger badger badger Badger badger Mushroom! Mushroom! Thank you, I really needed that stuck in my head. :) --

Re: Calculating Elapsed Time

2005-12-07 Thread Christopher Subich
Peter Hansen wrote: A few things. 1. Precision is probably the wrong word there. Resolution seems more correct. 2. If your system returns figures after the decimal point, it probably has better resolution than one second (go figure). Depending on what system it is, your best bet to

Re: Calculating Elapsed Time

2005-12-07 Thread Christopher Subich
Fredrik Lundh wrote: if I run this on the Windows 2K box I'm sitting at right now, it settles at 100 for time.time, and 1789772 for time.clock. on linux, I get 100 for time.clock instead, and 262144 for time.time. Aren't the time.clock semantics different on 'nix? I thought, at least on

Re: Bitching about the documentation...

2005-12-07 Thread Christopher Subich
Steven D'Aprano wrote: S P O I L E R S P A C E Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. Buffalo from the city of Buffalo, which are intimidated by buffalo from Buffalo, also intimidate buffalo from Buffalo. And to do a small simplification on it,

Re: Bitching about the documentation...

2005-12-07 Thread Christopher Subich
Steven D'Aprano wrote: On Wed, 07 Dec 2005 11:45:04 +0100, Fredrik Lundh wrote: Did you mean: Badger badger Badger badger badger badger Badger badger Mushroom! Mushroom! Er... no, I can't parse that. I suffered a Too Much Recursion error about the third Badger (I only have a limited

Re: Is there no compression support for large sized strings in Python?

2005-12-05 Thread Christopher Subich
Fredrik Lundh wrote: Christopher Subich wrote: I have access to an itanium system with a metric ton of memory. I -think- that the Python version is still only a 32-bit python an ILP64 system is a system where int, long, and pointer are all 64 bits, so a 32-bit python on a 64-bit platform

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Christopher Subich
Paul McNett wrote: Having .NET and Java in the world makes me into more of a hero when I can swoop in and get the real business problem solved using Python. +1QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: hash()

2005-12-05 Thread Christopher Subich
John Marshall wrote: I was actually interested in the mathematical/probability side rather than the empirical w/r to the current hash function in python. Although I imagine I could do a brute force test for x-character strings. Hah. No. At least on the version I have handy (Py 2.2.3 on

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Christopher Subich
[EMAIL PROTECTED] wrote: From The Design of Everyday Things, docs are a sign of poor design. Even a single word, such as the word Push on the face of a door, is an indication that the design can be improved. Please, rethink the design instead of trying to compensate with more documentation.

Re: Is there no compression support for large sized strings in Python?

2005-12-02 Thread Christopher Subich
Fredrik Lundh wrote: Harald Karner wrote: python -c print len('m' * ((2048*1024*1024)-1)) 2147483647 the string type uses the ob_size field to hold the string length, and ob_size is an integer: $ more Include/object.h ... int ob_size; /* Number of items in variable part */

Unifying Attributes and Names (was: Re: Death to tuples!)

2005-11-29 Thread Christopher Subich
Bengt Richter wrote: If we had a way to effect an override of a specific instance's attribute accesses to make certain attribute names act as if they were defined in type(instance), and if we could do this with function instances, and if function local accesses would check if names were

Unifying Attributes and Names (was: Re: Death to tuples!)

2005-11-29 Thread Christopher Subich
Bengt Richter wrote: If we had a way to effect an override of a specific instance's attribute accesses to make certain attribute names act as if they were defined in type(instance), and if we could do this with function instances, and if function local accesses would check if names were one

Re: ncurses' Dark Devilry

2005-11-29 Thread Christopher Subich
Jeremy Moles wrote: In article [EMAIL PROTECTED], Jeremy Moles [EMAIL PROTECTED] wrote: I have a focus wheel of sorts that allows the user to do input on various wigets and windows and whatnot. However, if I want to quickly call addstr somewhere else in the application I have to: 1. Store

Re: Class Variable Access and Assignment

2005-11-07 Thread Christopher Subich
Antoon Pardon wrote: Op 2005-11-04, Christopher Subich schreef [EMAIL PROTECTED]: it's the Python idiosyncracy about operations on mutable types. In this case, += mutates an object, while + returns a new one -- as by definition, for mutables. It is the combination of the two

Re: Class Variable Access and Assignment

2005-11-06 Thread Christopher Subich
Bengt Richter wrote: On Fri, 04 Nov 2005 10:28:52 -0500, Christopher Subich [EMAIL PROTECTED] wrote: is very much within the language specification. Indeed, the language specification dictates that an instance variable b.a is created if one didn't exist before; this is true no matter

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Antoon Pardon wrote: Op 2005-11-03, Stefan Arentz schreef [EMAIL PROTECTED]: The model makes sense in my opinion. If you don't like it then there are plenty of other languages to choose from that have decided to implement things differently. And again this argument. Like it or leave it, as

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Steven D'Aprano wrote: On Thu, 03 Nov 2005 14:13:13 +, Antoon Pardon wrote: Fine, we have the code: b.a += 2 We found the class variable, because there is no instance variable, then why is the class variable not incremented by two now? Because b.a += 2 expands to b.a = b.a + 2.

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Antoon Pardon wrote: Since ints are immutable objects, you shouldn't expect the value of b.a to be modified in place, and so there is an assignment to b.a, not A.a. You are now talking implementation details. I don't care about whatever explanation you give in terms of implementation

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Antoon Pardon wrote: Well I wonder. Would the following code be considered a name binding operation: b.a = 5 Try it, it's not. Python 2.2.3 (#1, Nov 12 2004, 13:02:04) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-42)] on linux2 Type help, copyright, credits or license for more information.

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Antoon Pardon wrote: Except when your default is a list class foo: x = [] # default a = foo() a.x += [3] b = foo() b.x This results in [3]. So in this case using a class variable x to provide a default empty list doesn't work out in combination with augmented operators. This

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Antoon Pardon wrote: Well maybe because as far as I understand the same kind of logic can be applied to something like lst[f()] += foo In order to decide that this should be equivallent to lst[f()] = lst[f()] + foo. But that isn't the case. Because, surprisingly enough, Python tends

Re: Class Variable Access and Assignment

2005-11-04 Thread Christopher Subich
Bengt Richter wrote: It might be interesting to have a means to push and pop objects onto/off-of a name-space-shadowing stack (__nsstack__), such that the first place to look up a bare name would be as an attribute of the top stack object, i.e., name = name + 1 Don't be that

Re: Would there be support for a more general cmp/__cmp__

2005-10-28 Thread Christopher Subich
Antoon Pardon wrote: If you are concerned about sorting times, I think you should be more concerned about Guido's idea of doing away with __cmp__. Sure __lt__ is faster. But in a number of cases writing __cmp__ is of the same complexity as writing __lt__. So if you then need a __lt__, __le__,

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-28 Thread Christopher Subich
Steve Holden wrote: On Thu, 2005-10-27 at 14:00, Gregory Piñero wrote: Not quite because if something(3) fails, I still want something(4) to run. Then the obvious extension: for i in range(20): ... but I get the idea that Gregory was thinking of different statements rather than

Re: Would there be support for a more general cmp/__cmp__

2005-10-26 Thread Christopher Subich
Antoon Pardon wrote: Op 2005-10-25, Christopher Subich schreef [EMAIL PROTECTED]: My biggest complaint here is about returning None or IncomparableValue; if that happens, then all code that relies on cmp returning a numeric result will have to be rewritten. I don't know. There are two

Re: textwidget.tag_bind(name, Any-KeyPress, self.donothing) not working

2005-10-26 Thread Christopher Subich
shannonl wrote: Hi all, For some reason this bind is calling the donothing function, like it should, but is then allowing the text to be inserted into the Text widget. [...] This bind does work on the text widget as a whole, but on a individual tag, it does not. You're trying to prevent a

Re: Would there be support for a more general cmp/__cmp__

2005-10-25 Thread Christopher Subich
Antoon Pardon wrote: It *is* a definition of an ordering. For something to be an ordering it has to be anti symmetric and transitive. The subset relationships on sets conform to these conditions so it is a (partial) ordering. Check your mathematic books, Why you would think this is abuse

Re: Would there be support for a more general cmp/__cmp__

2005-10-25 Thread Christopher Subich
Antoon Pardon wrote: I also think there is the problem that people aren't used to partial ordering. There is an ordering over sets, it is just not a total ordering. But that some pairs are uncomparable (meaning that neither one is smaller or greater) doesn't imply that comparing them is ill

Re: Would there be support for a more general cmp/__cmp__

2005-10-25 Thread Christopher Subich
Antoon Pardon wrote: Op 2005-10-25, Christopher Subich schreef [EMAIL PROTECTED]: Which is exactly why a b on sets returns True xor False, but cmp(a,b) throws an exception. I don't see the conection. The documentation states that cmp(a,b) will return a negative value if a b. So why

Re: Would there be support for a more general cmp/__cmp__

2005-10-21 Thread Christopher Subich
Antoon Pardon wrote: It would be better if cmp would give an indication it can't compare two objects instead of giving incorrect and inconsistent results. If two objects aren't totally comparable, then using 'cmp' on them is ill-defined to begin with. The Standard Thing To Do is throw an

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-19 Thread Christopher Subich
Chris Lambacher wrote: The shell that comes with MSys (from the MinGW guys). Is pretty good, although it does have a bit of a problem with stdout output before a process exits, ie it will hold back output until the process exits. As a bonus, the file system is a little more sane, and if you

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): ... def c(*args,

Re: Python interpreter bug

2005-10-07 Thread Christopher Subich
[EMAIL PROTECTED] wrote: No doubt you're right but common sense dictates that membership testing would test identity not equality. This is one of the rare occasions where Python defeats my common sense But object identity is almost always a fairly ill-defined concept. Consider this (Python

Re: socketServer questions

2005-10-07 Thread Christopher Subich
Paul Rubin wrote: rbt [EMAIL PROTECTED] writes: 1. Do I need to use threads to handle requests, if so, how would I incorporate them? The clients are light and fast never sending more than 270 bytes of data and never connecting for more than 10 seconds at a time. There are currently 500 clients

Re: Overloading __init__ Function overloading

2005-09-30 Thread Christopher Subich
Iyer, Prasad C wrote: Thanks a lot for the reply. But I want to do something like this class BaseClass: def __init__(self): # Some code over here def __init__(self, a, b): # Some code over here def __init__(self, a, b, c): #

Re: Single type for __builtins__ in Py3.0

2005-09-23 Thread Christopher Subich
Collin Winter wrote: Hallo all, I'd like to propose that in Py3.0 (if not earlier), __builtins__ will be the same type regardless of which namespace you're in. Tim Peters has said [1] that the reason __builtins__ in __main__ is a module so that the curious don't get flooded with output when

Re: Writing a parser the right way?

2005-09-21 Thread Christopher Subich
beza1e1 wrote: Well, a declarative sentence is essentially subject-predicate-object, while a question is predicate-subject-object. This is important in further processing. So perhaps i should code this order into the classes? I need to think a little bit more about this. A question is

Re: Proposal: add sys to __builtins__

2005-09-06 Thread Christopher Subich
Michael J. Fromberger wrote: While I'm mildly uncomfortable with the precedent that would be set by including the contents of sys as built-ins, I must confess my objections are primarily aesthetic: I don't want to see the built-in namespace any more cluttered than is necessary -- or at

Re: Spaces and tabs again

2005-08-13 Thread Christopher Subich
[EMAIL PROTECTED] wrote: Are you kidding? You are going to MANDATE spaces? Actually, future whitespace rules will be extensive. See: http://64.233.187.104/search?q=cache:k1w9oZr767QJ:www.artima.com/weblogs/viewpost.jsp%3Fthread%3D101968 (google cache of

Re: thread limit in python

2005-08-12 Thread Christopher Subich
[EMAIL PROTECTED] wrote: i modified my C test program (included below) to explicitly set the default thread stack size, and i'm still running into the same problem. can you think of any other thing that would possibly be limiting me? Hrm, you're on an A64, so that might very well mean you're

Unicode regular expressions -- buggy?

2005-08-11 Thread Christopher Subich
I don't think the python regular expression module correctly handles combining marks; it gives inconsistent results between equivalent forms of some regular expressions: sys.version '2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]'

Re: Does any one recognize this binary data storage format

2005-08-10 Thread Christopher Subich
Calvin Spealman wrote: Original Poster should send this off to thedailywtf.com I absolutely agree. This is a terrible programming practice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with Regular Expressions

2005-08-10 Thread Christopher Subich
Paul McGuire wrote: If your re demands get more complicated, you could take a look at pyparsing. The code is a bit more verbose, but many find it easier to compose their expressions using pyparsing's classes, such as Literal, OneOrMore, Optional, etc., plus a number of built-in helper

Re: PEP 328, absolute/relative import

2005-08-10 Thread Christopher Subich
Ben Finney wrote: Once PEP 328 is fully implemented, all bare 'import foo' statements specify absolute imports (i.e. from sys.path only). To perform a relative import (e.g. from current directory) will require different syntax. I'm not completely familiar with either, but how will that

Re: regex help

2005-08-10 Thread Christopher Subich
jeff sacksteder wrote: Regex questions seem to be rather resistant to googling. My regex currently looks like - 'FOO:.*\n\n' The chunk of text I am attempting to locate is a line beginning with FOO:, followed by an unknown number of lines, terminating with a blank line. Clearly the .*

Re: don't understand instanse creation

2005-08-09 Thread Christopher Subich
Maksim Kasimov wrote: Hello, i have a class, such as below. when i try to make instances of the class, fields __data1 and __data2 gets different values: __data1 behaves like private field, __data2 - like static which is the thing i've missed? Firstly, you get interesting

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Christopher Subich
Gregory Piñero wrote: Hey guys, would someone mind giving me a quick rundown of how references work in Python when passing arguments into functions? The code below should highlight my specific confusion: All arguments are passed by reference, but in Python equality rebinds the name. code

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Christopher Subich
Dennis Lee Bieber wrote: In a more simplistic view, I'd reverse the phrasing... The name x is assigned to the object y (implying it is no longer attached to whatever used to have the name) No, because that'd imply that the object 'y' somehow keeps track of the names assigned to it,

Re: Does any one recognize this binary data storage format

2005-08-09 Thread Christopher Subich
[EMAIL PROTECTED] wrote: I am hoping someone can help me solve a bit of a puzzle. We are working on a data file reader and extraction tool for an old MS-DOS accounting system dating back to the mid 80's. In the data files, the text information is stored in clearly readable ASCII text, so

Re: Does any one recognize this binary data storage format

2005-08-09 Thread Christopher Subich
Dejan Rodiger wrote: 8003346488(10)=1DD096038(16) 1D D0 96 03 8 80 03 96 D0 1D 00 80 03 96 d0 fd 41 Add E041 I'm pretty sure that the last full byte is a parity check of some sort. I still thing that Phone2 (..F1) is a typo and should be 41. Even if it's not, it could be a more detailed

Re: Does any one recognize this binary data storage format

2005-08-09 Thread Christopher Subich
Grant Edwards wrote: That would just be sick. I can't imagine anybody on an 8-bit CPU using FP for a phone number. Nobody on an 8-bit CPU would have a FPU, so I'll guarantee that this is done using only 8 or 16-bit (probably 8) integer math. --

Re: Proposed new collection methods

2005-08-07 Thread Christopher Subich
Jeff Schwab wrote: Robert Kern wrote: Now, if I were to do item = g(self, test).next() the generator would execute the code until it reached the yield statement which happens when it finds the first item that passes the test. That item will get returned, and execution does not return

Re: Proposed new collection methods

2005-08-06 Thread Christopher Subich
Mike Meyer wrote: Another thread pointed out a couple of methods that would be nice to have on Python collections: find and inject. These are taken from URL: http://martinfowler.com/bliki/CollectionClosureMethod.html . find can be defined as: def find(self, test = None):

Re: Proposed new collection methods

2005-08-06 Thread Christopher Subich
Robert Kern wrote: Jeff Schwab wrote: Why are you retarded? Isn't the above code O(n)? Forgive me for not understanding, I'm still awfully new to Python (having come from Perl C++), and I didn't see an explanation in the FAQ. (s for s in iter(self) is test(s)) is a generator

Re: Metaclasses and class variables

2005-08-04 Thread Christopher Subich
Jan-Ole Esleben wrote: class Meta(type): def __new__(cls, name, bases, d): d['classvar'] = [] return type.__new__(cls, name, bases, d) The problem is that __new__ is called upon object construction, not class definition, but you're trying to set the class variables at

Re: cut paste text between tkinter widgets

2005-08-04 Thread Christopher Subich
Repton wrote: This poses a small problem. I'm not sure whether this is a Win32-related issue, or it's because the PRIMARY selection isn't fully configured. You need to select something first :-) That doesn't work for inter-process communication, though, at least not with win32 native

Re: 2-player game, client and server at localhost

2005-08-03 Thread Christopher Subich
Michael Rybak wrote: As stated above, that's how I'm trying it right now. Still, if doing it turn-base, I would have to create a new thread every time. I have some other questions though - please see below. No, you should never need to create a new thread upon receiving input. What you

Re: HELP:sorting list of outline numbers

2005-08-03 Thread Christopher Subich
Felix Collins wrote: Using Decorate, Sort , Undecorate... works like a charm. As a one-liner, you can also deconstruct and rebuild the outline numbers: new_outline = ['.'.join(v) for v in (sorted([k.split('.') for k in old_outline]))] -- http://mail.python.org/mailman/listinfo/python-list

Re: cut paste text between tkinter widgets

2005-08-03 Thread Christopher Subich
William Gill wrote: Is there a simple way to cut and paste from a tkinter text widget to an entry widget? I know I could create a mouse button event that triggers a popup (message widget) prompting for cut/paste in each of the widgets using a temp variable to hold the text, but I don't

Re: cut paste text between tkinter widgets

2005-08-03 Thread Christopher Subich
Apologies in advance to anyone who has this post mangled, I use a couple Unicode characters at the end and Thunderbird wants to use UTF8 for the message encoding. Unless it does something weird, this post should still be legible... but I'm not going to rely on that. :) William Gill wrote: 2)

Re: Python's CSV reader

2005-08-03 Thread Christopher Subich
Stephan wrote: Can the CSV module be coerced to read two line formats at once or am I better off using read and split? Well, readlines/split really isn't bad. So long as the file fits comfortably in memory: fi = open(file) lines = fi.readlines() evens = iter(lines[0::2]) odds =

Re: 2-player game, client and server at localhost

2005-08-02 Thread Christopher Subich
Michael Rybak wrote: That's the problem - or a player input comes in. As I've explained, this happens a dozen of times per second :(. I've even tried not checking for player's input after every frame, but do it 3 times more rare (if framecount % 3 == 0 : process_players_input()). Well, I've

Re: 2-player game, client and server at localhost

2005-08-02 Thread Christopher Subich
Michael Rybak wrote: CS There's the key. How are you processing network input, specifically CS retrieving it from the socket? A sock class has a socket with 0.1 timeout, and every time I want anything, I call it's read_command() method until it returns anything. read_command() and

Re: Wheel-reinvention with Python

2005-08-01 Thread Christopher Subich
Paul Rubin wrote: I think my approach is in some sense completely typical: I don't want to install ANYTHING, EVER. I've described this before. I want to buy a new computer and have all the software I'll ever need already on the hard drive, and use it from that day forward. By the time the

Re: Standard Threads vs Weightless Threads

2005-08-01 Thread Christopher Subich
yoda wrote: 1)What is the difference (in terms of performance, scalability,[insert relevant metric here]) between microthreads and system threads? System-level threads are relatively heavyweight. They come with a full call stack, and they take up some level of kernel resources [generally

Re: Thaughts from an (almost) Lurker.

2005-07-31 Thread Christopher Subich
Robert Kern wrote: My experience with USENET suggests that there is always a steady stream of newbies, trolls, and otherwise clueless people. In the absence of real evidence (like traceable headers), I don't think there's a reason to suspect that there's someone performing psychological

Re: A replacement for lambda

2005-07-30 Thread Christopher Subich
Paul Rubin wrote: Christopher Subich [EMAIL PROTECTED] writes: My personal favourite is to replace lambda entirely with an expression comprehension, using and delimeters. But how does that let you get more than one expression into the anonymous function? It doesn't. Functionally, it's

Re: A replacement for lambda

2005-07-30 Thread Christopher Subich
Scott David Daniels wrote: What kind of shenanigans must a parser go through to translate: x**2 with(x)x**3 with(x) this is the comparison of two functions, but it looks like a left- shift on a function until the second with is encountered. Then you need to backtrack to the shift and

Re: A replacement for lambda

2005-07-30 Thread Christopher Subich
Paolino wrote: why (x**2 with(x))(x**3 with(x)) is not taken in consideration? Looks too much like a generator expression for my taste. Also, expr .. syntax could be used with 'for' instead of 'with' if PEP343 poses a problem, whereas (expr for params) is identically a generator expression.

Re: A replacement for lambda

2005-07-30 Thread Christopher Subich
Paddy wrote: Christopher Subich [EMAIL PROTECTED] writes: Basically, I'd rewrite the Python grammar such that: lambda_form ::= expression with parameter_list I do prefer my parameter list to come before the expression. It would remain consistant with simple function definitions

Re: A replacement for lambda

2005-07-29 Thread Christopher Subich
Mike Meyer wrote: My choice for the non-name token is @. It's already got magic powers, so we'll give it more rather than introducing another token with magic powers, as the lesser of two evils. Doesn't work. The crux of your change isn't introducing a meaning to @ (and honestly, I prefer

Re: can list comprehensions replace map?

2005-07-28 Thread Christopher Subich
Andrew Dalke wrote: Steven Bethard wrote: Here's one possible solution: py import itertools as it py def zipfill(*lists): ... max_len = max(len(lst) for lst in lists) A limitation to this is the need to iterate over the lists twice, which might not be possible if one of them is a file

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Christopher Subich
Soeren Sonnenburg wrote: On Sat, 2005-07-23 at 23:35 +0200, Marc 'BlackJack' Rintsch wrote: Both operate on the lists themselves and not on their contents. Quite consistent if you ask me. But why ?? Why not have them operate on content, like is done on *arrays ? Because they're lists, not

Re: return None

2005-07-24 Thread Christopher Subich
Repton wrote: 'Well, there's your payment.' said the Hodja. 'Take it and go!' +1: the koan of None Upon hearing that, the man was enlightened. -- http://mail.python.org/mailman/listinfo/python-list

Re: return None

2005-07-23 Thread Christopher Subich
Grant Edwards wrote: Personally, I don't really like the idea that falling off the botton of a function implicitly returns None. It's just not explicit enough for me. My preference would be that if the function didn't execute a return statement, then it didn't return anyting and attempting

Re: Aliasing an object's __str__ to a different method

2005-07-23 Thread Christopher Subich
Paolino wrote: Little less ugly: In [12]:class A(object): : def __str__(self):return self.__str__() : def str(self):return 'ciao' : def setStr(self):self.__str__=self.str : In [13]:a=A() In [14]:a.setStr() In [15]:str(a) Out[15]:'ciao' Not

Re: return None

2005-07-23 Thread Christopher Subich
Christopher Subich wrote: print '%s returns:', retval Not that it matters, but this line should be: print '%s returns:' % func.__name__, retval -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regexp please

2005-07-22 Thread Christopher Subich
Scott David Daniels wrote: Felix Collins wrote: I have an outline number system like 1 1.2 1.2.3 I want to parse an outline number and return the parent. Seems to me regex is not the way to go: def parent(string): return string[: string.rindex('.')] Absolutely, regex is the

Re: find a specified dictionary in a list

2005-07-22 Thread Christopher Subich
Odd-R. wrote: On 2005-07-22, John Machin [EMAIL PROTECTED] wrote: Odd-R. wrote: I have this list: [{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}] All the dictionaries of this list are of the same form, and all the oids are distinct. If I have an oid and

Re: Help with regexp please

2005-07-22 Thread Christopher Subich
Terry Hancock wrote: I think this is the regexes can't count problem. When the repetition count matters, you usually need something else. Usually some combination of string and list methods will do the trick, as here. Not exactly, regexes are just fine at doing things like first and last.

Re: Aliasing an object's __str__ to a different method

2005-07-22 Thread Christopher Subich
ncf wrote: Well, suffice to say, having the class not inherit from object solved my problem, as I suspect it may solve yours. ;) Actually, I did a bit of experimenting. If the __str__ reassignment worked as intended, it would just cause an infinite recursion. To paste the class definition

Re: Location of tk.h

2005-07-22 Thread Christopher Subich
none wrote: Probably a stupid question, but... I was attempting to install the Tkinter 3000 WCK. It blew up trying to build _tk3draw. The first error is a 'No such file or directory' for tk.h. I can import and use Tkinter just fine, so I'm not sure what is what here. You can import

Re: Need to interrupt to check for mouse movement

2005-07-21 Thread Christopher Subich
Paul Rubin wrote: Huh? It's pretty normal, the gui blocks while waiting for events from the window system. I expect that Qt and Tk work the same way. Which is why I recommended Twisted for the networking; it integrates with the toolkit event loops so it automagically works:

Re: main window in tkinter app

2005-07-20 Thread Christopher Subich
William Gill wrote: O.K. I tried from scratch, and the following snippet produces an infinite loop saying: File C:\Python24\lib\lib-tk\Tkinter.py, line 1647, in __getattr__ return getattr(self.tk, attr) If I comment out the __init__ method, I get the titled window, and print

Re: main window in tkinter app

2005-07-20 Thread Christopher Subich
William Gill wrote: That does it!, thanks. Thinking about it, when I created a derived class with an __init__ method, I overrode the base class's init. It should have been intuitive that I needed to explicitly call baseclass.__init(self), it wasn't. It might have hit me if the fault

Re: Need to interrupt to check for mouse movement

2005-07-20 Thread Christopher Subich
Peter Hansen wrote: stringy wrote: I have a program that shows a 3d representation of a cell, depending on some data that it receives from some C++. It runs with wx.timer(500), and on wx.EVT_TIMER, it updates the the data, and receives it over the socket. It's generally inappropriate

Re: Need to interrupt to check for mouse movement

2005-07-20 Thread Christopher Subich
Jp Calderone wrote: In the particular case of wxWidgets, it turns out that the *GUI* blocks for long periods of time, preventing the *network* from getting attention. But I agree with your position for other toolkits, such as Gtk, Qt, or Tk. Wow, I'm not familiar with wxWidgets; how's

Re: Help - Classes and attributes

2005-07-14 Thread Christopher Subich
rh0dium wrote: Hi all, I believe I am having a fundamental problem with my class and I can't seem to figure out what I am doing wrong. Basically I want a class which can do several specific ldap queries. So in my code I would have multiple searches. But I can't figure out how to do it

  1   2   >