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 cour

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

2005-09-01 Thread Greg Ewing
!" As I recall, this has been considered 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 New

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

2005-09-01 Thread Greg Ewing
e. A Python version of this operator 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 | who

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

2005-09-04 Thread Greg Ewing
and easy to use as possible. If writing to stdout 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 NewZealandC

Re: [Python-Dev] String views

2005-09-04 Thread Greg Ewing
rings with embedded NULs 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 citi

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

2005-09-04 Thread Greg Ewing
["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 w

[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: [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 b

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)

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

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 http://mail.python.org/mail

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

2005-09-06 Thread Greg Ewing
important in a dynamic language like Python anyway, since most of the interesting things happen at run time. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

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

2005-09-06 Thread Greg Ewing
the base C struct. Dynamic 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. -- Gr

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

2005-09-06 Thread Greg Ewing
cture-formatting function would be a nice thing to have as an alternative to %-formatting or whatever 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

Re: [Python-Dev] reference counting in Py3K

2005-09-06 Thread Greg Ewing
so that all the refcount/GC issues are taken care of automatically. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owne

Re: [Python-Dev] reference counting in Py3K

2005-09-07 Thread Greg Ewing
I think, although some 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

Re: [Python-Dev] reference counting in Py3K

2005-09-07 Thread Greg Ewing
27;t used the absolute latest version of Pyrex, but older versions > also used C strings for attribute 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 inte

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

2005-09-08 Thread Greg Ewing
solution. Maybe backquotes could be repurposed in Py3k for interpolated string literals? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subs

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

2005-09-08 Thread Greg Ewing
nslated automatically 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

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, +--+ Un

Re: [Python-Dev] PEP 3000 and iterators

2005-09-11 Thread Greg Ewing
r too tricky and error-prone to be worth the trouble to me. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owne

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

2005-09-11 Thread Greg Ewing
using realpath() at all? -- 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-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. --

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 some

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, +--

Re: [Python-Dev] python optimization

2005-09-15 Thread Greg Ewing
ntly isn't: >>> def f(): ... return 2+3 ... >>> 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

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 f

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-

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 meaningfu

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

2005-09-19 Thread Greg Ewing
pathnames. It's up to the user to ensure it makes sense to do so, e.g. by resolving symlinks beforehand if necessary. The alternative would be for relpath to do this itself, but that would make it very unusual compared to the other path-munging functions, none of which

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

2005-09-19 Thread Greg Ewing
would now have to take a *args when called 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 Z

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

2005-09-19 Thread Greg Ewing
ake the language > slightly more 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

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

2005-09-19 Thread Greg Ewing
k to find 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

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

2005-09-19 Thread Greg Ewing
duce separate bytecodes for implementing 'and' and 'or'. No need to change the language because of this. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Chris

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

2005-09-19 Thread Greg Ewing
; Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/greg.ewing%40canterbury.ac.nz -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, |

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 Scie

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

2005-09-20 Thread Greg Ewing
file system, but I can easily imagine cases where 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

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

2005-09-20 Thread Greg Ewing
iss 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
b else y" is that it chains without 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,

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

2005-09-20 Thread Greg Ewing
. In 2.4, 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. -

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

2005-09-20 Thread Greg Ewing
short-circuiting? I don't think the OP was suggesting that 'and' and 'or' be non-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, +-

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, +--

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

2005-09-21 Thread Greg Ewing
re true, 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. | [E

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?

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

2005-09-21 Thread Greg Ewing
one" as "If he has a bone, my dog is happy", which also sounds natural, whereas "My dog is, if he 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

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

2005-09-21 Thread Greg Ewing
d_value if color == 'red' else blue_value as if red_value: return color == 'red' else: return blue_value ? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a |

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

2005-09-22 Thread Greg Ewing
ack of the peculiarities 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

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

2005-09-22 Thread Greg Ewing
ementation and (2) it makes 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 l

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 compil

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" wa

Re: [Python-Dev] Active Objects in Python

2005-09-27 Thread Greg Ewing
msg = yield makeSomeBlockingCall(self) ># 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, +--

Re: [Python-Dev] RFC: readproperty

2005-09-28 Thread Greg Ewing
Guido van Rossum wrote: > I think we need to be real careful with chosing a name In Eiffel, the keyword "once" is used for something analogous -- a method that is called once the first time it's referenced, and the return value cached. So perhaps this could be called a "on

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

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

2005-10-09 Thread Greg Ewing
he args from 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-own

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
l right to me -- sort of like 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,

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

2005-10-09 Thread Greg Ewing
leave StopIteration itself alone altogether and have a subclass StopIterationWithValue 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, Comp

Re: [Python-Dev] Extending tuple unpacking

2005-10-09 Thread Greg Ewing
ng similarity where this particular feature 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 Canterbu

Re: [Python-Dev] Pythonic concurrency

2005-10-10 Thread Greg Ewing
ority, so there's no preemption. 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

Re: [Python-Dev] PEP 3000 and exec

2005-10-10 Thread Greg Ewing
eems to be used 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,

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

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

2005-10-11 Thread Greg Ewing
omething like a descriptor 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 US

Re: [Python-Dev] Proposed changes to PEP 343

2005-10-11 Thread Greg Ewing
into a function that returns a context manager. So maybe the decorator should be called 'contextmanagergenerator'. Or perhaps not, since that's getting rather too much of an eyeful to parse... -- Greg Ewing, Computer Science Dept, +--+ Univ

Re: [Python-Dev] Fwd: defaultproperty

2005-10-11 Thread Greg Ewing
precise and helpful. Other kinds of meta-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

Re: [Python-Dev] Extending tuple unpacking

2005-10-11 Thread Greg Ewing
h > argument lists are currently mutually exclusive. Although, if you had that > rule, I'd want to be able to write: > >def f(a, b, *, foo=1, bar=2): pass Yes, I agree. -- Greg Ewing, Computer Science Dept, +--+ University of

Re: [Python-Dev] Extending tuple unpacking

2005-10-11 Thread Greg Ewing
afterwards. This would actually synergise nicely with * in tuple unpacking: def f(*args): a, b, *rest = args And with one further small extension, you could even get that into the argument list as well: def f(*(a, b, *rest)): ... -- Greg Ewing, Computer Science Dept,

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

2005-10-12 Thread Greg Ewing
27;t actually going so far 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

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

2005-10-12 Thread Greg Ewing
ssignment: only 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 | Christchur

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

2005-10-12 Thread Greg Ewing
ich is clearly related to threading, but is open for the addition of future thread-related features that might arise. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurc

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

2005-10-12 Thread Greg Ewing
hat doesn't exist today. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of

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

2005-10-12 Thread Greg Ewing
s first needed. Queue then becomes accessible through > ‘threading.Queue’ Yes. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary o

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

2005-10-12 Thread Greg Ewing
Phillip J. Eby wrote: > At 01:47 PM 10/13/2005 +1300, Greg Ewing wrote: > >> I'm trying to change the __class__ of a newly-imported >> module to a subclass of types.ModuleType > > It happened in Python 2.3, actually. Is there a discussion anywhere about the reas

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

2005-10-12 Thread Greg Ewing
ne. sys.modules[module_name] = m2 del module m2._autoload = mapping #-- -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, Ne

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

2005-10-13 Thread Greg Ewing
Phillip J. Eby wrote: > Actually, it's desirable to be *able* to do it for anything. But certainly > for otherwise-immutable objects it can lead to aliasing issues. Even for immutables, it could be useful to be able to add behaviour that doesn't mutate anything. -- Greg

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

2005-10-13 Thread Greg Ewing
compress 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, Ne

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

2005-10-13 Thread Greg Ewing
y a module. (In my use 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 I

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

2005-10-13 Thread Greg Ewing
e next entry. The file 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,

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

2005-10-13 Thread Greg Ewing
's no need 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

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

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 = autoload('blargmod

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 seco

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 th

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

2005-10-16 Thread Greg Ewing
name twice, once on the lhs and once as an argument. I haven't thought of a good solution to that, yet. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, Ne

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, |

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

2005-10-17 Thread Greg Ewing
have* to be the same as the property name, although using anything else could justifiably be regarded as insane... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZeal

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

2005-10-17 Thread Greg Ewing
at sounds reasonable. -- 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] Definining properties - a use case for class decorators?

2005-10-17 Thread Greg Ewing
Barry Warsaw wrote: > Ick, for all the reasons that strings are less appealing than names. > IMO, there's not enough advantage in having the property() call before > the functions than after. That's not the only benefit - you also get overridability of the accessor metho

[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

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

2005-10-24 Thread Greg Ewing
s or something, so 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 sub

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

2005-10-24 Thread Greg Ewing
of a concern than it is now, 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

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 alph

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. :-) -- G

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

2005-10-26 Thread Greg Ewing
beyond the issue of alphabets there's also the question of whether accented characters should be considered distinct. I can see quite a few holy flame wars erupting over that... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A cit

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

2005-10-31 Thread Greg Ewing
ts you use all 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. | [E

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

2005-10-31 Thread Greg Ewing
so that you could do 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.

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

2005-11-02 Thread Greg Ewing
dict now unintentionally 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

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

2005-11-09 Thread Greg Ewing
ferences 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

<    19   20   21   22   23   24   25   >