Re: [Python-Dev] String views

2005-08-31 Thread Greg Ewing
[EMAIL PROTECTED] wrote: If I then wanted to see what scheme's value compared to, the string's comparison method would have to recognize that it wasn't truly NUL-terminated, copy it, call strncmp() or whatever underlying routine is used for string comparisons. Python string comparisons can't

Re: [Python-Dev] Revising RE docs

2005-08-31 Thread Greg Ewing
Stephen J. Turnbull wrote: But you could have string objects (or a derivative) grow a compiled_regexp attribute internally. That would make the core dependent on the re module, which I think would be a bad idea. Personally I like the way the compilation step is made at least somewhat explicit.

Re: [Python-Dev] Proof of the pudding: str.partition()

2005-08-31 Thread Greg Ewing
LD Gus Landis wrote: .piece() can be both a verb and a noun Er, pardon? I don't think I've ever heard 'piece' used as a verb in English. Can you supply an example sentence? (And no, Piece, man! doesn't count. :-) Greg ___ Python-Dev mailing list

Re: [Python-Dev] Python 3 design principles

2005-09-01 Thread Greg Ewing
Reinhold Birkenfeld wrote: Greg Ewing wrote: There's no way importing a module could add something that works like the old print statement, unless some serious magic is going on... You'd have to enclose print arguments in parentheses. Of course, the trailing comma form would be lost

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-01 Thread Greg Ewing
before, and rejected on the grounds that it's too visually confusing having $ signs both inside and outside the quotes. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-01 Thread Greg Ewing
would need to be willing to convert either or both operands to strings. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-04 Thread Greg Ewing
easily were the only goal, it could be achieved by making stdout a builtin and using stdout.write(...). -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] String views

2005-09-04 Thread Greg Ewing
to it. Just because a Python string can contain embedded NULs doesn't mean it makes sense to use such strings in all circumstances. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

[Python-Dev] Pascaloid print substitute (Replacement for print in Python 3.0)

2005-09-04 Thread Greg Ewing
(sys.stdout) if __name__ == __main__: n = 666 x = 3.1415 Print[The answer is, 42] Print[Tons of spam:, n:6] Print[x:5:2, squared is, x*x:10:4] Print[One, Two, ...] Print[Buckle my shoe] # -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Pascaloid print substitute (Replacement for print inPython 3.0)

2005-09-06 Thread Greg Ewing
Raymond Hettinger wrote: Print[One, Two, ...] Print[Buckle my shoe] The ellipsis was a nice touch. I've been wondering whether it would be worth allowing ellipses to appear in other places besides slice indices, so it could be used in a print-function and other such purposes without

[Python-Dev] Simplify the file-like-object interface (Replacement for print in Python 3.0)

2005-09-06 Thread Greg Ewing
Fredrik Lundh wrote: (you completely missed the point -- today's print mechanism works on *any* object that implements a write method, no just file objects. saying that oh, all you need is to add a method or here's a nice mixin doesn't give you a print replacement) While we're on the

Re: [Python-Dev] Example for property violates Python is not a one pass compiler

2005-09-06 Thread Greg Ewing
Phillip J. Eby wrote: I'm not sure where you got the Python is not a one pass compiler idea; I don't recall having seen this meme anywhere before, and I don't see how it's meaningful anyway. Indeed, Python's bytecode compiler essentially *is* a one-pass compiler (or at least it used to be --

Re: [Python-Dev] String views

2005-09-06 Thread Greg Ewing
[EMAIL PROTECTED] wrote: Greg If a Python function is clearly wrapping a C function, one doesn't Greg expect to be able to pass strings with embedded NULs to it. Isn't that just floating an implementation detail up to the programmer (who may well not be POSIX- or Unix-aware)? Yes,

Re: [Python-Dev] Simplify the file-like-object interface (Replacement for print in Python 3.0)

2005-09-06 Thread Greg Ewing
Fredrik Lundh wrote: maybe some variation of http://www.python.org/peps/pep-0246.html combined with default adapters could come in handy here ? I really hope we can get by with something much less heavyweight than that. I'm far from convinced that something like PEP 246 proposes is

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-06 Thread Greg Ewing
Guido van Rossum wrote: So let's call it the Swiss Army Knife (...Not) API design pattern. Aha! Maybe this is the long-lost 20th principle from the Zen of Python? Greg ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Simplify the file-like-object interface (Replacement for print in Python 3.0)

2005-09-06 Thread Greg Ewing
attributes and methods can be inherited from multiple base classes, however, if you're willing to write the necessary C code to create the type object dynamically, as would happen if it were being defined with Python code. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] string formatting options and removing basestring.__mod__ (WAS: Replacement for print in Python 3.0)

2005-09-06 Thread Greg Ewing
will replace it. And-then-we-can-call-it-PyBol-3000-ly, -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] reference counting in Py3K

2005-09-06 Thread Greg Ewing
of automatically. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] reference counting in Py3K

2005-09-07 Thread Greg Ewing
details might yet change. I'd want another couple of releases before calling it finished. When I do reach that point, I'd be perfectly willing to contribute it to the PSF. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] reference counting in Py3K

2005-09-07 Thread Greg Ewing
lookups, which was horribly slow. I think the latest version now creates string objects at module initialization to avoid this issue, though. Yes, it now precreates and interns all identifier strings, which should help considerably. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-08 Thread Greg Ewing
and others not. EIBTI here, I feel. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Python 3 executable name

2005-09-11 Thread Greg Ewing
Oren Tirosh wrote: perhaps the Python 3 executable should have a different name as part of the standard distribution? I suggest py / py.exe Or python3? EIBTI :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] PEP 3000 and iterators

2005-09-11 Thread Greg Ewing
. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] unintentional and unsafe use of realpath()

2005-09-11 Thread Greg Ewing
? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-11 Thread Greg Ewing
Nick Coghlan wrote: Not to mention the annoyingly large number of fonts that make '`' and ''' look virtually identical :( Well, you need to be careful about choice of font for programming anyway, for 0/O, 1/l, etc. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Python 3 executable name

2005-09-12 Thread Greg Ewing
Oren Tirosh wrote: I suggest an explicitly and permanently different name for the interpreter executable of this new and incompatible branch of the language. I want Python 3 scripts starting with #! to have an average shelf life longer than 18 months. That makes sense, but I'd prefer

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-14 Thread Greg Ewing
Nathan Bullock wrote: I find that I quite often want a function that will give me a relative path from path A to path B. I have created such a function, but it would be nice if it was in the standard library. +1 from me. It's a fairly common thing to want to do. Greg

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-15 Thread Greg Ewing
Trent Mick wrote: If this *does* get added (I'm +0) then let's call it relpath or relpathto as in the various implementations out there: +1 on that, too. Preferably just relpath. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] python optimization

2005-09-15 Thread Greg Ewing
... import dis dis.dis(f) 2 0 LOAD_CONST 1 (2) 3 LOAD_CONST 2 (3) 6 BINARY_ADD 7 RETURN_VALUE 8 LOAD_CONST 0 (None) 11 RETURN_VALUE -- Greg Ewing, Computer

Re: [Python-Dev] removing nested tuple function parameters

2005-09-18 Thread Greg Ewing
Brett Cannon wrote: Would anyone really throw a huge fit if they went away? I am willing to write a PEP for their removal in 2.6 with a deprecation in 2.5 if people are up for it. -1. I don't think this could realistically be done before 3.0, because it would break a lot of existing code for

Re: [Python-Dev] list splicing

2005-09-18 Thread Greg Ewing
Karl Chen wrote: Hi, has anybody considered adding something like this: a = [1, 2] [ 'x', *a, 'y'] as syntactic sugar for a = [1, 2] [ 'x' ] + a + [ 'y' ]. You can write that as a = [1, 2] a[1:1] = a Greg ___ Python-Dev

Re: [Python-Dev] removing nested tuple function parameters

2005-09-18 Thread Greg Ewing
François Pinard wrote: The only practical reason to like this feature is sparing the need of finding an otherwise useless name for the formal argument. If the argument represents a coherent enough concept to be passed in as a tuple in the first place, it should be possible to find a meaningful

Re: [Python-Dev] removing nested tuple function parameters

2005-09-19 Thread Greg Ewing
with tuples. That might be a reasonable idea to consider for Py3k in any case. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary

Re: [Python-Dev] removing nested tuple function parameters

2005-09-19 Thread Greg Ewing
complex. But it's a rather selective kind of consistency. To be truly consistent in this sense, arbitrary lvalues would have to be allowed in the parameter list. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] removing nested tuple function parameters

2005-09-19 Thread Greg Ewing
where the call was. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] and and or operators in Py3.0

2005-09-19 Thread Greg Ewing
the language because of this. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-19 Thread Greg Ewing
/mailman/options/python-dev/greg.ewing%40canterbury.ac.nz -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL

Re: [Python-Dev] For/while/if statements/comprehension/generator expressions unification

2005-09-20 Thread Greg Ewing
Alexander Myodov wrote: for i in largelist while !found: This doesn't cover enough use cases to be worth it, IMO. The exit condition is often buried in the middle of other statements in the loop, not right at the beginning. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-20 Thread Greg Ewing
that would not be so. E.g. I might be generating pathames to go into a tar file that will be unpacked in a different place or on another system. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-20 Thread Greg Ewing
, it's easy to miss the conditional while skimming. Guido wrote that while he was in listen-to-the-masses mode. If he's switched back to follow-my-instincts mode, it may need to be re-evaluated. -- Greg Ewing, Computer Science Dept, +--+ University

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-20 Thread Greg Ewing
needing any more keywords: x if b else y if c else z But if you require parens, it's not so nice: (x if b else (y if c else z)) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch

Re: [Python-Dev] bool(iter([])) changed between 2.3 and 2.4

2005-09-20 Thread Greg Ewing
, an exhausted list iterator is false; probably by virtue of having a __len__() method that returns the number of remaining items. This seems like a misfeature to me. In fact I think an iterator having a len() method at all is a misfeature -- the concept doesn't make sense. -- Greg Ewing, Computer Science

Re: [Python-Dev] and and or operators in Py3.0

2005-09-20 Thread Greg Ewing
-short-circuiting, only that they coerce their evaluated operands to bool. Short-circuiting vs. non-short-circuiting is an orthogonal issue. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] and and or operators in Py3.0

2005-09-20 Thread Greg Ewing
Fredrik Lundh wrote: for Python 3000, I'd recommend switching to and then and or else instead of the current ambiguous single-keyword versions. And then we could call the language Pyffel. :-) -- Greg Ewing, Computer Science Dept, +--+ University

Re: [Python-Dev] bool(iter([])) changed between 2.3 and 2.4

2005-09-21 Thread Greg Ewing
, as is the default for user-defined classes. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-21 Thread Greg Ewing
Ron Adam wrote: (a if e then b) ((a1 if e1 then b1) if e then b) (a if e then (a2 if e2 then b2)) ((a1 if e1 then b1) if e then (a2 if e2 then b2)) I think you mean 'else' rather than 'then' in all those, don't you? -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-21 Thread Greg Ewing
has a bone, happy sounds unnatural. So I still prefer a if b else c to any of the alternatives, and I still think parens should not be required. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] bool(iter([])) changed between 2.3 and 2.4

2005-09-22 Thread Greg Ewing
of iterators associated with particular types is too much to fit in my brain. I'd rather they all had the same interface. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Visibility scope for for/while/if statements

2005-09-22 Thread Greg Ewing
the documentation slightly simpler, since LCs can be described fully and accurately in terms of translation to for-loops. Whether those are *good* reasons or not is debatable. In Py3k it's possible that this will be resolved by making for-loop variables local to the loop as well. Or maybe not. -- Greg Ewing

Re: [Python-Dev] Visibility scope for for/while/if statements

2005-09-23 Thread Greg Ewing
Nick Coghlan wrote: Python, however, uses a dynamic name binding system and scopes are expensive because they require setting up all of the machinery to support nested visibility. Scopes within a function needn't be anywhere near as expensive as scopes for nested functions are. The compiler

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-24 Thread Greg Ewing
Terry Reedy wrote: Now, can you honestly say that you would (naively) read return foo if bar else baz and be certain you knew what it meant? I can honestly say that, given I knew I was reading Python code, it would never have entered by head to read foo if as meaning that foo was the

Re: [Python-Dev] Active Objects in Python

2005-09-27 Thread Greg Ewing
) # Do something with the next message I don't see how that helps, since makeSomeBlockingCall() is evaluated (and therefore blocks) *before* the yield happens. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] Adding a conditional expression in Py3.0

2005-09-29 Thread Greg Ewing
Nick Coghlan wrote: i.e., it's like an or, only we're asking that the decision be made based on something other than the truth value of the left hand operand. Hmmm, then maybe it should be a or c if b or perhaps a or, if b, c :-) -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Removing the block stack (was Re: PEP 343 and __with__)

2005-10-09 Thread Greg Ewing
the calling frame straight into the called one. Or is this already done these days? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary

Re: [Python-Dev] New PEP 342 suggestion: result() and allow return with arguments in generators (was Re: PEP 342 suggestion: start(), __call__() and unwind_call() methods)

2005-10-09 Thread Greg Ewing
returning a value from a function by storing it in a global rather than using a return statement. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned

Re: [Python-Dev] PEP 342 suggestion: start(), __call__() and unwind_call() methods

2005-10-09 Thread Greg Ewing
for returning things. This would make the for-loop situation even safer, since then you could distinguish between falling off the end of a generator and executing 'return None' inside it. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury

Re: [Python-Dev] Extending tuple unpacking

2005-10-09 Thread Greg Ewing
is concerned. The pattern of thinking is the same: I want to deal with the first n of these things individually, and the rest collectively. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Pythonic concurrency

2005-10-10 Thread Greg Ewing
. If you want a thread that can preempt others, you give it a higher priority. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Greg Ewing
to answer newbie variable variable questions, to which the *correct* answer is invariably start thinking in Python, not bash/perl/tcl/PHP/ whatever. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Extending tuple unpacking

2005-10-11 Thread Greg Ewing
Ron Adam wrote: My concern is if it's used outside of functions, then on the left hand side of assignments, it will be used to pack, but if used on the right hand side it will be to unpack. I don't see why that should be any more confusing than the fact that commas denote tuple packing on

Re: [Python-Dev] Extending tuple unpacking

2005-10-11 Thread Greg Ewing
Guido van Rossum wrote: BTW, what should [a, b, *rest] = (1, 2, 3, 4, 5) do? Should it set rest to (3, 4, 5) or to [3, 4, 5]? Whatever type is chosen, it should be the same type, always. The rhs could be any iterable, not just a tuple or a list. Making a special case of preserving one

[Python-Dev] Autoloading? (Making Queue.Queue easier to use)

2005-10-11 Thread Greg Ewing
mechanism for lookups in module namespaces. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Fwd: defaultproperty

2005-10-11 Thread Greg Ewing
-level tools should go in their own suitably-named modules. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL

Re: [Python-Dev] Autoloading? (Making Queue.Queue easier to use)

2005-10-12 Thread Greg Ewing
as to suggest doing this, rather pointing out that, if we had an autoloading mechanism, this would be an obvious use case for it. I'm not familiar with the clever trick Greg is proposing, I'll see if I can cook up an example of it to show. Be warned, it is very hackish... -- Greg Ewing, Computer

[Python-Dev] Assignment to __class__ of module? (Autoloading? (Making Queue.Queue easier to use))

2005-10-12 Thread Greg Ewing
for heap types Have the rules concerning assignent to __class__ been made more restrictive recently? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Autoloading? (Making Queue.Queue easier to use)

2005-10-12 Thread Greg Ewing
#-- -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

[Python-Dev] Simplify lnotab? (AST branch update)

2005-10-13 Thread Greg Ewing
the lnotab table? How about getting rid of all the delicate code and replacing it with something much simpler? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Assignment to __class__ of module? (Autoloading? (Making Queue.Queue easier to use))

2005-10-13 Thread Greg Ewing
case it's a class.) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Simplify lnotab? (AST branch update)

2005-10-13 Thread Greg Ewing
no. indexes a tuple of file names attached to the code object. All entries are 32-bit integers. Easy to generate, easy to look up with a binary search, should be big enough for everyone except those generating obscenely huge code objects on 64-bit platforms. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Early PEP draft (For Python 3000?)

2005-10-13 Thread Greg Ewing
for this to fail. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Assignment to __class__ of module? (Autoloading? (Making Queue.Queue easier to use))

2005-10-14 Thread Greg Ewing
Phillip J. Eby wrote: I meant that just changing its class is a mutation, and since immutables can be shared or cached, that could lead to problems. So I do think it's a reasonable implementation limit to disallow changing the __class__ of an immutable. That's a fair point. Although I

Re: [Python-Dev] Autoloading? (Making Queue.Queue easier to use)

2005-10-14 Thread Greg Ewing
Sokolov Yura wrote: May be allow modules to define __getattr__ ? I think I like the descriptor idea better. Besides being more in keeping with modern practice, it would allow for things like from autoloading import autoload Foo = autoload('foomodule', 'Foo') Blarg =

Re: [Python-Dev] Simplify lnotab? (AST branch update)

2005-10-14 Thread Greg Ewing
Phillip J. Eby wrote: A more compact scheme is possible, by using two tables - a bytecode-line number table, and a line number- file table. If you have to encode multiple files, you just offset their line numbers by the size of the other files, More straightforwardly, the second

Re: [Python-Dev] Simplify lnotab? (AST branch update)

2005-10-15 Thread Greg Ewing
Phillip J. Eby wrote: At 08:07 PM 10/14/2005 +1300, Greg Ewing wrote: More straightforwardly, the second table could just be a bytecode - file number mapping. That would use more space in any case involving multiple files. Are you sure? Most of the time you're going to have chunks

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-16 Thread Greg Ewing
of a good solution to that, yet. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Guido v. Python, Round 1

2005-10-17 Thread Greg Ewing
Neal Norwitz wrote: We all know Guido likes Python. But the real question is do pythons like Guido? http://python.org/neal/ ??? I get a 404 for this. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-17 Thread Greg Ewing
but just use the name of doesn't seem right. And in my version, it's not *really* redundant, since the name is only used to derive the names of the accessor methods. It doesn't *have* to be the same as the property name, although using anything else could justifiably be regarded as insane... -- Greg

Re: [Python-Dev] Definining properties - a use case for class decorators?

2005-10-17 Thread Greg Ewing
Guido van Rossum wrote: Let's change the property built-in so that its arguments can be either functions or strings (or None). If an argument is a string, it should be a method name, and the method is looked up by that name each time the property is used. That sounds reasonable. -- Greg

[Python-Dev] Property syntax for Py3k (properties and block statement)

2005-10-18 Thread Greg Ewing
Antoine Pitrou wrote: I suppose something like: class C(object): x = prop: Yay for property x! def __get__(self): return self._x def __set__(self, value): self._x = x I've just looked at Steven Bethard's recipe, and it seems to give

Re: [Python-Dev] Divorcing str and unicode (no more implicit conversions).

2005-10-24 Thread Greg Ewing
indexing is O(log n). Not as good as O(1) but a lot better than O(n). -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Divorcing str and unicode (no more implicit conversions).

2005-10-24 Thread Greg Ewing
, especially if there is an easy way to explicitly materialise the view as an independent string when wanted. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Divorcing str and unicode (no more implicitconversions).

2005-10-25 Thread Greg Ewing
Martin v. Löwis wrote: For window.draw, people will readily understand that they are supposed to use Latin letters. More generally, they will know what script to use just from looking at the identifier. Would it help if an identifier were required to be made up of letters from the same

Re: [Python-Dev] Divorcing str and unicode (no more implicitconversions).

2005-10-26 Thread Greg Ewing
M.-A. Lemburg wrote: If you are told to debug a program written by say a Japanese programmer using Japanese identifiers you are going to have a really hard time. Or you could look upon it as an opportunity to broaden your mental horizons by learning some Japanese. :-) -- Greg Ewing

Re: [Python-Dev] Divorcing str and unicode (no more implicit conversions).

2005-10-31 Thread Greg Ewing
the characters you want, for your own in-house use. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] a different kind of reduce...

2005-10-31 Thread Greg Ewing
things like up3levels = dirname ** 3 -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Why should the default hash(x) == id(x)?

2005-11-02 Thread Greg Ewing
references the new object. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Weak references: dereference notification

2005-11-09 Thread Greg Ewing
to it will be broken. Or does your resurrection code intervene before that happens? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc

Re: [Python-Dev] Event loops, PyOS_InputHook, and Tkinter

2005-11-09 Thread Greg Ewing
some way of hooking other things into it (as does Tkinter), but whichever one you're using, it likes to be in charge. Code which blocks reading from standard input doesn't fit very well into any of them. -- Greg Ewing, Computer Science Dept, +--+ University

Re: [Python-Dev] Weak references: dereference notification

2005-11-11 Thread Greg Ewing
Gustavo J. A. M. Carneiro wrote: The object isn't really destroyed. Simply ob_refcnt drops to zero, then tp_dealloc is called, which is supposed to destroy it. But since I wrote tp_dealloc, I choose not to destroy it, Be aware that a C subclass of your wrapper that overrides tp_dealloc is

Re: [Python-Dev] Event loops, PyOS_InputHook, and Tkinter

2005-11-11 Thread Greg Ewing
Michiel Jan Laurens de Hoon wrote: I have an extension module for scientific visualization. This extension module opens one or more windows, in which plots can be made. What sort of windows are these? Are you using an existing GUI toolkit, or rolling your own? For the graphics windows to

Re: [Python-Dev] Event loops, PyOS_InputHook, and Tkinter

2005-11-12 Thread Greg Ewing
[EMAIL PROTECTED] wrote: Python could dictate that the way to play ball is for other packages (Tkinter, PyGtk, wxPython, etc) to feed Python the (socket, callback) pair. Then you have a uniform way to control event-driven applications. Certainly, if all other event-driven packages are

Re: [Python-Dev] Event loops, PyOS_InputHook, and Tkinter

2005-11-12 Thread Greg Ewing
Noam Raphael wrote: All that is needed to make Tkinter and Michiels' code run together is a way to say add this callback to the input hook instead of the current replace the current input hook with this callback. Then, when the interpreter is idle, it will call all the registered callbacks,

Re: [Python-Dev] Event loops, PyOS_InputHook, and Tkinter

2005-11-13 Thread Greg Ewing
Noam Raphael wrote: On 11/13/05, Greg Ewing [EMAIL PROTECTED] wrote: Noam Raphael wrote: callback. Then, when the interpreter is idle, it will call all the registered callbacks, one at a time, and everyone would be happy. Except for those who don't like busy waiting. I'm

Re: [Python-Dev] str.dedent

2005-11-14 Thread Greg Ewing
-savvy language seems a wart. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [EMAIL PROTECTED

Re: [Python-Dev] Memory management in the AST parser compiler

2005-11-28 Thread Greg Ewing
Here's a somewhat radical idea: Why not write the parser and bytecode compiler in Python? A .pyc could be bootstrapped from it and frozen into the executable. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen

Re: [Python-Dev] hasattr and properties

2005-12-07 Thread Greg Ewing
: return True else: look in the instance dict for the attribute There wouldn't be a need to rely on catching exceptions at all, then. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp

Re: [Python-Dev] Tracker anonymity

2005-12-07 Thread Greg Ewing
and notifying the submitter? I don't see why a full-blown registration and login should be required. If the submitter chooses not to supply an email address, then they have no grounds for being upset at not receiving any notifications! -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] hasattr and properties

2005-12-08 Thread Greg Ewing
Guido van Rossum wrote: Um, that does't work for types which customize __getattribute__ or __getattr__ in various ways. There could be a __hasattr__ slot in the class itself for that purpose. IMO a property that has a side effect (other than updating a cache or statistics or perhaps

Re: [Python-Dev] Deprecate __ private (was Re: PEP 8 updates/clarifications)

2005-12-12 Thread Greg Ewing
be beefed up to include the module name somehow, so that it works reliably (or at least more reliably than now). -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Greg Ewing
Guido van Rossum wrote: You *might* want to separate classes with two blank lines if the methods within them are separated by single blank lines, but even there it's probably overkill. Lately I've taken to putting a separator like this between consecutive class definitions of any substantial

<    1   2   3   4   5   6   7   8   9   10   >