Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-23 Thread Antoine Pitrou
Brett Cannon  python.org> writes:
> 
> It is specifically there to be overridden (and as an aside, it was a
> pain to support in the C port of warnings), so it really isn't
> monkey-patching. =)

Should we coin a new word for this? Pretty-patching?

cheers

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-23 Thread Nick Coghlan
Antoine Pitrou wrote:
> Brett Cannon  python.org> writes:
>> It is specifically there to be overridden (and as an aside, it was a
>> pain to support in the C port of warnings), so it really isn't
>> monkey-patching. =)
> 
> Should we coin a new word for this? Pretty-patching?

When the module docs tell you it's OK, it's just overriding the
function. If the docs don't tell you to do it, it's monkey patching :)

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-23 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nick Coghlan wrote:
> Antoine Pitrou wrote:
>> Brett Cannon  python.org> writes:
>>> It is specifically there to be overridden (and as an aside, it was a
>>> pain to support in the C port of warnings), so it really isn't
>>> monkey-patching. =)
>> Should we coin a new word for this? Pretty-patching?
> 
> When the module docs tell you it's OK, it's just overriding the
> function. If the docs don't tell you to do it, it's monkey patching :)

Monkey-patching is never inheritance-based:  it means replacing a method
/ attribute of a module or class from a different module, after import time.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJKVeN+gerLs4ltQ4RAvWKAJ47URWBPaqgRoA6LUZ7d1pOuAk9nQCgqBk7
1gxVqwbnbfSzFDUE0wwfyjg=
=Yv7d
-END PGP SIGNATURE-

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] mlockall() in Python?

2008-11-23 Thread Evgeni Golov
Hi,

I'd like to write a small daemon in Python, which should never be
swapped out (on Linux, this daemon will be Linux specific, so no need
in a platform-independent solution).

In C I'd do:
#include 
mlockall(MCL_FUTURE);
//do stuff here
munlockall();

Is there anything similar in Python?

TIA & kind regards
Evgeni Golov

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] mlockall() in Python?

2008-11-23 Thread Guilherme Polo
On Sun, Nov 23, 2008 at 10:44 PM, Evgeni Golov <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'd like to write a small daemon in Python, which should never be
> swapped out (on Linux, this daemon will be Linux specific, so no need
> in a platform-independent solution).
>
> In C I'd do:
> #include 
> mlockall(MCL_FUTURE);
> //do stuff here
> munlockall();
>
> Is there anything similar in Python?
>

Python doesn't wrap those function itself, but maybe some extension
modules does (or you could wrap it a second:
http://pastebin.com/m3286272c http://pastebin.com/m33ca908d)

Also, this list is for development *of* Python, not development *with*
Python (one of the most used messages this month).

> TIA & kind regards
> Evgeni Golov
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/ggpolo%40gmail.com
>



-- 
-- Guilherme H. Polo Goncalves
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] subprocess.Popen: change default buffer size?

2008-11-23 Thread Victor Stinner
subprocess.Popen is much SLOWER than os.popen() on Mac and Solaris.

The goal is to read the output of a command (through a pipe) as fast as 
possible. The problem is the pipe buffering (the reader file in the Python 
process).

Today, subprocess.Popen() uses bufsize=0 by default. It should be 
bufsize=(-1): use the system default buffer size.

==> http://bugs.python.org/issue4194

Note: On Linux the performances between subprocess (unbuffered) and popen() 
(buffered) are the same, which is quite strange.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com