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-like objects
who
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 was
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 (highly
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...
/F
___
Python-Dev mailing list
Python-Dev@python.org
[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:
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 way I
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 t
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. But if
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 Right
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
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 the 'x'
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 + ' + _(is read
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, that
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 sprintf and
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 need the
[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
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
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,
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)
writer.print(another,error
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 use
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 Dumb val=%s % self.val
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)?
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
[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)?
As
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 (b) is
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 Ewing]
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:
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) GDB's
28 matches
Mail list logo