Re: [Python-Dev] Playing with a new theme for the docs

2012-03-21 Thread Greg Ewing
Ned Batchelder wrote: Any of the tweaks people are suggesting could be applied individually using this technique. We could just as easily choose to make the site left-justified, and let the full-justification fans use custom stylesheets to get it. Is it really necessary for the site to speci

Re: [Python-Dev] Playing with a new theme for the docs

2012-03-22 Thread Greg Ewing
Can we please get rid of the sidebar, or at least provide a way of turning it off? I don't think it's anywhere near useful enough to be worth the space it takes up. You can only use it when you're scrolled to the top of the page, otherwise it's just a useless empty space. Also, I often want to pu

Re: [Python-Dev] Playing with a new theme for the docs

2012-03-23 Thread Greg Ewing
Glyph Lefkowitz wrote: "do I have to resize my browser every time I visit a new site to get a decent width for reading". If all sites left the width to the browser, then I would be able to make my browser window a width that is comfortable for me with my chosen font size and leave it that way.

Re: [Python-Dev] Playing with a new theme for the docs

2012-03-23 Thread Greg Ewing
PJ Eby wrote: Weird - I have the exact *opposite* problem, where I have to resize my window because somebody *didn't* set their text max-width sanely (to a reasonable value based on ems instead of pixels), and I have nearly 1920 pixels of raw text spanning my screen. If you don't want 1920-p

Re: [Python-Dev] Playing with a new theme for the docs, iteration 2

2012-03-25 Thread Greg Ewing
Steven D'Aprano wrote: While I sympathize with the ideal of making the docs readable, particular for those of us who don't have 20-20 vision, "must be readable from halfway across the room" is setting the bar too high. The point is that reducing contrast never makes anything more readable, an

Re: [Python-Dev] an alternative to embedding policy in PEP 418 (was: PEP 418: Add monotonic clock)

2012-04-03 Thread Greg Ewing
Cameron Simpson wrote: People have been saying "hires" throughout the threads I think, but I for one would be slightly happier with "highres". hirez? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/py

Re: [Python-Dev] PEP 418 is too divisive and confusing and should be postponed

2012-04-04 Thread Greg Ewing
Lennart Regebro wrote: Since the only monotonic clock that can be adjusted by NTP is Linux' CLOCK_MONOTONIC, if we avoid it, then time.monotonic() would always give a clock that isn't adjusted by NTP. I thought we decided that NTP adjustment isn't an issue, because it's always gradual. -- Greg

Re: [Python-Dev] PEP 418 is too divisive and confusing and should be postponed

2012-04-05 Thread Greg Ewing
Cameron Simpson wrote: A monotonic clock never returns t0 > t1 for t0, t1 being two adjacent polls of the clock. On its own it says nothing about steadiness or correlation with real world time. No, no, no. This is the strict mathematical meaning of the word "monotonic", but the way it's used

Re: [Python-Dev] PEP 418 is too divisive and confusing and should be postponed

2012-04-06 Thread Greg Ewing
Cameron Simpson wrote: I maintain that "monotonic" still means what I said, and that it is the combination of the word with "clock" that brings in your other criteria. I'm not trying to redefine the word "monotonic" in general. All I'm saying is that *if* the PEP is going to talk about a "mono

Re: [Python-Dev] PEP 418 is too divisive and confusing and should be postponed

2012-04-06 Thread Greg Ewing
Steven D'Aprano wrote: Greg Ewing wrote: the important thing about a clock that it *keeps going forward* That would be a *strictly* monotonic clock, as opposed to merely monotonic. Well, yes, but even that's not enough -- it needs to go forward at a reasonably constant rate, othe

[Python-Dev] Change to yield-from implementation

2012-04-09 Thread Greg Ewing
Mark Shannon wrote: We have recently removed the f_yieldfrom field from the frame object. (http://bugs.python.org/issue14230) Hey, wait a minute. Did anyone consider the performance effect of that change on deeply nested yield-froms? The way it was, a yield-from chain was traversed by a very

Re: [Python-Dev] cpython: Fix email post-commit review comments.

2012-04-18 Thread Greg Ewing
Antoine Pitrou wrote: (and here we see why reference-stealing APIs are a nuisance: because you never know in advance whether a function will steal a reference or not, and you have to read the docs for each and every C API call you make) Fortunately, they're very rare, so you don't encounter th

Re: [Python-Dev] cpython: Fix email post-commit review comments.

2012-04-18 Thread Greg Ewing
On 19/04/12 11:22, Tres Seaver wrote: Maybe we should mandate that their names end with '_rtfm'. +1 -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mai

Re: [Python-Dev] Cython for cPickle?

2012-04-22 Thread Greg Ewing
Alexandre Vassalotti wrote: We have custom stack and dictionary implementations just for the sake of speed. We also have fast paths for I/O operations and function calls. All of that could very likely be carried over almost unchanged into a Cython version. I don't see why it should take mult

Re: [Python-Dev] [Python-checkins] cpython: Issue #14127: Add ns= parameter to utime, futimes, and lutimes.

2012-05-04 Thread Greg Ewing
Larry Hastings wrote: On 05/03/2012 10:07 PM, Benjamin Peterson wrote: +if (times && ns) { +PyErr_Format(PyExc_RuntimeError, Why not a ValueError or TypeError? Well it's certainly not a TypeError. TypeError is not just for values of the wrong type, it's also used for passing

Re: [Python-Dev] Adding types.build_class for 3.3

2012-05-07 Thread Greg Ewing
Nick Coghlan wrote: Instead, I'm now thinking we should add a _types C extension module and expose the new function as types.build_class(). I don't want to add an entire new module just for this feature, and the types module seems like an appropriate home for it. Dunno. Currently the only thin

Re: [Python-Dev] [Python-checkins] cpython: Issue #14716: Change integer overflow check in unicode_writer_prepare()

2012-05-07 Thread Greg Ewing
Mark Dickinson wrote: Is the gain from this kind of micro-optimization really worth the cost of replacing obviously correct code with code whose correctness needs several minutes of thought? The original code isn't all that obviously correct to me either. I would need convincing that the arith

Re: [Python-Dev] Adding types.build_class for 3.3

2012-05-09 Thread Greg Ewing
Nick Coghlan wrote: In that case, consider me convinced: static method it is. -0.93. Static methods are generally unpythonic, IMO. Python is not Java -- we have modules. Something should only go in a class namespace if it somehow relates to that particular class, and other classes could might

Re: [Python-Dev] Adding types.build_class for 3.3

2012-05-10 Thread Greg Ewing
Nick Coghlan wrote: On Thu, May 10, 2012 at 10:03 AM, Greg Ewing wrote: Something should only go in a class namespace if it somehow relates to that particular class, and other classes could might implement it differently. That's not the case with build_class(). Not true - you *will*

Re: [Python-Dev] C-level duck typing

2012-05-16 Thread Greg Ewing
Dag wrote: I'm not asking you to consider the details of all that. Just to allow some kind of high-performance extensibility of PyTypeObject, so that we can *stop* bothering python-dev with specific requirements from our parallel universe of nearly-all-Cython-and-Fortran-and-C++ codebases :-)

Re: [Python-Dev] C-level duck typing

2012-05-16 Thread Greg Ewing
On 17/05/12 12:17, Robert Bradshaw wrote: This is exactly what was proposed to start this thread (with minimal collusion to avoid conflicts, specifically partitioning up a global ID space). Yes, but I think this part of the mechanism needs to be spelled out in more detail, perhaps in the form

Re: [Python-Dev] [Python-checkins] peps: Add PEP 422: Dynamic Class Decorators

2012-06-05 Thread Greg Ewing
PJ Eby wrote: At the least, if they're not going to be in decorator order, the member shouldn't be called "__decorators__". ;-) Obviously it should be called __srotaroced__. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.pyth

Re: [Python-Dev] TZ-aware local time

2012-06-05 Thread Greg Ewing
Alexander Belopolsky wrote: The problem is again the DST ambiguity. One day a year, datetime(y, m, d, 1, 30, tzinfo=Local) represents two different times and another day it represents no valid time. The documentation example (fixed in issue 9063) addresses the ambiguity by defaulting to standar

Re: [Python-Dev] Issue 2736: datetimes and Unix timestamps

2012-06-05 Thread Greg Ewing
Terry Reedy wrote: "A rich comparison method may return the singleton NotImplemented if it does not implement the operation for a given pair of arguments. By convention, False and True are returned for a successful comparison. However, these methods can return any value," That's to give the

Re: [Python-Dev] CFFI released

2012-06-18 Thread Greg Ewing
Is there any provision for keeping the compiled C code and distributing it along with an application? Requiring a C compiler to be present at all times could be a difficulty for Windows. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://m

Re: [Python-Dev] Memoryviews should expose the underlying memory address

2012-09-20 Thread Greg Ewing
Nick Coghlan wrote: I'm fine with exposing a memoryview.buffer_address attribute in 3.4. What about objects whose buffer address can change when the buffer isn't locked? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Greg Ewing
Antonio Cuni wrote: Traceback (most recent call last): File "", line 1, in TypeError: __complex__ should return a complex object i.e., the complex constructor does not check that __complex__ returns an actual complex, while the cmath functions do. Looks to me like cmath is being excessively

Re: [Python-Dev] return type of __complex__

2012-10-19 Thread Greg Ewing
Stephen J. Turnbull wrote: It's a design bug, yes. The question is, does it conform to documented behavior? The 2.7 docs say this about __complex__: Called to implement the built-in function complex() ... Should return a value of the appropriate type. So the question is whether float i

Re: [Python-Dev] return type of __complex__

2012-10-20 Thread Greg Ewing
I think I've changed my mind on this, since it was pointed out that if you're going to return a float instead of a complex, you should really be implementing __float__, not __complex__. So I think it's fine to require __complex__ to return a complex, and the docs should perhaps be clarified on th

Re: [Python-Dev] return type of __complex__

2012-10-20 Thread Greg Ewing
Chris Angelico wrote: Python 2 (future directives aside) also required you to explicitly ask for floating point. That was also changed in Python 3. The solution adopted was different, though: use different operators for int and float division. This means you can't accidentally end up with a flo

Re: [Python-Dev] return type of __complex__

2012-10-20 Thread Greg Ewing
Devin Jeanpierre wrote: (Complex numbers get a free pass because "complex numbers with rational real and imaginary parts" is not a memorable name for a type.) Complexional? -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.

Re: [Python-Dev] return type of __complex__

2012-10-21 Thread Greg Ewing
Steven D'Aprano wrote: When you're dealing with numbers that represent real quantities, getting a complex result is nearly always an error condition. Better to get an exception at the point that occurs, than somewhere distant when the number gets fed to %f formatting, or worse, no error at all,

Re: [Python-Dev] return type of __complex__

2012-10-21 Thread Greg Ewing
Stephen J. Turnbull wrote: Evidently somebody thought "float" was appropriate, or they would have just written "Returns a complex value." It's not quite as simple as that, because that paragraph in the docs is actually shared between the descriptions of __int__, __float__ and __complex__. So it

Re: [Python-Dev] Segmentaion fault with wrongly set PYTHONPATH on Windows

2012-10-22 Thread Greg Ewing
Stephen J. Turnbull wrote: For most users, it doesn't matter whether an environment variable is set incorrectly without their knowledge, or if the kernel is buggy, or if the disk is corrupt. And from Python's point of view, the world as a whole no longer makes. So it shuts down abnormally. Tha

Re: [Python-Dev] Okay to document the "exec tuple" form of the exec statement in Python 2.7?

2012-11-05 Thread Greg Ewing
Nick Coghlan wrote: On Mon, Nov 5, 2012 at 10:08 PM, Mark Dickinson wrote: In Python 2, the 'exec' statement supports 'exec'-ing a (statement, globals, locals) tuple: If this is a deliberate feature, I'd guess it's because exec is a statement rather than a function in Python 2, so you can't

Re: [Python-Dev] chained assignment weirdity

2012-11-06 Thread Greg Ewing
MRAB wrote: That would make augmented assignment more difficult. For example, how would you write the equivalent of "x -= y"? SUBTRACT x FROM y. CLOSE POST WITH SMILEY. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org

Re: [Python-Dev] performance of {} versus dict()

2012-11-14 Thread Greg Ewing
Chris Angelico wrote: Perhaps an alternative question: What can be done to make the latter less unpalatable? * We could introduce a new syntax such as {a = 1, b = 2}. * If the compiler were allowed to recognise builtins, it could turn dict(a = 1, b = 2) into {'a':1, 'b':2} automatically. -- G

Re: [Python-Dev] performance of {} versus dict(), de fmd(**kw): return kw trumps all ; -)

2012-11-15 Thread Greg Ewing
mar...@v.loewis.de wrote: It's faster than calling dict() because the dict code will create a second dictionary, and discard the keywords dictionary. Perhaps in the case where dict() is called with keyword args only, it could just return the passed-in keyword dictionary instead of creating anot

Re: [Python-Dev] performance of {} versus dict(), de fmd(**kw): return kw trumps all ; -)

2012-11-15 Thread Greg Ewing
Stefan Behnel wrote: This should work as long as this still creates a copy of d at some point: d = {...} dict(**d) It will -- the implementation of the function call opcode always creates a new keyword dict for passing to the called function. -- Greg __

Re: [Python-Dev] Draft PEP for time zone support.

2012-12-12 Thread Greg Ewing
On Tue, Dec 11, 2012 at 8:07 AM, Antoine Pitrou wrote: Do we have statistics showing that Python gets more use in summer? Well, pythons are cold-blooded, so they're probably more active during the warmer seasons... -- Greg ___ Python-Dev mailing li

Re: [Python-Dev] test___all__ polluting sys.modules?

2012-12-30 Thread Greg Ewing
Richard Oudkerk wrote: Personally I would like to get rid of the "purge globals" behaviour for modules deleted before shutdown has started: if someone manipulates sys.modules then they can just call gc.collect() if they want to promptly get rid of orphaned reference cycles. Now that we have c

Re: [Python-Dev] PEP 433: Add cloexec argument to functions creating file descriptors

2013-01-13 Thread Greg Ewing
Nick Coghlan wrote: Agreed, but it's the security implications that let us even contemplate the backwards compatibility break. I don't think that's a sufficient criterion for choosing a name. The backwards compatibility issue is a transitional thing, but we'll be stuck with the name forever. I

Re: [Python-Dev] PEP 433: Add cloexec argument to functions creating file descriptors

2013-01-14 Thread Greg Ewing
Nick Coghlan wrote: The problem is the mechanism is *not the same* on Windows and POSIX - the Windows mechanism (noinherit) means the file won't be accessible in child processes, the POSIX mechanism (cloexec) means it won't survive exec(). But since there is no such thing as a fork without exe

Re: [Python-Dev] Release or not release the GIL

2013-02-01 Thread Greg Ewing
Charles-François Natali wrote: Anyway, only dup2() should probably release the GIL. Depending on how your kernel is implemented, both pipe() and socketpair() could create file system entries, and therefore could block, although probably only for a very short time. -- Greg _

Re: [Python-Dev] Release or not release the GIL

2013-02-01 Thread Greg Ewing
Amaury Forgeot d'Arc wrote: One reasonable heuristic is to check the man page: if the syscall can return EINTR, then the GIL should be released. Hmmm, curious. According to the MacOSX man pages, both dup() and dup2() can return EINTR, but pipe() and socketpair() can't. I'm particularly

Re: [Python-Dev] os.path.join failure mode

2013-02-09 Thread Greg Ewing
Terry Reedy wrote: I agree. Since the exception type is not documented and since no one should intentionally pass anything but strings, and therefore should not be writing try: os.path.join(a,b) except AttributeError: barf() I think it would be acceptable to make a change in 3.4. Why sh

Re: [Python-Dev] efficient string concatenation (yep, from 2004)

2013-02-13 Thread Greg Ewing
Steven D'Aprano wrote: The documentation for strings is also clear that you should not rely on this optimization: > ... > It can, and does, fail on CPython as well, as it is sensitive to memory allocation details. If it's that unreliable, why was it ever implemented in the first place? --

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-28 Thread Greg Ewing
Guido van Rossum wrote: Here's a patch that gets rid of unbound methods, as discussed here before. A function's __get__ method now returns the function unchanged when called without an instance, instead of returning an unbound method object. I thought the main reason for existence of unbound method

Re: [Python-Dev] Let's get rid of unbound methods

2005-01-28 Thread Greg Ewing
Josiah Carlson wrote: While it seems that super() is the 'modern paradigm' for this, I have been using base.method(self, ...) for years now, and have been quite happy with it. I too would be very disappointed if base.method(self, ...) became somehow deprecated. Cooperative super calls are a differe

Re: [Python-Dev] Let's get rid of unbound methods

2005-01-28 Thread Greg Ewing
Tim Peters wrote: I expect that's because he stopped working on Zope code, so actually thinks it's odd again to see a gazillion methods like: class Registerer(my_base): def register(*args, **kws): my_base.register(*args, **kws) I second that! My PyGUI code is *full* of __init__ methods

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-16 Thread Greg Ewing
r unsigned otherwise. In Python the value itself knows whether it's signed or not. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsid

Re: [Python-Dev] builtin_id() returns negative numbers

2005-02-17 Thread Greg Ewing
more time machine activity to me. Any minute now you'll find there's suddenly a positive_id() builtin that's been there ever since 1.3 or so. And the 'P' format, then always never having just become useful, will have unappeared... -- Greg Ewing, Computer Science Dept,

Re: [Python-Dev] Eliminating the block stack (was Re: Store x Load x --> DupStore)

2005-02-20 Thread Greg Ewing
uter block. -- 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] Store x Load x --> DupStore

2005-02-20 Thread Greg Ewing
rosses block boundaries. It's not clear how big a win that is, due to the added opcodes even on non-error paths. Only exceptions and break statements would require stack pointer adjustment, and they're relatively rare. I don't think an extra opcode in those cases would mak

Re: [Python-Dev] UserString

2005-02-20 Thread Greg Ewing
hods, without getting tripped up by strings. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidi

Re: [Python-Dev] Comment regarding PEP 328

2005-02-24 Thread Greg Ewing
Josiah Carlson wrote: if we could change import in such a way that made standard library imports different from standard library imports, we could ...go on to prove that black is white and get ourselves killed by a python on the next zebra crossing. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] Adding any() and all()

2005-03-12 Thread Greg Ewing
Nick Coghlan wrote: A suggestion was made on c.l.p a while back to have a specific module dedicated to reductive operations. That is, just as itertools is oriented towards manipulating iterables and creating iterators, this module would be oriented towards consuming iterators in a reductive fash

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-12 Thread Greg Ewing
Brian Sabbey wrote: I prefer re-using the 'for' loop for this purpose because it allows the problem to be solved in a general way by re-using a structure with which most users are already familiar, and uses generators, which are easier to use in this case than defining a class with __exit__, __e

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-12 Thread Greg Ewing
Nick Coghlan wrote: That 'x in seq' bit still shouts "containment" to me rather than iteration, though. Perhaps repurposing 'from': (x from seq if f(x)) That rather breaks TOOWTDI though (since it is essentially new syntax for a for loop). And I have other hopes for the meaning of (x from ()).

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Greg Ewing
there is a mechanism for passing a code block as a thunk to an arbitrary function, the function is free to loop or not as it sees fit. I'd just prefer the spelling of it didn't force you to make it look like it's looping when it's not. -- Greg Ewing, C

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Greg Ewing
think that if an identity is specified, it should be used even if the sequence is non-empty. The reason being that the user might be relying on that to get the semantics he wants. Think of the second argument as "accumulator object" rather than "identity". -- Greg Ewing, C

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Greg Ewing
ke that would be better, yes. Maybe even just dt = stopwatch(): a() b() Whatever keyword is used is bound to not sound right for some usages, so it would be best if no keyword were needed at all. -- Greg Ewing, Computer Science Dept, +--+ Universit

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-14 Thread Greg Ewing
were implemented by passing a thunk to a function that calls it repeatedly. -- 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] Exception needed: Not enough arguments to PyArg_ParseTuple

2005-03-14 Thread Greg Ewing
ction to find out how many parameters it has been passed, and most C implementations don't provide any way at all. That's why the calling interface to varargs functions invariably includes some way for the caller to indicate the number of arguments, such as a format string or a terminating NULL.

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-14 Thread Greg Ewing
specified explicitly. In that case I would argue in favour of keeping it the way it is, since... currently sum([1,1], 40) equals 42. ...seems quite reasonable to me. Or at least as reasonable as anything else. -- Greg Ewing, Computer Science Dept, +--+ University of

Re: [Python-Dev] comprehension abbreviation

2005-03-14 Thread Greg Ewing
ntity(y) Not that it's false, it just seems like a completely unnecessary layer of mental gymnastics... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-14 Thread Greg Ewing
Eric Nieuwland wrote: Perhaps the second argument should not be optional to emphasise this. After all, there's much more to sum() than numbers. I think practicality beats purity here. Using it on numbers is surely an extremely common case. -- Greg Ewing, Computer Science

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-16 Thread Greg Ewing
def g(...): ... Of course if the functions then are allowed to change the surrounding bindings this could be used for resource release issues etc. Yes, rebinding in the surrounding scope is the one thing that style wouldn't give you -- Greg Ewing, Comput

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-16 Thread Greg Ewing
nt to "".join(x). Although it might be better to call it str.concat() instead of str.sum(). -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-o

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-16 Thread Greg Ewing
ted until the function is called. Not to mention that if the seq is empty, there's no way of knowing what T to instantiate... -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christc

Re: [Python-Dev] RE: code blocks using 'for' loops and generators

2005-03-16 Thread Greg Ewing
scoped. (7) A __leave__ or __exit__ special method really turns into another name for __del__. Not really. A PEP-310-style __exit__ method is explicitly invoked at well-defined times, not left until the object is reclaimed. It doesn't suffer from any of the problems of __del__. -- Greg Ewing, C

Re: [Python-Dev] Draft PEP to make file objects support non-blocking mode.

2005-03-20 Thread Greg Ewing
read, and EOF. This means recording that IOError(EAGAIN) is raised for an empty non-blocking read. Isn't that unix-specific? The file object is supposed to provide a more or less platform-independent interface, I thought. -- Greg Ewing, Computer Science Dept, +

Re: [Python-Dev] docstring before function declaration

2005-03-21 Thread Greg Ewing
lines significant. Currently I can leave some space before/after a docstring without breaking anything. This can help readability, especially for class docstrings. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCo

Re: [Python-Dev] Draft PEP to make file objects support non-blocking mode.

2005-03-21 Thread Greg Ewing
methods which behave more like os.read/os.write, maybe called something like readsome() and writesome(). That would eliminate the need to extract and manipulate the fds, and might make it possible to do some of this stuff in a more platform-independent way. -- Greg Ewing, Computer

Re: [Python-Dev] Draft PEP to make file objects support non-blocking mode.

2005-03-21 Thread Greg Ewing
Donovan Baarda wrote: On Mon, 2005-03-21 at 17:32 +1200, Greg Ewing wrote: I don't agree with that. There's no need to use non-blocking I/O when using select(), and in fact things are less confusing if you don't. Because staller.py outputs and flushes a fragment of data smaller t

[Python-Dev] New style classes and operator methods

2005-04-07 Thread Greg Ewing
t;OldStyleSpam.__radd__", self, other return 42 y1 = OldStyleSpam() y2 = OldStyleSpam() print y1 + y2 produces: OldStyleSpam.__add__ <__main__.OldStyleSpam instance at 0x4019054c> <__main__.OldStyleSpam instance at 0x401901ec> OldStyleSpam.__radd__ <

Re: [Python-Dev] Pickling buffer objects.

2005-04-18 Thread Greg Ewing
Travis Oliphant wrote: I'm proposing to pickle the buffer object so that it unpickles as a string. Wouldn't this mean you're only solving half the problem? Unpickling a Numeric array this way would still use an intermediate string. -- Greg Ewing, Comput

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
s that from the point of view of the user of withfile, the name 'thefile' magically appears in the namespace without it being obvious where it comes from. (but assignments within the block should still affect its _surrounding_ namespace, it seems to me...). I agree with that much. -- Gre

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
There isn't all that much left that people want to do on a regular basis. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned su

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
You can't rely on a function's signature alone to tell you much in any case. A distressingly large number of functions found in third-party extension modules have a help() string that just says something like fooble(arg,...) There's really no substitute for a good docstring! -- Gre

Re: [Python-Dev] anonymous blocks

2005-04-20 Thread Greg Ewing
ffect, not to compute a value for consumption by the block function. I don't see a great need for blocks to be able to return values. How do blocks work with control flow statements like "break", "continue", "yield", and "return"? Perhaps "break&qu

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Greg Ewing
se() return func Usage example: with_file("foo.txt", "w") as f: f.write("My hovercraft is full of parrots.") Does that help? -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZea

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Greg Ewing
sion of the regular assignment statement. Syntactically, yes, but semantically it's more complicated than just a "simple extension", to my mind. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZea

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Greg Ewing
t;readme.txt") def _(fileobj): ... (Disclaimer: This post should not be taken as an endorsement of this abuse! I'd still much rather have a proper language feature for it.) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury,

Re: [Python-Dev] anonymous blocks

2005-04-21 Thread Greg Ewing
to understand what it was doing. We already have "return" and "yield"; this would be a third similar-yet- different thing. If it were considered important enough, it could easily be added later, without disturbing anything. But I think it's best left out of an initial specifi

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Greg Ewing
x27;m +1 on moving towards __next__, BTW. IMO, that's the WISHBDITFP. :-) -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-own

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Greg Ewing
tercepting break and continue isn't so bad, since they're already associated with the loop they're in, but return has always been an unconditional get-me-out-of-this-function. I'd feel uncomfortable if this were no longer true. -- Greg Ewing, Computer Science Dept, +-

Re: [Python-Dev] Re: anonymous blocks

2005-04-25 Thread Greg Ewing
and iterators (even though they are) doesn't seem right, because they're being used for a purpose very different from generating and iterating. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealand

Re: [Python-Dev] Re: Caching objects in memory

2005-04-25 Thread Greg Ewing
;help", "copyright", "credits" or "license" for more information. >>> "foo" is "foo" True >>> "foo" is "f" + "oo" False >>> "foo" is intern("f" + "oo") True

Re: [Python-Dev] Re: Re: anonymous blocks

2005-04-25 Thread Greg Ewing
you're defining it by means of a generator, you don't need a class at all -- just make the whole thing a generator function. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a |

Re: [Python-Dev] Re: switch statement

2005-04-25 Thread Greg Ewing
being switched on all the time, and the operator being used for comparison. 2) The first case is syntactically different from subsequent ones, even though semantically all the cases are equivalent. -- Greg Ewing, Computer Science Dept, +--+ University of Cante

Re: [Python-Dev] site enhancements (request for review)

2005-04-25 Thread Greg Ewing
ning the main .py file for .pth files? This would make it easier to have collections of Python programs sharing a common set of modules, without having to either install them system-wide or write hairy sys.path-manipulating code or use platform-dependent symlink or PATH hacks. -- Greg Ewing, Comp

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Greg Ewing
Jim Jewett wrote: defmacro myresource(filename): with myresource("thefile"): def reader(): ... def writer(): ... def fn(): -1. This is ugly. -- Greg Ewing, Computer Science Dept, +--+ University of

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Greg Ewing
readable. Or prohibit anything that would permit creating a new dialect. Or something. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidi

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Greg Ewing
sing syntax is fairly unobtrusive. So in summary, I don't think you necessarily *need* macros to get nice-looking user-defined control structures. It depends on other features of the language. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbu

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Greg Ewing
Brett C. wrote: It executes the body, calling next() on the argument > name on each time through until the iteration stops. But that's no good, because (1) it mentions next(), which should be an implementation detail, and (2) it talks about iteration, when most of the time the high-level intent has

Re: [Python-Dev] Re: anonymous blocks

2005-04-26 Thread Greg Ewing
Guido van Rossum wrote: [Greg Ewing] * It seems to me that this same exception-handling mechanism would be just as useful in a regular for-loop, and that, once it becomes possible to put 'yield' in a try-statement, people are going to *expect* it to work in for-loops as well. (You can a

Re: [Python-Dev] atexit missing an unregister method

2005-04-26 Thread Greg Ewing
nt, and register a single atexit() hander to invoke it. I don't think there's any need to mess with the way atexit() currently works. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZealandCorp,

Re: [Python-Dev] defmacro

2005-04-26 Thread Greg Ewing
only that, in those cases where they *do* feel so compelled, they might not if lambda weren't such a long word. I was just trying to understand why Smalltalkers seem to get on fine without macros, whereas Lispers feel they are needed. I think Smalltalk's lightweight block-passing syntax ha

Re: [Python-Dev] defmacro

2005-04-26 Thread Greg Ewing
could use the normal exec statement to invoke the block whenever needed. There's no need for all that. They're just callable objects. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | A citizen of NewZeal

<    14   15   16   17   18   19   20   21   22   23   >