Re: [Python-Dev] PEP 3103: A Switch/Case Statement

2006-06-29 Thread Fredrik Lundh
Eric Sumner wrote: >> You mean something like this?: >> >>switch x in colours: >> case RED: >> # whatever >> case GREEN: >> # whatever >> case BLUE: >> # whatever >> >> I think Guido's right. It doesn't solve the underlying problem because the >> compi

Re: [Python-Dev] PEP 3103: A Switch/Case Statement

2006-06-29 Thread Fredrik Lundh
Eric Sumner wrote: >> what's a "label" ? > > In your example, RED, GREEN, and BLUE. colours provides a mapping > from values to labels/cases, and the switch statement provides a > mapping from labels/cases to code. Sorry about introducing a new term > without saying anything about it. yeah, but

Re: [Python-Dev] document @property?

2006-06-29 Thread Fredrik Lundh
Georg Brandl wrote: > In followup to a clpy discussion, should the docs contain > a note that property can be used as a decorator for creating > read-only properties? feel free to steal the extended example and the read-only example from the pyref wiki: http://pyref.infogami.com/property

Re: [Python-Dev] Pickle implementation questions

2006-06-30 Thread Fredrik Lundh
Martin v. Löwis wrote: >> In developing a cPickle module for IronPython that's as compatible as >> possible with CPython, these questions have come up: > > [I wish you were allowed to read the source code of Python] on the other hand, it would be nice if someone actually used Bruce's questions an

Re: [Python-Dev] Bug in stringobject?

2006-07-01 Thread Fredrik Lundh
Georg Brandl wrote: >> Can this be correct if from or to isn't a string object, but a >> char buffer compatible object? > > May I note that this is still unresolved? I can submit a bug report > and add it to PEP 356, too... it's already on my todo list, but that list is full of stuff, so having

Re: [Python-Dev] Patch for commands.py to provide callback

2006-07-05 Thread Fredrik Lundh
Brad Doctor wrote: > I am not sure if this is the proper forum or means to submit something > like this, so please forgive me and advise accordingly if I am in error. to make sure that they don't just disappear under a zillion other mails, patches should be submitted to the patch tracker:

Re: [Python-Dev] Explicit Lexical Scoping (pre-PEP?)

2006-07-07 Thread Fredrik Lundh
Just van Rossum wrote: > Why couldn't at least augmented assignment be implicitly rebinding? It > has been suggested before (in the context of a rebinding operator), but > I'm wondering, is this also off the table? > > def counter(num): > def inc(): > num += 1 >

Re: [Python-Dev] exception too expensive?

2006-07-08 Thread Fredrik Lundh
tomer filiba wrote: > i thought avoiding a second dict lookup should be faster, but it turned out > to be completely wrong. it's only marginally faster, but if an exception > occurs, it's x10 slower. maybe you should take this to comp.lang.python instead... ___

Re: [Python-Dev] PEP for RFE 46738 (first draft)

2005-06-22 Thread Fredrik Lundh
Skip Montanaro wrote: > That's fine, so XML-RPC is slower than Gherkin. I can't run the Gherkin > code, but my XML-RPC numbers are a bit different than yours: > > XMLRPC encode 0.65 seconds > XMLRPC decode 2.61 seconds > > That leads me to believe you're not using any sort of C XML decode

Re: [Python-Dev] getch() in msvcrt does not accept extended characters.

2005-06-29 Thread Fredrik Lundh
Darryl Dixon wrote: > Microsoft support capturing extended characters via _getch, but it requires > making a > second call to getch() if one of the 'magic' returns is encountered in the > first call (0x00 > or 0xE0). so why not do that in your python code? > The relevant chunk of code in Pytho

Re: [Python-Dev] PEP: Migrating the Python CVS to Subversion

2005-08-10 Thread Fredrik Lundh
Nicholas Bastin wrote: > It's a mature product. I would hope that that would count for > something. I've had enough corrupted subversion repositories that I'm > not crazy about the thought of using it in a production system. I > know I'm not the only person with this experience. compared to Pe

Re: [Python-Dev] Revised PEP 349: Allow str() to return unicode strings

2005-08-23 Thread Fredrik Lundh
Neil Schemenauer wrote: > The PEP has been rewritten based on a suggestion by Guido to change > str() rather than adding a new built-in function. Based on my testing, I > believe the idea is feasible. note that this breaks chapter 3 of the tutorial: http://docs.python.org/tut/node5.html#SECTION

Re: [Python-Dev] [Python-checkins] python/dist/src/Modules_hashopenssl.c, NONE, 2.1 sha256module.c, NONE, 2.1 sha512module.c, NONE, 2.1 md5module.c, 2.35, 2.36 shamodule.c, 2.22, 2.23

2005-08-23 Thread Fredrik Lundh
Gareth McCaughan wrote: > It's valid C99, meaning "this is an unsigned long long". since when does Python require C99 compilers? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: htt

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Fredrik Lundh
Phillip J. Eby wrote: >> Check out (and Pythonify) the ANSI M[UMPS] $PIECE(). See: >> http://www.jacquardsystems.com/Examples/function/piece.htm > > As far as I can see, either you misunderstand what partition() does, or > I'm > completely misunderstanding what $PIECE does. As far as I can t

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Fredrik Lundh
Michael Hoffman wrote: > Dare I ask whether the uncompiled versions should be considered for > removal in Python 3.0? > > *puts on his asbestos jacket* there are no uncompiled versions, so that's not a problem. if you mean the function level api, it's there for convenience. if you're using less

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Fredrik Lundh
Phillip J. Eby wrote: >>both split on a given token. partition splits once, and returns all three >>parts, while piece returns the part you ask for > > No, because looking at that URL, there is no piece that is the token split > on. partition() always returns 3 parts for 1 occurrence of the toke

Re: [Python-Dev] setdefault's second argument

2005-08-30 Thread Fredrik Lundh
Tim Peters wrote: > Anyone remember why setdefault's second argument is optional? Some kind of symmetry with get, probably. if d.get(x) returns None if x doesn't exist, it makes some kind of sense that d.setdefault(x) returns None as well. Anyone remember why nobody managed to come u

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

2005-08-30 Thread Fredrik Lundh
Raymond Hettinger wrote: > Overall, I found that partition() usefully encapsulated commonly > occurring low-level programming patterns. In most cases, it completely > eliminated the need for slicing and indices. In several cases, code was > simplified dramatically; in some, the simplification wa

Re: [Python-Dev] setdefault's second argument

2005-08-30 Thread Fredrik Lundh
Tim Peters wrote: >> Anyone remember why nobody managed to come up with a better name >> for setdefault (which is probably the worst name ever given to a method >> in the standard Python distribution) ? > > I suggested a perfect name at the time: > >http://mail.python.org/pipermail/python-dev/

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

2005-08-30 Thread Fredrik Lundh
Ron Adam wrote: > For cases where single values are desired, attribues could work. > > Slicing: >line = line.partition(';').head >line = line.partition('#').head > > But it gets awkward as soon as you want more than one. > >sep, port = host.partition(':').head, host.partiti

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

2005-08-31 Thread Fredrik Lundh
Ron Adam wrote: > I'm not familiar with piece, but it occurred to me it might be useful to > get attributes groups in some way. My first (passing) thought was to do... > > host, port = host.partition(':').(head, sep) > > Where that would be short calling a method to return them: > > hos

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

2005-08-31 Thread Fredrik Lundh
Phillip J. Eby wrote: > Yep, subscripting and slicing are more than adequate to handle *all* of > those use cases, even the ones that some people have been jumping through > odd hoops to express: > > before = x.partition(sep)[0] > found = x.partition(sep)[1] > after = x.partition(sep

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

2005-08-31 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > As a Python programmer I'd get back what look like three strings: "http", > ":", and "//www.python.org/". If each of them was a view onto part of the > original string, only the last one would truly refer to a NUL-terminated > sequence of characters. If I then wanted t

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

2005-08-31 Thread Fredrik Lundh
Greg Ewing 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? Main Entry: 2 piece Function: transitive verb Inflected Form(s): pieced; piec·ing 1 : to repair, renew, or complete by

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

2005-09-01 Thread Fredrik Lundh
Charles Cazabon wrote: > in fact, it does nothing for the program but merely has the interesting > side-effect of writing to stdout. yeah, real programmers don't generate output. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python

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

2005-09-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: >Fredrik> Python strings are character buffers with a known length, not >Fredrik> null-terminated C strings. the CPython implementation >Fredrik> guarantees that the character buffer has a trailing NULL >Fredrik> character, but that's mostly to make it eas

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

2005-09-02 Thread Fredrik Lundh
Paul F. Dubois wrote: > Remove the print statementI laughed until my sides hurt. Hello? Try > dating girls and talking to normal people, geek boys. > > We scientists still use these for debugging. We never 'move on' very far > from the tutorial. The salient feature about print statements is th

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

2005-09-02 Thread Fredrik Lundh
Neil Hodgson wrote: > Interactive use is its own mode and works differently to the base > language. To print the value of something, just type an expression. > Python will evaluate and print the value of the expression. Much > easier than adding 'print '. print and "echo" prints different thing

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

2005-09-02 Thread Fredrik Lundh
Steven Bethard wrote: > But that would be just as easy with a print() function. In the current > syntax: > >print 'foo:', foo, 'bar:', bar, 'baz:', baz, >print 'frobble', frobble > > In my proposed function: > >print('foo:', foo, 'bar:', bar, 'baz:', baz, > 'frobble', frobbl

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

2005-09-02 Thread Fredrik Lundh
Paul Moore wrote: > Sorry about that - I just get a bit tired of feeling like everyone's > characterising me as either a newbie, or as not writing "real" code... Hey, I'm a newbie, and I only write simple things, but Python is for people like me, too! ___

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

2005-09-03 Thread Fredrik Lundh
Steven Bethard wrote: >> - Error and help messages, often with print >>sys.stderr > > Use the print() method of sys.stderr: > >sys.stderr.print('error or help message') so who's going to add print methods to all file-like objects? ___ Python-D

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

2005-09-05 Thread Fredrik Lundh
Steven Bethard wrote: > >> > Use the print() method of sys.stderr: >> > >> >sys.stderr.print('error or help message') >> >> so who's going to add print methods to all file-like objects? > > The same people that added __iter__(), next(), readline(), readlines() > and writelines() to their file-l

Re: [Python-Dev] Revising RE docs

2005-09-05 Thread Fredrik Lundh
Guido van Rossum wrote: > I also notice that _compile() is needlessly written as a varargs > function -- all its uses pass it exactly two arguments. that's because the function uses [1] the argument tuple as the cache key, and I wanted to make the "cache hit" path as fast as possible. (but that

Re: [Python-Dev] Revising RE docs

2005-09-05 Thread Fredrik Lundh
Am I the only who are getting mails from "iextream at naver.com" whenever I post to python-dev, btw? My Korean (?) isn't that good, so I'm not sure what they want... ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/l

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

2005-09-05 Thread Fredrik Lundh
Edward C. Jones write: > Here is an example from the "Python Library Reference", Section 2.1 > "Built-in Functions": > > class C(object): > def getx(self): return self.__x > def setx(self, value): self.__x = value > def delx(self): del self.__x > x = property(getx, setx, delx, "I'm

Re: [Python-Dev] String views

2005-09-06 Thread Fredrik Lundh
[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 Fredrik Lundh
Greg Ewing 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) > > Whi

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

2005-09-06 Thread Fredrik Lundh
Greg Ewing wrote: > Indeed, Python's bytecode compiler essentially *is* > a one-pass compiler for a suitable setting of the "look-ahead window size", at least. some Python constructs cannot be compiled by a truly minimalistic one-pass compiler. _

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

2005-09-06 Thread Fredrik Lundh
putting on my "on the other hand" hat for a moment... ::: Guido van Rossum wrote: > 1. It's always been there > 2. We don't want to type parentheses > 3. We use it a lot > 4. We don't want to change our code there's also: 5. A reserved word makes it easy to grep for (e.g. to weed out debugging

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

2005-09-06 Thread Fredrik Lundh
Kay Schluehr wrote: > In the context of my proposal it seems to imply some variation of > Einsteins famous sentence: "Make everything as general as possible but > not more general" or "Make everything as powerfull as possible but not > more powerfull". I prefer McGrath's variation: "Things s

Re: [Python-Dev] reference counting in Py3K

2005-09-07 Thread Fredrik Lundh
Josiah Carlson wrote: > Perhaps a bit into the future, extending import semantics to notice .pyx > files, compare their checksum against a stored md5 in the compiled > .pyd/.so, and automatically recompiling them if they (or their includes) > have changed: +10 (I end up doing this kind of thing by

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

2005-09-08 Thread Fredrik Lundh
Greg Ewing wrote: > Maybe backquotes could be repurposed in Py3k for interpolated > string literals? backquotes are a PITA to type on many non-US keyboards. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/p

Re: [Python-Dev] international python

2005-09-09 Thread Fredrik Lundh
Antoine Pitrou wrote: > - seamless unicode support: how about making the default Python > charset utf-8 instead of ascii ? right now, someone (say an American or > English) who does not design his app with non-ascii characters in mind > may have a surprise when users enter those characters in cus

Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Fredrik Lundh
Martin v. Löwis wrote: > Alternatively, couldn't LIST_APPEND check that this really is a list, > and, if it isn't, fall back to PyObject_CallMethod? that's the obvious solution, of course. cf. existing shortcuts: $ grep -n INLINE Python-2.4.1/Python/ceval.c 1103: /* IN

Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Fredrik Lundh
Phillip J. Eby wrote: > I think this is called a "polymorphic inline cache", although it doesn't > seem very polymorphic if you're only caching one type. :) if it's not polymorphic, it's an ordinary inline cache (aka "call-site cache"). (see various Self papers for more on polymorphic caches)

Re: [Python-Dev] Compatibility between Python 2.3.x and Python 2.4.x

2005-09-15 Thread Fredrik Lundh
Rich Burridge wrote: > I'm involved with the team that's working towards installing Python 2.4.x > as part of a future release of the Solaris O/S. > > We currently have Python 2.3.x installed. We are trying to determine just > how compatible these two release are (at both the binary and source lev

Re: [Python-Dev] Compatibility between Python 2.3.x and Python 2.4.x

2005-09-15 Thread Fredrik Lundh
(oops. trying again) Rich Burridge wrote: > I'm involved with the team that's working towards installing Python 2.4.x > as part of a future release of the Solaris O/S. > > We currently have Python 2.3.x installed. We are trying to determine just > how compatible these two release are (at both the

Re: [Python-Dev] list splicing

2005-09-18 Thread Fredrik Lundh
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' ]. > > Notes: > - This is a common operation is it? ___ Python-De

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

2005-09-20 Thread Fredrik Lundh
Michael Hudson wrote: >> While you're at it, maybe we should switch to && and || as well? >> That's another thing I always mistype when switching between >> languages... > > You're joking, surely? for Python 3000, I'd recommend switching to "and then" and "or else" instead of the current ambiguou

Re: [Python-Dev] GIL, Python 3, and MP vs. UP

2005-09-22 Thread Fredrik Lundh
Phillip J. Eby wrote: >>It is so simple to write application server in Python. >>It is so difficult to make it scallable in CPython. > > It seems you've never heard of fork(), which works just fine to scale > Python processes on multiprocessor boxes. there's a version of fork hidden somewhere in

Re: [Python-Dev] PEP 350: Codetags

2005-09-27 Thread Fredrik Lundh
Guido van Rossum wrote: > It has always been my choice to *only* use XXX. I hope there aren't > any developers contributing to the Python core who use any others? [Python-2.4.1]$ grep FIXME */*.c */*.py | wc -l 12 [Python-2.4.1]$ grep TODO */*.c */*.py | wc -l 17 [Python-2.4.1]$ grep XX

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

2005-09-29 Thread Fredrik Lundh
Guido van Rossum wrote: > I think they all looks great! expression if expression? looks like you've been doing too much Perl hacking lately ;-) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev U

Re: [Python-Dev] C API doc fix

2005-09-29 Thread Fredrik Lundh
M.-A. Lemburg wrote: > * Unicode variant (UCS2, UCS4) don't forget the "Py_UNICODE is wchar_t" subvariant. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/ma

Re: [Python-Dev] bool(container) [was bool(iter([])) changedbetween 2.3 and 2.4]

2005-09-30 Thread Fredrik Lundh
Guido van Rossum wrote: > "Containerish" behavior isn't enough to warrant empty <--> false; in > some sense every object is a container (at least every object with a > __dict__ attribute) and you sure don't want to map __len__ to > self.__dict__.__len__... the ElementTree experience shows that do

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

2005-10-03 Thread Fredrik Lundh
Antoine Pitrou wrote: > A good rule of thumb is to convert to unicode everything that is > semantically textual and isn't pure ASCII. (anyone who are tempted to argue otherwise should benchmark their applications, both speed- and memorywise, and be prepared to come up with very strong arguments

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

2005-10-03 Thread Fredrik Lundh
Antoine Pitrou wrote: > > > A good rule of thumb is to convert to unicode everything that is > > > semantically textual > > > > and isn't pure ASCII. > > How can you be sure that something that is /semantically textual/ will > always remain "pure ASCII" ? "is" != "will always remain" __

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

2005-10-03 Thread Fredrik Lundh
Jim Fulton wrote: > I would argue that it's evil to change the default encoding > in the first place, except in this case to disable implicit > encoding or decoding. absolutely. unfortunately, all attempts to add such information to the sys module documentation seem to have failed... (last time

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

2005-10-03 Thread Fredrik Lundh
Josiah Carlson wrote: > > > and isn't pure ASCII. > > > > How can you be sure that something that is /semantically textual/ will > > always remain "pure ASCII" ? That's contradictory, unless your software > > never goes out of the anglo-saxon world (and even...). > > Non-unicode text input widgets

Re: [Python-Dev] unifying str and unicode

2005-10-03 Thread Fredrik Lundh
Antoine Pitrou wrote: > > Under the default encoding (and quite a few other encodings), that's true > > for > > plain ascii strings and Unicode strings. > > If I have an unicode string containing legal characters greater than > 0x7F, and I pass it to a function which converts it to str, the > con

Re: [Python-Dev] unifying str and unicode

2005-10-03 Thread Fredrik Lundh
Antoine Pitrou wrote: > > > If I have an unicode string containing legal characters greater than > > > 0x7F, and I pass it to a function which converts it to str, the > > > conversion fails. > > > > so? if it does that, it's not unicode safe. > [...] > > what's that has to do with > > my argument

Re: [Python-Dev] unifying str and unicode

2005-10-04 Thread Fredrik Lundh
James Y Knight wrote: > Your point would be much easier to stomach if the "str" type could > *only* hold 7-bit ASCII. why? strings are not mutable, so it's not like an ASCII string will suddenly sprout non-ASCII characters. what ends up in a string is defined by the string source. if you can

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

2005-10-07 Thread Fredrik Lundh
Nick Coghlan wrote: > 9. Here's a proposed native context manager for decimal.Context: > > # This would be a new decimal.Context method > @contextmanager > def __with__(self): wouldn't it be better if the ContextWrapper class (or some variation thereof) could be used

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

2005-10-07 Thread Fredrik Lundh
Nick Coghlan wrote: > That's not what the decorator is for - it's there to turn the generator used > to implement the __with__ method into a context manager, rather than saying > anything about decimal.Context as a whole. possibly, but using a decorated __with__ method doesn't make much sense if

Re: [Python-Dev] __doc__ behavior in class definitions

2005-10-07 Thread Fredrik Lundh
Martin Maly wrote: > I came across a case which I am not sure if by design or a bug in Python > (Python 2.4.1 (#65, Mar 30 2005, 09:13:57)). Consider following Python > module: > > # module begin > "module doc" > > class c: > print __doc__ > __doc__ = "class doc" (1) > print __doc__ >

Re: [Python-Dev] defaultproperty

2005-10-10 Thread Fredrik Lundh
Calvin Spealman wrote: > I mean, come on, its like making a module just to store a bunch of > unrelated types just to lump them together because they're types. import types ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/ma

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

2005-10-13 Thread Fredrik Lundh
Guido van Rossum wrote: > BTW, Queue.Queue violates a recent module naming standard; it is now > considered bad style to name the class and the module the same. > Modules and packages should have short all-lowercase names, classes > should be CapWords. Even the same but different case is bad style

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

2005-10-13 Thread Fredrik Lundh
Guido van Rossum wrote: > > > BTW, Queue.Queue violates a recent module naming standard; it is now > > > considered bad style to name the class and the module the same. > > > Modules and packages should have short all-lowercase names, classes > > > should be CapWords. Even the same but different c

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

2005-10-15 Thread Fredrik Lundh
Antoine Pitrou wrote: > > unfortunately, this standard seem to result in generic "spamtools" modules > > into which people throw everything that's even remotely related to "spam", > > followed by complaints about bloat and performance from users, followed by > > various more or less stupid attempt

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

2005-10-19 Thread Fredrik Lundh
Guido van Rossum wrote: > OK, so how's this for a radical proposal. > > Let's change the property built-in so that its arguments can be either > functions or strings (or None). If they are functions or None, it > behaves exactly like it always has. > > If an argument is a string, it should be a me

Re: [Python-Dev] int(string)

2005-10-24 Thread Fredrik Lundh
Alan McIntyre wrote: > When running "make test" I get some errors in test_array and > test_compile that did not occur in the build from CVS. Given the inputs > to long() have '.' characters in them, I assume that these tests really > should be failing as implemented, but I haven't dug into them t

Re: [Python-Dev] Inconsistent Use of Buffer Interface instringobject.c

2005-10-24 Thread Fredrik Lundh
Guido van Rossum wrote: > A concern I'd have with fixing this is that Unicode objects also > support the buffer API. In any situation where either str or unicode > is accepted I'd be reluctant to guess whether a buffer object was > meant to be str-like or Unicode-like. I think this covers all the

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

2005-10-25 Thread Fredrik Lundh
M.-A. Lemburg wrote: > I don't follow you here. The source code encoding > is only applied to Unicode literals (you are using string > literals in your example). String literals are passed > through as-is. however, for Python 3000, it would be nice if the source-code encoding applied to the *enti

Re: [Python-Dev] svn checksum error

2005-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I tried "svn up" to bring my sandbox up-to-date and got this output: > > % svn up > UInclude/unicodeobject.h > subversion/libsvn_wc/update_editor.c:1609: (apr_err=155017) > svn: Checksum mismatch for > 'Objects/.svn/text-base/unicodeobject.c.svn-base

[Python-Dev] Adding examples to PEP 263

2005-11-04 Thread Fredrik Lundh
the runtime warning you get when you use non-ascii characters in python source code points the poor user to this page: http://www.python.org/peps/pep-0263.html which tells the user to add a # -*- coding: -*- to the source, and then provides a more detailed syntax description as a RE pa

Re: [Python-Dev] dev FAQ updated with day-to-day svn questions

2005-11-10 Thread Fredrik Lundh
Brett Cannon wrote: >I just finished fleshing out the dev FAQ > (http://www.python.org/dev/devfaq.html) with questions covering what > someone might need to know for regular usage. If anyone thinks I > didn't cover something I should have, let me know. SVK!

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

2005-11-11 Thread Fredrik Lundh
Jim Jewett wrote: > (6) Mark Hammond suggests that it might be easier to > replace the interactive portions of python based on the > "code" module. matplotlib suggests using ipython > instead of standard python for similar reasons. > > If that is really the simplest answer (and telling users > w

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

2005-11-11 Thread Fredrik Lundh
Jim Jewett wrote: > > really? Python comes with a module that makes it trivial to get > > a fully working interpreter console ... > > Using an event loop (or an external GUI) should not require > forking the entire interactive mode, no matter how trivial that > fork is. repeating a bogus argumen

Re: [Python-Dev] Is some magic required to check out new files from svn?

2005-11-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I read the developer's FAQ and the output of "svn up --help". Executing > "svn up" or "svn info" tells me I'm already at rev 41430, which is the > latest rev, right? Creating a fresh build subdirectory followed by > configure and make gives me this error: > >../Obj

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

2005-11-14 Thread Fredrik Lundh
Michiel Jan Laurens de Hoon wrote: > >Did you read my reply? ipython, based on code.py, implements a few simple > >threading tricks (they _are_ simple, since I know next to nothing about > >threading) and gives you interactive use of PyGTK, WXPython and PyQt > >applications in a manner similar to

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

2005-11-14 Thread Fredrik Lundh
Michiel Jan Laurens de Hoon wrote: > This is exactly the problem. Drawing one picture may consist of many > Python commands to draw the individual elements (for example, several > graphs overlaying each other). We don't know where in the window each > element will end up until we have the list of

Re: [Python-Dev] str.dedent

2005-11-14 Thread Fredrik Lundh
Noam Raphael wrote: > That's a theoretical argument. In practice, if you do it in the > parser, you have two options: > > 1. Automatically dedent all strings. > 2. Add a 'd' or some other letter before the string. > > Option 1 breaks backwards compatibility, and makes the parser do > unexpected th

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

2005-11-14 Thread Fredrik Lundh
Noam Raphael wrote: > It didn't. Strange freezes started to appear, only when working from > IDLE. This made me investigate a bit, and I've found that Tkinter > isn't run from a seperate thread - the dooneevent() function is called > repeatedly by PyOS_InputHook while the interpreter is idle. rep

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

2005-11-16 Thread Fredrik Lundh
Thomas Lee wrote: > Even if it meant we had just one function call - one, safe function call > that deallocated all the memory allocated within a function - that we > had to put before each and every return, that's better than what we > have. alloca? (duck)

Re: [Python-Dev] Problems with the Python Memory Manager

2005-11-17 Thread Fredrik Lundh
Travis Oliphant wrote: > Bingo. Yes, definitely allocating new _types_ (an awful lot of them...) > --- that's what the "array scalars" are: new types created in C. are you allocating PyTypeObject structures dynamically? why are you creating an awful lot of new type objects to represent the cont

Re: [Python-Dev] Problems with the Python Memory Manager

2005-11-17 Thread Fredrik Lundh
Travis Oliphant wrote: > The fact that it did happen is what I'm reporting on. If nothing will > be done about it (which I can understand), at least this thread might > help somebody else in a similar situation track down why their Python > process consumes all of their memory even though their o

Re: [Python-Dev] s/hotshot/lsprof

2005-11-20 Thread Fredrik Lundh
Martin v. Löwis wrote: > The same could be said about hotshot, which was originally contributed > by Fred Drake, and hacked by Tim Peters, yourself, and others. Yet, now > people want to remove it again. > > I'm really concerned that the same fate will happen to any new > profiling library: anybod

Re: [Python-Dev] ast status, memory leaks, etc

2005-11-21 Thread Fredrik Lundh
Neal Norwitz wrote: > The big benefit of running with pymalloc is that it only takes about > 1.25 to 1.50 hours to run on my box. When running without pymalloc, I > estimate it takes about 5 times longer. Plus it requires a lot of > extra work since I need to run the tests in batches. I only ha

Re: [Python-Dev] ast status, memory leaks, etc

2005-11-21 Thread Fredrik Lundh
Neal Norwitz wrote: > I think a bigger bang for the buck would be to buy a Windows box with > Purify. Rational was a real pain to deal with, maybe it's better now > that IBM bought them. Parasoft (Insure++) was even worse to deal > with. There would be many other benefits for someone to do more

Re: [Python-Dev] [Python-checkins] commit of r41497 -python/trunk/Lib/test

2005-11-21 Thread Fredrik Lundh
Neal Norwitz wrote: > I just checked in the modification below. I'm not sure if this > behaviour is on purpose or by accident. Python 2.4 on Linux: >>> float(" 0x3.1 ") 3.0625 Python 2.4 on Windows: >>> float(" 0x3.1 ") Traceback (most recent call last): File "", line 1, in ? ValueError

Re: [Python-Dev] ast status, memory leaks, etc

2005-11-22 Thread Fredrik Lundh
Gustavo Sverzut Barbieri wrote: > At least with gentoo's Python 2.4.2, I get a bunch of errors from > invalid reads and jumps/moves that depends on unitialized values in > PyObject_Free(). > > Running: > > valgrind --leak-check=full --leak-resolution=high --show-reachable=yes > python -c "pass" 2

Re: [Python-Dev] Problems with the Python Memory Manager

2005-11-24 Thread Fredrik Lundh
Martin v. Löwis wrote: > One way (I think the only way) this could happen if: > - the objects being allocated are all smaller than 256 bytes > - when allocating new objects, the requested size was different >from any other size previously deallocated. > > So if you first allocate 1,000,000 obj

Re: [Python-Dev] (no subject)

2005-11-24 Thread Fredrik Lundh
Donovan Baarda wrote: > I don't know if this will help, but in my experience compiling re's > often takes longer than matching them... are you sure that it's the > match and not a compile that is taking a long time? Are you using > pre-compiled re's or are you dynamically generating strings and us

Re: [Python-Dev] SRE should release the GIL (was: no subject)

2005-11-25 Thread Fredrik Lundh
Martin v. Löwis wrote: > Formally: no; it access a Python string/Python unicode object all > the time. > > Now, since all the shared objects it accesses are immutable, likely > no harm would be done releasing the GIL. I think SRE was originally > also intended to operate on array.array objects; th

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

2005-11-29 Thread Fredrik Lundh
Jeremy Hylton wrote: > > Me neither. Adding yet another memory allocation scheme to Python's > > already staggering number of memory allocation strategies sounds like > > a bad idea. > > The reason this thread started was the complaint that reference > counting in the compiler is really difficult.

Re: [Python-Dev] os.normpath may change the meaning of the path if itcontains symbolic links?

2005-12-02 Thread Fredrik Lundh
Nir Soffer wrote: > However, I found this alarming note in the docs: > > normpath(path) > ... > "It should be understood that this may change the meaning of the path > if it contains symbolic links!" > > The function docstring does not contain this note: > > """Normalize path, eliminating double s

Re: [Python-Dev] ast-objects branch created

2005-12-07 Thread Fredrik Lundh
"Delaney, Timothy (Tim)" wrote: > > Nick Coghlan wrote: > >> As Fredrik pointed out a while back, the PyObject approach doesn't > >> *have* to involve manual decref operations - PyObject's come with a > >> ready made arena structure, in the form of PyList. > > > > That doesn't really work: PyList_

Re: [Python-Dev] ElementTree - Why not part of the core? (fwd)

2005-12-11 Thread Fredrik Lundh
Martin v. Löwis wrote: > That's primarily for the author of the software to decide, at this > point. Fredrik Lundh would have to offer it for contribution first. I've already done that, as others have noted. Everything I release under a Python-compatible license is available f

Re: [Python-Dev] ElementTree - Why not part of the core? (fwd)

2005-12-11 Thread Fredrik Lundh
Martin v. Löwis wrote: > >>That's primarily for the author of the software to decide, at this > >>point. Fredrik Lundh would have to offer it for contribution first. > > > > I've already done that, as others have noted. Everything I release > > unde

Re: [Python-Dev] Exception type on handling closed files

2005-12-11 Thread Fredrik Lundh
João Paulo Silva wrote: > >>> a = file("dir/foo") > >>> a.close() > >>> a.read() > > Traceback (most recent call last): > File "", line 1, in -toplevel- > a.read() > ValueError: I/O operation on closed file > > Shoudn't this raise IOError? Seems more semantically correct to me. IOError is,

Re: [Python-Dev] ElementTree - Why not part of the core? (fwd)

2005-12-11 Thread Fredrik Lundh
Martin v. Löwis wrote > > And maybe PEP 291 could be updated to cover both compatibility with older > > Python versions and other compatibility issues. > > So what would be the minimum Python version you keep compatibility with? as Brett pointed out, the procedure to use for externally developed

<    1   2   3   4   5   6   7   8   >