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

2005-09-05 Thread [EMAIL PROTECTED]
Guido van Rossum <[EMAIL PROTECTED]> wrote: > What do you think of the trick (that I wasn't aware of before) > used in Java and .net of putting an optional position specifier > in the format, and using positional arguments? It would be a > little less verbose and with sensible defaults wouldn't qu

Re: [Python-Dev] gdbinit problem

2005-09-05 Thread Guido van Rossum
On 9/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Neal> The only way I could see to fix it was by setting a continue flag > Neal> and testing it. Does anyone know a better way to fix this > Neal> problem? > > Certainly looks reasonable until we figure out how (if at all) GD

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

2005-09-05 Thread Guido van Rossum
On 9/5/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > Eliminating the newline argument from print() would reduce the number of > reserved keyword arguments in my strawman by half. Maybe we could even > rename 'to' to '__to__' (!) to eliminate the other namespace wart. Is > this really too horrible

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

2005-09-05 Thread Guido van Rossum
On 9/5/05, Calvin Spealman <[EMAIL PROTECTED]> wrote: > There is a lot of debate over this issue, obviously. Now, I think > getting rid of the print statement can lead to ugly code, because a > write function would be called as an expression, so where we'd once > have prints on their own lines, tha

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

2005-09-05 Thread Calvin Spealman
On 9/1/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > [Charles Cazabon] > > >> Perhaps py3k could have a py2compat module. Importing it could have the > > >> effect of (for instance) putting compile, id, and intern into the global > > >> namespace, making print an alias for writeln, > > [Greg

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

2005-09-05 Thread Brett Cannon
On 9/5/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Mon, 2005-09-05 at 20:52, Guido van Rossum wrote: > > > We could decide not to provide (b) directly, since it is easily > > reduced to (c) using an appropriate format string ("%s" times the > > number of arguments). But I expect that use case

Re: [Python-Dev] String views

2005-09-05 Thread Steve Holden
[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] gdbinit problem

2005-09-05 Thread skip
Neal> The only way I could see to fix it was by setting a continue flag Neal> and testing it. Does anyone know a better way to fix this Neal> problem? Certainly looks reasonable until we figure out how (if at all) GDB's command language implements a break-like statement. Skip

Re: [Python-Dev] String views

2005-09-05 Thread skip
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] Replacement for print in Python 3.0

2005-09-05 Thread skip
Neil> In interactive mode, you are normally interested in the values of Neil> things, not their formatting so it does the right thing. >>> class Dumb: ... def __init__(self, val): ... self.val = val ... def __str__(self): ... return "" % self.val ...

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

2005-09-05 Thread Barry Warsaw
On Mon, 2005-09-05 at 20:52, Guido van Rossum wrote: > We could decide not to provide (b) directly, since it is easily > reduced to (c) using an appropriate format string ("%s" times the > number of arguments). But I expect that use case (b) is pretty > important, and not everyone likes having to

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

2005-09-05 Thread Guido van Rossum
On 9/5/05, Kay Schluehr <[EMAIL PROTECTED]> wrote: > [...] is the most heavyweight solution, but can encapsulate options and is > reusable: > > >>> Writer(sep="//").print("some","text") > some//text > > or > > writer = Writer(sep="//", file=sys.stderr) > writer.print("some","error-text") > writ

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

2005-09-05 Thread Kay Schluehr
Guido van Rossum wrote: > I see two different ways to support the two most-called-for additional > requirements: (a) an option to avoid the trailing newline, (b) an > option to avoid the space between items. > > One way would be to give the print() call additional keyword > arguments. For example

[Python-Dev] Re: string formatting and i18n

2005-09-05 Thread Antoine
> Yes. If you think I was arguing the opposite, then I failed to > communicate clearly and I apologize. Actually, I didn't interpret your message like that, but as I had already seen that proposal (to suppress string formatting), I thought it would be the right time to react ;) > For instance, t

Re: [Python-Dev] string formatting and i18n

2005-09-05 Thread Barry Warsaw
On Mon, 2005-09-05 at 14:10, François Pinard wrote: > "The file %(filename)s in directory %(dir)s is read only" % vars() > > is already usable. The need being already filled without Template > strings, it could hardly be presented as a motivation for them. :-) Except that IME, %(var)s is an e

Re: [Python-Dev] string formatting and i18n

2005-09-05 Thread François Pinard
[Barry Warsaw] > Actually, this was part of the motivation behind PEP 292 and Template > strings, because what you really want is named parameters, not > positional parameters: > 'The file $filename in directory $dir is read only' > There are a few techniques for getting full i18n for Template s

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

2005-09-05 Thread Simon Percivall
On 5 sep 2005, at 18.56, Stephan Deibel wrote: > On Mon, 5 Sep 2005, Martin Blais wrote: > >> However, there is an easy way out: hijack sys.stdout to forward to >> your logger system. >> I've got a web application framework that's setup like that right >> now, >> it works great (if you will not n

Re: [Python-Dev] string formatting and i18n

2005-09-05 Thread Gareth McCaughan
On Monday 2005-09-05 17:07, Antoine Pitrou wrote: > Le lundi 05 septembre 2005 à 16:52 +0100, Gareth McCaughan a écrit : > > ... and should add: Of course it's usually seen as being about > > output more than about formatting, but in fact if you want > > to do what Python does with "%", C with "sp

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

2005-09-05 Thread Stephan Deibel
On Mon, 5 Sep 2005, Martin Blais wrote: > However, there is an easy way out: hijack sys.stdout to forward to > your logger system. > I've got a web application framework that's setup like that right now, > it works great (if you will not need the original print-to-stdout > anymore in your program,

Re: [Python-Dev] string formatting and i18n

2005-09-05 Thread Barry Warsaw
On Mon, 2005-09-05 at 12:07, Antoine Pitrou wrote: > Uh, what about internationalization (i18n) ? > In i18n you can't avoid the need for parameterized strings. > For example I want to write : > _("The file '%s' is read only") % filename > not : > _("The file") + " '" + filename + "' "

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] Example for "property" violates "Python is not a one pass compiler"

2005-09-05 Thread Phillip J. Eby
At 12:04 PM 9/5/2005 -0400, Edward C. Jones wrote: >Normally I can use any method of a class anywhere in the definition of >the class. Not true. You can certainly use any method of a class in any *functions* or methods defined in the body of the class. But you can't use them in the body of the

Re: [Python-Dev] string formatting and i18n

2005-09-05 Thread Antoine Pitrou
Le lundi 05 septembre 2005 à 16:52 +0100, Gareth McCaughan a écrit : > ... and should add: Of course it's usually seen as being about > output more than about formatting, but in fact if you want > to do what Python does with "%", C with "sprintf" and > Common Lisp with (format nil ...) then the Rig

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

2005-09-05 Thread Edward C. Jones
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 the 'x' property.") It works. Bu

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

2005-09-05 Thread Gareth McCaughan
I wrote: > C++'s << operator represents another way to do formatted > output. I regard it as an object lesson in bad design. ... and should add: Of course it's usually seen as being about output more than about formatting, but in fact if you want to do what Python does with "%", C with "sprintf"

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

2005-09-05 Thread Gareth McCaughan
> If people know of other languages that have a different approach to > string formatting, it might be useful to see them. Common Lisp has something broadly C-like but bigger and hairier. It includes powerful-but-confusing looping and conditional features, letting you say things like (format

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

2005-09-05 Thread Martin Blais
On 9/4/05, Stephan Deibel <[EMAIL PROTECTED]> wrote: > On Sun, 4 Sep 2005, Guido van Rossum wrote: > > But more important to me are my own experiences exploring the > > boundaries of print. > > > > - I quite often come to a point in the evolution of a program where I > > need to change all print st

Re: [Python-Dev] gdbinit problem

2005-09-05 Thread Guido van Rossum
On 9/4/05, Neal Norwitz <[EMAIL PROTECTED]> wrote: > break in gdbinit is apparently does not break a loop, but rather sets > a break point. I don't know how to hit the break within lineno with a > simple test case. Debugging pychecker with a C extension (matplotlib) > triggers it. > > The only w

Re: [Python-Dev] Revising RE docs

2005-09-05 Thread Tim Peters
[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... Only thing I've seen from them is one post in the archives, on June 13: http://mail.python.org/pipermai

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] Revising RE docs

2005-09-05 Thread Gareth McCaughan
Guido wrote: > > > They *are* cached and there is no cost to using the functions instead > > > of the methods unless you have so many regexps in your program that > > > the cache is cleared (the limit is 100). > > > > Sure there is; the cost of looking them up in the cache. ... > > So in this (hi

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] 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] Replacement for print in Python 3.0

2005-09-05 Thread Paul Moore
On 9/4/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 9/3/05, Bill Janssen <[EMAIL PROTECTED]> wrote: > > Seems pretty weak to me. Are there other args against? > > Sure. I made the mistake of thinking that everybody knew them. Looks like I certainly didn't. These are good points, many of