Re: [Python-Dev] PEP 3145 (With Contents)

2009-09-15 Thread Oleg Broytmann
On Tue, Sep 15, 2009 at 12:25:35PM -0400, Eric Pruitt wrote:
 A search for python asynchronous subprocess will turn up numerous
 accounts of people

   IMHO there is no need to refer to a search. It'd be enough to say There
are many people

 kernel 32 DLL

   Why not just name it kernel32.dll?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] how to debug httplib slowness

2009-09-04 Thread Oleg Broytmann
On Fri, Sep 04, 2009 at 04:02:39PM +0100, Chris Withers wrote:
 So, httplib does this:

 GET /blah HTTP/1.1
[skip]
 While wget does this:

 GET /blah HTTP/1.0
[skip]
 - Apache responds with a chunked response only to httplib. Why is that?

   Probably because wget uses HTTP/1.0?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-21 Thread Oleg Broytmann
http://ipaddr-py.googlecode.com/svn/branches/2.0.x/ipaddr.py

 _compat_has_real_bytes = bytes != str

   Wouldn't it be nicer bytes is not str?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-18 Thread Oleg Broytmann
 http://ipaddr-py.googlecode.com/svn/branches/2.0.x/ipaddr.py :

 def IP(address, host=False, version=None):
 Take an IP string/int and return an object of the correct type.
 
 Args:
 ip_str: ...

   The arg is 'address', not 'ip_str'.

   There are two classes, IPv4 and IPv6 whose __new__ never create an
instance of its class, instead they create instances of other classes. Why
IPv4 and IPv6 are classes and not (factory) functions (like function IP)?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 3144: IP Address Manipulation Library for the Python Standard Library

2009-08-18 Thread Oleg Broytmann
On Tue, Aug 18, 2009 at 01:53:36PM -0700, Peter Moody wrote:
 hold over from when I was trying to be too fancy. fixed as well.

   Thank you. The PEP and the code is Ok for me. Something like this should
be in the stdlib. Currently I'm using IPy.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] VC++ versions to match python versions?

2009-08-17 Thread Oleg Broytmann
On Mon, Aug 17, 2009 at 03:22:50PM +0100, Chris Withers wrote:
 Is the Express Edition of Visual C++ 2008 suitable for compiling  
 packages for Python 2.6 on Windows?
 (And Python 2.6 itself for that matter...)

 Ditto for 2.5, 3.1 and the trunk (which I guess becomes 3.2?)

   These two I know for sure:

Python 2.5: MSVC-7.1 (VC++ 2003)
Python 2.6: MSVC-9.0 (VS 2008)

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 385: the eol-type issue

2009-08-05 Thread Oleg Broytmann
On Wed, Aug 05, 2009 at 02:35:02PM +0100, MRAB wrote:
 Instead of just talking about line endings, could each file have a
 specific 'filetype'?

   EOL-conversion, MIME type and encoding (charset) are three different
concepts. Yes, all of them must be supported, but not necessary in one
configuration mechanism.
   Subversion handles these issues by providing svn:eol-style and
svn:mime-type (handles both MIME type and charset) properties on a
file-by-file basis.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 385: Mercurial issues

2009-08-05 Thread Oleg Broytmann
On Wed, Aug 05, 2009 at 05:50:03PM +0400, Oleg Broytmann wrote:
Subversion handles these issues by providing ...
 svn:mime-type (handles both MIME type and charset)
 file-by-file basis.

   Dirkjan, how does Mercurial handles charsets? If I have three files in
my repository - one in utf-8, another in koi8-r, and the third in cp1251
encoding - I certainly don't want to convert them back and force, but I
want hg web interface to provide charset in the Content-Type header.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 385: Mercurial issues

2009-08-05 Thread Oleg Broytmann
On Wed, Aug 05, 2009 at 04:04:24PM +0200, Dirkjan Ochtman wrote:
 On Wed, Aug 5, 2009 at 15:57, Oleg Broytmannp...@phd.pp.ru wrote:
    Dirkjan, how does Mercurial handles charsets? If I have three files in
  my repository - one in utf-8, another in koi8-r, and the third in cp1251
  encoding - I certainly don't want to convert them back and force, but I
  want hg web interface to provide charset in the Content-Type header.
 
 It doesn't currently have any way to provide out-of-band charset info.

   Perhaps that's not a big issue for Python, but it's certainly a big
issue for me.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 385: the charset issue

2009-08-05 Thread Oleg Broytmann
On Thu, Aug 06, 2009 at 12:12:08AM +1000, Nick Coghlan wrote:
 Yep - while SVN does support full mime_type specification for files, I
 don't think we have ever used it.

   These files are in 8859-1 encoding (names in comments, at least):
http://svn.python.org/view/python/trunk/Lib/encodings/punycode.py
http://svn.python.org/view/python/trunk/Lib/test/test_csv.py
http://svn.python.org/view/python/trunk/Tools/i18n/msgfmt.py
http://svn.python.org/view/python/trunk/Tools/i18n/pygettext.py
   If they are not marked as text/plain; charset=iso-8859-1 I think it's
a bug. Either they should be marked, or converted to ascii or utf-8; the
coding pseudocomment (directive) should be changed accordingly.
   Probably there are other files.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 385: Mercurial issues

2009-08-05 Thread Oleg Broytmann
On Thu, Aug 06, 2009 at 12:34:39AM +0900, Stephen J. Turnbull wrote:
 Oleg Broytmann writes:
  Dirkjan, how does Mercurial handles charsets? If I have three files in
   my repository - one in utf-8, another in koi8-r, and the third in cp1251
   encoding - I certainly don't want to convert them back and force, but I
   want hg web interface to provide charset in the Content-Type header.
 
 How is this relevant to PEP 385?  I hope the answer is not at all.

   There are non-utf8 non-ascii files in the Python source tree. Either
there should be a way to handle them in Mercurial or they have to be
converted to UTF-8 in a proper way (i.e., don't forget to rewrite charset
directives).
   Other tan that - I am pondering a switch from SVN to hg in other
projects using Python process as an example and asking questions that are
slightly off-topic (but only slightly).

 I've been there, done that, and my answer is never again.  (I'm not
 telling you what to do with *your* repository, just that I don't see
 any good reason for having any encodings but UTF-8 in Python's.)

   We have files in at least two different encodings - utf-8 and cp1251 for
user-visible text-files on w32.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] expy: an expressway to extend Python

2009-07-21 Thread Oleg Broytmann
On Mon, Jul 20, 2009 at 09:19:10PM -0700, Yingjie Lan wrote:
 This is to announce the initial release of expy 0.1.0.
 More details at http://expy.sourceforge.net/

   What is it (the announcement is too brief and I'm not going to click on
a link without a real need)? How does it help core developers to develop
Python (if you posted this to the python-dev mailing list instead of c.l.p
or c.l.p.a)?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] expy: an expressway to extend Python

2009-07-21 Thread Oleg Broytmann
On Tue, Jul 21, 2009 at 11:22:19AM -0700, Yingjie Lan wrote:
 @function(double) #return type: double
 def sqrt(x=double): #argument x: double

   Python 3.0 has arguments and return value annotations:

http://docs.python.org/3.0/whatsnew/3.0.html#new-syntax
http://www.python.org/dev/peps/pep-3107/

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] expy: an expressway to extend Python

2009-07-21 Thread Oleg Broytmann
On Tue, Jul 21, 2009 at 04:26:52PM -0400, Eric Entin wrote:
 I think the point of his software is to make it easier to interface Python
 with C code

   I think I understand that. And I think this

   @function(double) #return type: double
   def sqrt(x=double): #argument x: double

   is how C functions are declared in Python, so I think annotations is the
way to go for such declarations.

 Python 3.0 has arguments and return value annotations:
 
  http://docs.python.org/3.0/whatsnew/3.0.html#new-syntax
  http://www.python.org/dev/peps/pep-3107/

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Mercurial and linefeeds

2009-06-04 Thread Oleg Broytmann
On Thu, Jun 04, 2009 at 09:02:53AM -0400, Jason R. Coombs wrote:
 It seems that within the hg repository, everything has been converted to LF 
 for line endings.  I suspect this is because HG provides no integrated 
 support for line-ending conversions and because the hg to svn bridge is 
 probably running on a Unix OS.

http://www.selenic.com/mercurial/wiki/FAQ#FAQ.2BAC8-TechnicalDetails.What_about_Windows_line_endings_vs._Unix_line_endings.3F

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Mercurial, linefeeds, and Visual Studio

2009-06-04 Thread Oleg Broytmann
On Thu, Jun 04, 2009 at 03:20:56PM +0100, Paul Moore wrote:
 Essentially, pcbuild.sln is a binary file, and should be treated as
 such. Maybe it's an error in the Subversion setup that it's treated as
 text at all...

   Subversion has a built-in notion of eol-conversion (don't know if it was
used for this particular file).

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] question about docstring formatting

2009-05-28 Thread Oleg Broytmann
On Thu, May 28, 2009 at 09:06:03AM -0400, Jeremy Hylton wrote:
 It says that the summary line may be used by automatic indexing tools,
 but is there any evidence that such a tool actually exists?

   epydoc, for one.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Easy way to detect filesystem case-sensitivity?

2009-05-08 Thread Oleg Broytmann
On Fri, May 08, 2009 at 09:52:40AM -0700, Brett Cannon wrote:
 Thanks for the help to everyone. I ended up simply taking __file__, making
 it all uppercase (or lowercase if it is already uppercase) and then doing
 os.path.exists() on the modified name. Seems to work.

   What if __file__ is on a different filesystem with different rules
(consider NFS, SMB/CIFS, etc.)?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PyPI copyright

2009-05-04 Thread Oleg Broytmann
http://pypi.python.org/pypi

Copyright © 1990-2007, Python Software Foundation

   :s/2007/2009/

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 383 (again)

2009-04-28 Thread Oleg Broytmann
On Tue, Apr 28, 2009 at 09:30:01AM +0200, Thomas Breuel wrote:
 Programmers may find it inconvenient that they have to spend time figuring
 out and deal with platform-dependent file system encoding issues and
 errors.  But internationalization and unicode are hard, that's just a fact
 of life.

   Until it's hard there will be no internationalization. A fact of life,
damn it. Programmers are lazy, and have many problems to solve.

 end user gets an
 error, submits a bug, and the programmer figures out how to deal with the
 encoding issues correctly.

   And the programmer answers The program is expected a correct
environment, good filenames, etc. and closes the issue with the resolution
User error, will not fix.

   I am not arguing for or against the PEP in question. Python certainly
has to have a way to make portable i18n less hard or else the number of
portable internationalized program will be about zero. What the way should
be - I don't know.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 383 (again)

2009-04-28 Thread Oleg Broytmann
On Tue, Apr 28, 2009 at 10:37:45AM +0200, Thomas Breuel wrote:
 Returning an error for an incorrect encoding doesn't make
 internationalization harder, it makes it easier because it makes debugging
 easier.

   What is a correct encoding?

   I have an FTP server to which clients with different local encodings
are connecting. FTP protocol doesn't have a notion of encoding so filenames
on the filesystem are in koi8-r, cp1251 and utf-8 encodings - all in one
directory! What should os.listdir() return for that directory? What is a
correct encoding for that directory?!

   If any program starts to raise errors Python becomes completely unusable
for me! But is there anything I can debug here?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 383 (again)

2009-04-28 Thread Oleg Broytmann
On Tue, Apr 28, 2009 at 11:32:26AM +0200, Thomas Breuel wrote:
 On Tue, Apr 28, 2009 at 11:00, Oleg Broytmann p...@phd.pp.ru wrote:
I have an FTP server to which clients with different local encodings
  are connecting. FTP protocol doesn't have a notion of encoding so filenames
  on the filesystem are in koi8-r, cp1251 and utf-8 encodings - all in one
  directory! What should os.listdir() return for that directory? What is a
  correct encoding for that directory?!
 
 I don't know what it should do (ftplib needs to worry about that).

   There is no ftplib there. FTP server is ProFTPd, ftp clients of all
sort, one, e.g., an ftp client built-in into an automatic web-camera.
   I use python programs to process files after they have been uploaded.
The programs access FTP directory as a part of local filesystem.

 I do know
 what it shouldn't do, however: it sould not return a utf-8b string which,
 when used to create a file, will create a file reproducing the byte sequence
 of the remote machine; that's wrong.

   That certainly wrong. But at least the approach allows python programs
to list all files in a directory - currently AFAIU os.listdir() silently
skips undecodeable filenames. And after a program gets all files it can
process it further - it can cleanup filenames (base64-encode them, e.g.),
but at least it can do something, where currently it cannot.

PS. It seems I started to argue for the PEP. Well, well...

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-25 Thread Oleg Broytmann
On Sat, Apr 25, 2009 at 05:00:17PM +0200, Martin v. L?wis wrote:
 I recognize that for other languages (without trivial transliterations)
 the problem is more severe, and people are more likely to create
 files with Cyrillic, or Japanese, names (say) if the systems accepts
 them at all.

   In different encodings on the same filesystem...

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Dates in python-dev

2009-04-24 Thread Oleg Broytmann
On Fri, Apr 24, 2009 at 05:29:29PM +0100, MRAB wrote:
 I've recently subscribed to this list and received my first Summary of
 Python tracker Issues. What I find annoying are the dates, for example:

 ACTIVITY SUMMARY (04/17/09 - 04/24/09)

 3 x double-digits (have we learned nothing from Y2K? :-)) with the
 _middle_ ones changing fastest!

 I know it's the US standard, but Python is global. Could we have an
 'international' style instead, say, year-month-day:

 ACTIVITY SUMMARY (2009-04-17 - 2009-04-24)

   +1000 from me!

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Issue5434: datetime.monthdelta

2009-04-16 Thread Oleg Broytmann
On Thu, Apr 16, 2009 at 01:18:01AM -0500, Jess Austin wrote:
 I'm new to python core development, and I've been advised to write to
 python-dev concerning a feature/patch I've placed at
 http://bugs.python.org/issue5434, with Rietveld at
 http://codereview.appspot.com/25079.

   I have read the python code and it looks good. I often have a need to do
month-based calculations.

 This patch adds a monthdelta class and a monthmod function to the
 datetime module.  The monthdelta class is much like the existing
 timedelta class, except that it represents months offset from a date,
 rather than an exact period offset from a date.

   I'd rather see the code merged with timedelta: timedelta(months=n).

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] BLOBs in Pg (was: email package Bytes vs Unicode)

2009-04-09 Thread Oleg Broytmann
On Thu, Apr 09, 2009 at 01:14:21PM -0400, Tony Nelson wrote:
 I use MySQL, but sort of intend to learn PostgreSQL.  I didn't know that
 PostgreSQL has no real support for BLOBs.

   I think it has - BYTEA data type.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] BLOBs in Pg

2009-04-09 Thread Oleg Broytmann
On Thu, Apr 09, 2009 at 04:42:21PM -0400, Steve Holden wrote:
 If I can't pass a 256-byte string into a BLOB and get it back without
 anything like this happening then there's *something* in the chain that
 makes the database useless.

import psycopg2

con = psycopg2.connect(database=test)
cur = con.cursor()
cur.execute(CREATE TABLE test (id serial, data BYTEA))
cur.execute('INSERT INTO test (data) VALUES (%s)', 
(psycopg2.Binary(''.join([chr(i) for i in range(256)])),))
cur.execute('SELECT * FROM test ORDER BY id')
for rec in cur.fetchall():
   print rec[0], type(rec[1]), repr(str(rec[1]))

Result:

1 type 'buffer' 
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f
 
!#$%\'()*+,-./0123456789:;=?...@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'

   What am I doing wrong?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Ext4 data loss

2009-03-13 Thread Oleg Broytmann
On Thu, Mar 12, 2009 at 10:14:41PM -0600, Adam Olsen wrote:
 Yet the ext4
 developers didn't see it that way, so it was sacrificed to new
 performance improvements (delayed allocation).

   Ext4 is not the only FS with delayed allocation. New XFS has it, btrfs
will have it. Don't know about other OS/FS (ZFS? NTFS?)

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Ext4 data loss

2009-03-13 Thread Oleg Broytmann
On Fri, Mar 13, 2009 at 12:28:07PM +0300, Oleg Broytmann wrote:
 On Thu, Mar 12, 2009 at 10:14:41PM -0600, Adam Olsen wrote:
  Yet the ext4
  developers didn't see it that way, so it was sacrificed to new
  performance improvements (delayed allocation).
 
Ext4 is not the only FS with delayed allocation. New XFS has it, btrfs
 will have it. Don't know about other OS/FS (ZFS? NTFS?)

http://thunk.org/tytso/blog/2009/03/12/delayed-allocation-and-the-zero-length-file-problem/

   Ted Tso said HFS+ and ZFS have the property as well. So no, it is not
a deficiency in the Linux kernel or in Ext4 FS - it is a mainstream path in
modern filesystem design.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Ext4 data loss

2009-03-11 Thread Oleg Broytmann
On Wed, Mar 11, 2009 at 11:43:33AM +, Antoine Pitrou wrote:
 As for owner and group, I think there is a very good reason that it doesn't 
 copy
 them: under Linux, only root can change these properties.

   Only root can change file ownership - and yes, there are scripts that
run with root privileges, so why not copy? As for group ownership - any
user can change group if [s]he belongs to the group.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Integrate BeautifulSoup into stdlib?

2009-03-09 Thread Oleg Broytmann
On Thu, Mar 05, 2009 at 01:30:25PM -0500, Barry Warsaw wrote:
 Ubuntu (and probably Debian): apt-get install python-lxml

   Tested in Debian: yes, the incantation works.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] pprint(iterator)

2009-01-29 Thread Oleg Broytmann
On Thu, Jan 29, 2009 at 08:06:18AM -0800, Aahz wrote:
 On Thu, Jan 29, 2009, Michael Foord wrote:
  Don't we have a pretty-print API - and isn't it spelled __str__ ?
 
 In theory, yes.  In practice, we wouldn't be having this discussion if
 that really worked.  But it probably would make sense to see how far
 using __str__ can take us -- AFAICT enumobject.c doesn't define __str__
 (although I may be missing something, I don't know Python at the C level
 very well).

   Container objects (tuples/lists/dicts/sets) don't define __str__.
Is __pprint__ an attempt to redefine __str__?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] pprint(iterator)

2009-01-27 Thread Oleg Broytmann
On Tue, Jan 27, 2009 at 01:46:35PM -0800, Raymond Hettinger wrote:
enumerate object: 'A', 'B', 'C', 'D', 'E', 'F'

   I like the idea, and I prefer this formatting. Also bear in mind there
are infinite generators, and there are iterators that cannot be reset. For
infinite generators pprint() must have a parameter, say, 'max_items', and
print generator: 'A', 'B', 'C', 'D', 'E', 'F',  The situation with
iterators that cannot be reset should be documented.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Should ftplib use UTF-8 instead of latin-1 encoding?

2009-01-23 Thread Oleg Broytmann
On Fri, Jan 23, 2009 at 10:15:18AM -0800, Brett Cannon wrote:
 If I remember correctly something along Martin's comment about 7-bit
 clean is needed, but some servers don't follow the standard, so I
 swapped it to Latin-1. But that was so long ago I don't remember where
 I gleaned the details from in the RFC. If I misread the RFC and it is
 UTF-8 then all the better to make more of the world move over to
 Unicode.

   I don't know any server that encode file names in any way. All servers
I know just pass filenames as is, 8-bit; some that implement stricter
RFC-959 mangle chr(255), but that's all. One can encounter a server that
stores files in a number of different encodings.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Should ftplib use UTF-8 instead of latin-1 encoding?

2009-01-23 Thread Oleg Broytmann
On Fri, Jan 23, 2009 at 02:35:01PM -0500, rdmur...@bitdance.com wrote:
 Given that a Unix OS can't know what encoding a filename is in (*),
 I can't see that one could practically implement a Unix FTP server
 in any other way.

   Can you believe there is a well-known program that solved the issue?! It
is Apache web server! One can configure different directories and different
file types to have different encodings. I often do that. One (sysadmin) can
even allow users to do the configuration themselves via .htaccess local files.
   I am pretty sure FTP servers could borrow some ideas from Apache in this
area. But they don't. Pity. :(

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Should ftplib use UTF-8 instead of latin-1 encoding?

2009-01-23 Thread Oleg Broytmann
On Fri, Jan 23, 2009 at 11:54:38AM -0800, Toshio Kuratomi wrote:
 AFAIK, Apache is in the same boat as ftp servers.  You're thinking of
 the encoding inside of the files.  The problem is with the file names
 themselves.

   Mostly yes. But Apache is so powerful I can do (and really did) a lot of
tricks - I can change LC_CTYPE with mod_env, I can map URLs to the
filesystem using mod_rewrite/ScriptAlias...
   FTP servers don't need to be that smart, but I'd like them to be more
configurable WRT filename encoding.
   But well, they are not, so the only thing to discuss is what to do with
ftplib and pyftpd. My not so humble opinion is - either use bytes instead
of strings or use latin-1 because it is the straightforward encoding that
preserves all 8 bits.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] patch suggestion for webbrowser

2009-01-01 Thread Oleg Broytmann
On Thu, Jan 01, 2009 at 02:24:02PM +0200, Yinon Ehrlich wrote:
 enclosed a patch for webbrowser which will find applications/batch files  
 ending with .com or .cmd too.

   Please submit the patch to the issue tracker: http://bugs.python.org/

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/p...@phd.pp.ru
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-3.0, unicode, and os.environ

2008-12-06 Thread Oleg Broytmann
On Fri, Dec 05, 2008 at 08:37:45PM -0500, James Y Knight wrote:
 On Dec 5, 2008, at 7:48 PM, Nick Coghlan wrote:
 You can't display a non-decodable filename to the user, hence the user
 will have no idea what they're working on. Non-filesystem related apps
 have no business trying to deal with insane filenames.

 Sigh, same arguments, all over again.

 Again, *both* KDE and Gnome apps display non-decodable filenames to the 
 user, and let the user work with the files. They display as good a  
 rendition as they can, using a replacement character as appropriate. In 
 some earlier versions, KDE did not work at all on poorly-encoded files, 
 and, users submitted bug reports. People do care, it does happen in real 
 life, and it is a bug in your software if you cannot deal with the users' 
 files. They just want the software to work. If it shows something weird 
 in the window titlebar, that's a bit irritating but at least it doesn't 
 get in the way of working.

   I agree 100%. Russian Unix users use at least 5 different encodings
(koi8-r, cp1251 and utf-8 are the most frequent in use, cp866 and
iso-8859-5 are less frequent). I have an FTP server with some filenames in
koi8 encoding - these filenames are for unix clients, - and some filenames
in cp1251 for w32 clients. Sometimes I run utf-8 xterm (I am
a commandline/console unixhead) for my needs (read email, write files in
utf-8 with characters beyond koi8-r, which is my primary encoding) - and
I still can work with filenames in koi8/cp1251 encodings. My filemanager
(Midnight Commander, for the matter) shows these files and directories as
?.???, but I can chdir to such directories, and I can open such
files. It would be a big bad blow for me if filemanagers (or other
programs) start to filter these filenames.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-3.0, unicode, and os.environ

2008-12-06 Thread Oleg Broytmann
On Sat, Dec 06, 2008 at 12:03:55PM +1100, Steven D'Aprano wrote:
 I'd rather have the Python API report errors then silence them, at least 
 by default.

   +1 for encoding errors by default.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-3.0, unicode, and os.environ

2008-12-06 Thread Oleg Broytmann
On Sat, Dec 06, 2008 at 02:22:29AM +0100, Martin v. L?wis wrote:
 And environment variables, command line arguments, and file names
 are not bytes, but characters.

   There is no such thing as plain text! If you say these are
characters you must also name the encoding for them. LANG/LC_ALL/LC_CTYPE
provide a sensible default, but if a program has problems decoding bytes to
characters there must be a way for the user to override the default. But
the user must be notified about the error, so programs must not silently
filters out non-decodable characters.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Fwd: Removal of GIL through refcounting removal.

2008-10-31 Thread Oleg Broytmann
On Fri, Oct 31, 2008 at 07:59:01AM -0400, Calvin Spealman wrote:
 Has anyone made the argument for keeping the GIL to discourage
 threading?

   I haven't, but I would support such argument. In my humble opinion
multithreading is rarely a good answer, and for multicore CPUs it's a wrong
answer. For multicore CPUs the answer is multiprocessing + IPC (or a good
database; filesystem is not a good database because it requires locking).
   One big problem with multithreading - it violates divide et conqueror
principle. In programming almost everything is about separation of access
rights - namespaces, modules, etc. Multithreading model allows a number of
processes to share memory.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Update to httplib.py

2008-09-25 Thread Oleg Broytmann
On Thu, Sep 25, 2008 at 09:00:56AM -0700, Bill Janssen wrote:
 Eldon Ziegler [EMAIL PROTECTED] wrote:
  I updated httplib.py, python 2.4, to be able to bind to a specific IP
  address when connecting to a remote site.
 
 Would that be something like
 
   conn = httplib.HTTPConnection('82.94.237.218', 80)
 
 Doesn't it already do that?

   It's the destination address. AFAIU OP said about source address - in
case the program runs on a computer with many addresses - multihomed server
or such...

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] ANNOUNCE: CapPython, an object-capability subset of Python

2008-09-18 Thread Oleg Broytmann
On Thu, Sep 18, 2008 at 04:33:23PM -0400, Terry Reedy wrote:
 Mark Seaborn wrote:
 I'm calling it CapPython
 
 No wonder ;-).  I like CapPy better, though there is a shareware screen 
 capture program by that name. PyCap is taken.  CapThon is not.

   CaPy, and make capybara its mascot. ;)

   Or may be captyve because the goal  of the project is to make some
code captive. :)

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] bsddb and sqlite

2008-09-07 Thread Oleg Broytmann
On Sun, Sep 07, 2008 at 11:34:37AM -0700, Gregory P. Smith wrote:
 You could probably have built the bsddb185 module and loaded your data
 from that and rewritten it using the new bsddb module.

   I built bsddb185, loaded old data, exported it to... I don't remember
now, but I clearly remember I stopped using bsddb.

 The lesson for python: when that happens lets write the code to make
 the transition between formats trivial.

   For me the lesson is different - do not include modules in the stdlib
that relies on unstable 3rd party libraries. I consider bsddb unstable.
sqlite is more stable, but PySQLite... there are many minor releases between
Python releases; my humble opinion is it'd be better to have one external
PySQLite module than two (PySQLite and sqlite3).

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] 3rd party dbm (was: [issue3769] Deprecate bsddb for removal in 3.0)

2008-09-07 Thread Oleg Broytmann
On Sun, Sep 07, 2008 at 02:35:58PM -0700, Gregory P. Smith wrote:
 On Thu, Sep 4, 2008 at 11:30 AM, Brett Cannon [EMAIL PROTECTED] wrote:
  Another thing to keep in mind with the whole shelve/dbm.any argument
  is that for 3.1 there is nothing saying we can't change shelve and the
  dbm package to allow 3rd-party code to register with the dbm package
  such that bsddb can be used as needed behind the scenes.
 
 Exactly.  That is what I think should really happen here.

   I will try to find a spare time to some job in the area. I am planning
API like this (in terms of Python 2.x with anydbm):

# dbm.something module
import anydbm
anydbm.register('something', whichdb_test_function)

   whichdb_test_function is not required - whichdb module can provide
a generic test function:

def generic_test(filename, module_name):
module = __import__(module_name)
try:
module.open(filename)
except:
return False
else:
return True

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] bsddb

2008-09-04 Thread Oleg Broytmann
On Thu, Sep 04, 2008 at 03:23:22PM +0200, Jesus Cea wrote:
 Compared to sqlite, you don't need to know SQL, you can finetuning (for
 example, using ACI instead of ACID, deciding store by store), and you
 can do replication and distributed transactions (useful, for example, if
 your storage is bigger than a single machine capacity, like my case).

   Let me raise the glove. Compared to bsddb:

-- SQLite is public domain; the licensing terms of Berkeley DB[1] are not
   friendly to commercial applications: Our open source license ...
   permits use of Berkeley DB in open source projects or in applications
   that are not distributed to third parties. I am not sure if using of
   PyBSDDB in commercial applications is considered using of Berkeley DB
   in open source projects;
-- SQLite has a pretty stable API and a pretty stable on-disk format; for
   bsddb one needs to do dump/reload on every major release;
-- SQLite implements a subset of SQL - a powerful query language;
-- SQLite is extensible - one can write his/her own functions and
   aggregates, e.g.; PySQLite allows to write these functions in Python;
   PySQLite also allows to write data conversion functions that converts
   between Python and SQL data types;
-- a program can attach a few databases at once thus distributing loads
   between a number of disks, including network mounts.

[1] 
http://www.oracle.com/technology/software/products/berkeley-db/htdocs/licensing.html

 If
 you combine Berkeley DB with Durus, for example, all of this is
 abstracted and you simply use regular python objects.

   Durus (and ZODB) has an index of all objects, the index is stored in
memory AFAIK - a real problem if one has millions of objects. Does bsddb
help to mitigate the problem?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] SQLite (was: bsddb alternative)

2008-09-04 Thread Oleg Broytmann
On Thu, Sep 04, 2008 at 01:07:23PM -0400, Jeff Hall wrote:
 Doesn't SQLlite still have a 4gb cap?

   http://sqlite.org/limits.html

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] bsddb

2008-09-04 Thread Oleg Broytmann
On Thu, Sep 04, 2008 at 07:40:28PM +0200, Jesus Cea wrote:
 A stable fileformat is useful for long term support, but an evolving
 format allows improvements.

   Once I upgraded Python on a Windows computer... I think it was 2.2 to
2.3 upgrade - and all my bsddb databases stopped working. I cannot call
this improvement. I didn't have db_upgarde on that computer (or I didn't
know about it). Does PyBSDDB have db_upgrade in the distribution? Does
Python distribution have db_upgrade?

 Following your reasoning, Python should be
 keep in 1.0 era, for compatibility sake.

   Python? No. But persistent data structures? Yes! How many different
pickle data formats there were since Python 1.0? What is the oldest
pickle format modern Python can read? (Just using pickle as an example.)

  -- SQLite implements a subset of SQL - a powerful query language;
 
 Yes, a declarative language completely unrelated to Python.

   Sometimes being unrelated to Python is advantage. Written in C,
optimized for its tasks, the implementation of the query language
certainly can outperform Python.

 Using a SQL storage to save persistent
 Python objects is ugly

   No more ugly than any other storage. A matter of taste, I think.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] 3rd-party dbms

2008-09-04 Thread Oleg Broytmann
Brett Cannon [EMAIL PROTECTED] wrote:
 for 3.1 there is nothing saying we can't change shelve and the
 dbm package to allow 3rd-party code to register with the dbm package
 such that bsddb can be used as needed behind the scenes.

   Many years ago I wrote toy hashes based on ZODB and MetaKit. Registering
them with anydbm was easy:

import anydbm
anydbm._names.insert(len(anydbm._names)-1, ['ZODBhash', 'MKhash'])
# Insert before dumbdbm

   More complex part was to make whichdb to recognize those hashes. I just
monkey-patched whichdb. If I were doing this now I'd do something similar
to atexit module - every hash module will register its own test function,
and whichdb will call them in turn until it finds which db it is.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] subprocess insufficiently platform-independent?

2008-08-25 Thread Oleg Broytmann
On Mon, Aug 25, 2008 at 01:30:58PM -0400, Barry Warsaw wrote:
 Unless I'm misremembering (I no longer have access to Windows), I  
 believe that if you use ' '.join(cmd) as the first argument, it will  
 work cross-platform.

   What about arguments that contain spaces?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] next beta

2008-08-11 Thread Oleg Broytmann
On Mon, Aug 11, 2008 at 12:50:16PM +, Antoine Pitrou wrote:
 Ah, am I the only one *not* to use Google calendar? :)

   Certainly, no! (-:

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] April 1st jokes (was: Base-96)

2008-08-03 Thread Oleg Broytmann
On Sat, Aug 02, 2008 at 02:15:29PM -0700, Guido van Rossum wrote:
 On Sat, Aug 2, 2008 at 11:57 AM, Guido van Rossum [EMAIL PROTECTED] wrote:
  That was an April Fool's RFC.
 
 See also http://en.wikipedia.org/wiki/April_Fools%27_Day_RFC -- it has
 a ton of these. Great fun reading through some of them on an idle
 Saturday afternoon. :-)

   There were a lot of Python jokes for the Apr 1st. What a pity we have
ceased to make such jokes.

http://mail.python.org/pipermail/python-list/2001-April/076593.html

http://mail.python.org/pipermail/python-list/2003-April/197232.html

http://mail.python.org/pipermail/python-list/2004-April/256320.html
   (Despite being a joke it really works!)

http://mail.python.org/pipermail/python-list/2005-April/315453.html

http://mail.python.org/pipermail/python-list/2005-April/315457.html

http://mail.python.org/pipermail/python-list/2006-April/375866.html

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] urllib.quote and unquote - Unicode issues

2008-07-30 Thread Oleg Broytmann
On Thu, Jul 31, 2008 at 12:11:40AM +1000, Matt Giuca wrote:
 2. Default to UTF-8.
 In favour: Matt Giuca, Brett Cannon, Jeroen Ruigrok van der Werven

   Count me too: +1. Most sites I use theese days use UTF-8 for URL
encoding. Examples:

Wikipedia:
http://ru.wikipedia.org/wiki/%D0%93%D0%B2%D0%B8%D0%B4%D0%BE_%D0%B2%D0%B0%D0%BD_%D0%A0%D0%BE%D1%81%D1%81%D1%83%D0%BC

LingVo (Russian-English dictionary):
http://lingvo.yandex.ru/en?text=%D0%BF%D0%B8%D1%82%D0%BE%D0%BD

 print urllib.quote(unicode('питон', 'koi8-r').encode('utf-8'))
%D0%BF%D0%B8%D1%82%D0%BE%D0%BD

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] str(container) should call str(item), not repr(item)

2008-07-28 Thread Oleg Broytmann
On Mon, Jul 28, 2008 at 10:28:34AM +0200, Ondrej Certik wrote:
 http://mail.python.org/pipermail/python-3000/2008-May/013876.html

   The PEP is pep-3140: http://python.org/peps/pep-3140.html and it has
been rejected. To revive it we need better, more compelling arguments. We
also need a plan for implementation that would be good enough to be
accepted. Current proposals for implementation are listed in the PEP with
their disadvantages.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Slice as a copy... by design?

2008-05-22 Thread Oleg Broytmann
On Thu, May 22, 2008 at 12:28:47PM -0300, Facundo Batista wrote:
 considering that strings
 are immutable, why a slice of a string is a copy and not a reference
 to a part of that string.

   I remember some discussions... let me see... google to help... aha:

http://mail.python.org/pipermail/python-3000/2006-August/003224.html
http://mail.python.org/pipermail/python-3000/2006-August/003242.html

   2006, August... I don't remember what was the resolution of the
discussion.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Addition of pyprocessing module to standard lib.

2008-05-21 Thread Oleg Broytmann
On Wed, May 21, 2008 at 10:11:05AM -0500, [EMAIL PROTECTED] wrote:
 Maybe the presence of a functioning ctypes (can|might|should|will) become
 the operational definition of Python runs on platform X.

   It is not black-or-white, runs or doesn't. PythonD, e.g., runs on DOS,
can use sockets (from WatTCP library), but certainly cannot do
multithreading or multitasking.
   So the wording should be Python supports platform X with the following
limitations: ...

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Oleg Broytmann
On Tue, May 20, 2008 at 10:22:37AM +0200, Martin v. L?wis wrote:
 I'd like to propose a new environment variable PYTHONSTDOUTENCODING.
 This is meant to solve various problems that people had with Python
 not detecting their terminal encoding correctly; it would override
 any detection that Python would use for determining the encoding of
 stdout (and stdin - but that's less relevant in 2.x).

   Is it to override locale settings in case the user wants a different
encoding? for such cases as redirected stdout, or windows console (which
has an OEM encoding that differs from the locale encoding)?

 Naming contest: it probably would be the longest of the PYTHON*
 variables. I would not want to call it PYTHONENCODING, or
 PYTHONSTDENCODING, though, because people might infer that it
 affects sys.getdefaultencoding(), which it shouldn't.

   PYTHONIOENCODING?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Oleg Broytmann
On Tue, May 20, 2008 at 10:22:03PM +0200, Martin v. L?wis wrote:
 PYTHONIOENCODING?
 
 Unprecise in a different way (as it is meant to apply only to stdout,
 not to all IO), but shorter.

   I don't think you can make it both precise and short. If you want to be
precise and have both PYTHON and STDOUT - shorten ENCODING to ENC. If you
agree to sacrifice PYTHON - make it PYSTDOUTENCODING.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] SSH connection sharing

2008-05-16 Thread Oleg Broytmann
Hello! I would like to share a useful tip on how to speedup many short ssh
(scp, rsync, svn over ssh) sessions (on Unix). Sorry if this information is
widely known; I learned the trick a week ago and I am pretty happy with it.

OpenSSH4 on Unix allows connection sharing - utilizing one authenticated
TCP connection for a number of SSH sessions. The advantage is that
subsequent connections don't need to open a new TCP connections and don't
need to pass the authentication phase, thus they initialize a session much
faster. This is very useful for running a lot of short ssh sessions (scp,
sftp, rsync, svn over ssh).

Detailed docs are in man ssh_config; see options ControlMaster and
ControlPath. There is a lot of information_ on the web.

.. _information: 
http://www.google.com/search?hl=enie=utf-8oe=utf-8q=ssh%20ControlPath

Add the following to your ~/.ssh/config::

   ControlMaster auto
   ControlPath ~/.ssh/[EMAIL PROTECTED]:%p

*ControlMaster auto* means the first client becomes the master, it opens
TCP connection, authenticates and opens a unix socket named in ControlPath.
Subsequent clients use the unix socket to connect to the server via the
already established connection. In case the user tries to close the first
(master) client it will wait until all sessions are finished; in case the
user kills the master, it kills all its shared sessions.

I use all 3 recommended macros, because I use ssh/scp/sftp/rsync/svn to
connect to a number of servers.

Drawbacks: the subsequent connections inherit some attributes of the
master; agent forwarding, e.g. If ssh (or the OS, or even the entire
computer) crashes one needs to remove unix sockets manually; to remedy this
I changed ControlPath to ~/.ssh/controls/[EMAIL PROTECTED]:%p and added to my
crontab::

   @reboot rm -f .ssh/controls/*

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Buildbots have trouble checking out the repository due to recent changes.

2008-05-11 Thread Oleg Broytmann
On Sun, May 11, 2008 at 11:45:03PM +0200, Georg Brandl wrote:
 In any case, how does SVN on Windows handle this situation, having two
 identical filenames -- except for case -- in one directory?

   Very bad. It's completely confused. It can checkout one of the files and
commit the other.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] shal we redefine module and package?

2008-04-30 Thread Oleg Broytmann
On Wed, Apr 30, 2008 at 04:21:13PM -0600, zooko wrote:
 so perhaps instead the implementors should start using the  
 terminology understood by the programmers:
 
 1.  A module shall henceforth be the name for either a foo.py file  
 (a single-file module), or a directory with an __init__.py in it (a  
 directory module).
 
 2.  A package shall henceforth be the name of the thing that is  
 currently called a distribution.

   And while we are at it, I'd like to propose to rename the very language
because everybody knows that python is a huge four-legged poisonous lizard.
(Sorry for being so poisonously [pythonic?] sarcastic. Just cannot resist.)

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Decimal(unicode)

2008-03-25 Thread Oleg Broytmann
Hello. In Python 2.5.1 the code

import decimal

for d in '123', u'123':
x = decimal.Decimal(d)
print type(x.to_eng_string())

prints

type 'str'
type 'str'

   In 2.5.2 it prints

type 'str'
type 'unicode'

   Why the change? Is it a bug or a feature? Shouldn't .to_eng_string()
always return a str?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Decimal(unicode)

2008-03-25 Thread Oleg Broytmann
On Tue, Mar 25, 2008 at 10:47:42AM -0400, Mark Dickinson wrote:
 On Tue, Mar 25, 2008 at 9:46 AM, Oleg Broytmann [EMAIL PROTECTED] wrote:
 In 2.5.2 it prints
 
   type 'str'
   type 'unicode'
 
 Why the change? Is it a bug or a feature? Shouldn't .to_eng_string()
   always return a str?
 
 I'd call this a bug.  The change is an accident, a side-effect of the fact
 that in 2.5.1 the coefficient (mantissa) of a Decimal was stored as a
 tuple, and in 2.5.2 it's stored as a string (which greatly improves 
 efficiency).
 Clearly in 2.5.2 the mantissa is being stored as a unicode instance in the
 second case;  it should be explicitly coerced to str in Decimal.__new__.
 
 If others agree that it's a bug, I'll fix it.

http://bugs.python.org/issue2482

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Primer on distributed revision control?

2008-03-21 Thread Oleg Broytmann
On Fri, Mar 21, 2008 at 05:17:00PM -0500, [EMAIL PROTECTED] wrote:
 With all these distributed revision control systems now available (bzr, hg,
 darcs, svk, many more), I find I need an introduction to the concepts and
 advantages of repository distribution.  It seems to me that it has the
 potential for leading to anarchy, though I can see how some things would be
 improved (working offline, maintaining local patches).  It's not obvious how
 I push changes back upstream.  Can someone point me to some useful content
 (web pages or books) which will help me wrap my brain around the ideas?

http://en.wikipedia.org/wiki/Revision_control#Distributed_revision_control

http://www.selenic.com/mercurial/wiki/index.cgi/UnderstandingMercurial
http://www.selenic.com/mercurial/wiki/index.cgi/CommunicatingChanges

http://doc.bazaar-vcs.org/latest/en/user-guide/index.html#sharing-with-peers

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Trove classifiers

2008-03-20 Thread Oleg Broytmann
On Thu, Mar 20, 2008 at 04:43:55PM +0100, Jeroen Ruigrok van der Werven wrote:
 -On [20080320 15:29], Martin v. L??wis ([EMAIL PROTECTED]) wrote:
 (Trove classifiers, although the word trove means nothing to me)
 
 Isn't that something lifted from SourceForge?

   Yes, exactly. Eric Raymond claims to be the inventor, but there are
different voices against him:
http://damagestudios.net/blog/2005/08/15/sourceforge-founders

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] New/Old class exception pitfall

2008-03-17 Thread Oleg Broytmann
On Mon, Mar 17, 2008 at 06:35:46PM -0400, Alexander Belopolsky wrote:
 class x:
  pass
 class y(x):
  pass
 try:
  raise y
 except y:
  print a
 except:
  print b
 
 It prints 'b'.

   Python 2.2, 2.3, 2.4 and 2.5 on Linux: prints 'a'.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] New/Old class exception pitfall

2008-03-17 Thread Oleg Broytmann
On Mon, Mar 17, 2008 at 07:18:25PM -0400, Alexander Belopolsky wrote:
 I don't have my PowerBook here,  but I am sure I've seen in on Mac OS
 too.  Only new-style class behavior is problematic.  The following
 code prints 'b' for me:
 
 __metaclass__ = type

   Ah, yes - with this addition it prints 'b'.

 class x:
 pass
 class y(x):
 pass
 try:
 raise y
 except y:
 print a
 except:
 print b

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Documentation for ability to execute zipfiles directories

2008-03-04 Thread Oleg Broytmann
On Tue, Mar 04, 2008 at 10:35:42PM +1000, Nick Coghlan wrote:
 not needing an explicit interpreter option makes it more shebang friendly

   Sorry, I missed something here. How does one combine a zipfile with
a shebang script?!

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Documentation for ability to execute zipfiles directories

2008-03-04 Thread Oleg Broytmann
On Wed, Mar 05, 2008 at 12:14:04AM +1000, Nick Coghlan wrote:
 As a more helpful answer, the ZIP spec allows additional data to be 
 included in the file before the ZIP header. A more common way of using 
 this is to add a zip file on to the end of an ELF executable while still 
 using normal zipfile utilities to read the data in the zip file section 
 and ignore the executable part.
 
 It turns out you can actually use the same trick to prepend a shebang 
 line like /usr/bin/env python and a newline character

   That's what I thought, too.

 - the whole zip 
 file is still a binary file, but that doesn't prevent the shell from 
 reading that first line of text and handing the file over to Python for 
 execution.

   Unix doesn't distinguish text and binary files. (-:

 The fact that this actually works was also news to me when the issue I 
 linked in my previous post was first brought to my attention :)

   So it really works? Amazing!

   Thank you!

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Buildbots for trunk are all red

2008-02-28 Thread Oleg Broytmann
On Thu, Feb 28, 2008 at 09:00:54PM +0100, Christian Heimes wrote:
 Oh yeah ... ZODB4 and BDBStorage ... a dark chapter starting with high
 hopes and ending in tragedy ... Several projects like Zope and
 Subversion worked hard on a a Berkeley DB backend but in the end all
 projects had the same fate.
 
 A few years ago in Geteborg/SE during lunch Jim explained me the reasons
 for the cancellation. As far as I remember the conversation he used some
 words I dare not to repeat in public. Some kids may read the Python dev
 list. :)

   Sorry, can I ask an additional question? These words - what they were
about? about the architecture of BDBStorage and Subversion, or about the
very BerkeleyDB, or about what?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Buildbots for trunk are all red

2008-02-26 Thread Oleg Broytmann
On Tue, Feb 26, 2008 at 02:04:47PM -0800, Brett Cannon wrote:
 Or we can get rid of bsddb and not have the problem anymore. =)

   +1 for smaller stdlib and fewer problems.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] [Python-checkins] r60919 - peps/trunk/pep-0008.txt

2008-02-22 Thread Oleg Broytmann
On Fri, Feb 22, 2008 at 10:12:16AM -0600, [EMAIL PROTECTED] wrote:
 I use svn
 annotate from time-to-time which adds an even wider margin to the left.
 In those situations I either grin and bear it or stretch my window enough to
 view it without wrapping.

   svn blame | less -S

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] trunc()

2008-01-25 Thread Oleg Broytmann
On Fri, Jan 25, 2008 at 11:32:54AM -0800, Guido van Rossum wrote:
 Does no-one thinks it means round(f) either?

   I don't think so. I often emulate round(f) as int(f + 0.5).

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Incorrect documentation of the raw_input built-in function

2008-01-24 Thread Oleg Broytmann
On Thu, Jan 24, 2008 at 12:36:51PM -0500, Isaac Morland wrote:
 What about an option (maybe even a default) to send the prompt to stdin?
 
 The Postgres command line interface psql appears to do this:
 
 $ psql 21 /dev/null
 Password:
 $
 
 (I typed my password and then I quit by typing ^D; if I type the wrong 
 password, it looks the same on screen but it quits right away without 
 waiting for ^D)
 
 I think ssh also does this when it needs to prompt for a password.

   One cannot write to stdin:

 sys.stdin.write(1\n)
Traceback (most recent call last):
  File stdin, line 1, in module
IOError: [Errno 9] Bad file descriptor

   But it is possible to explicitly open the current console for reading
and writing and do I/O regardless of stdin/stdout/stderr redirects:

 tty = open(/dev/tty, r+)
 tty.write(1\n)
1
 line = tty.readline()
DDD
 line
'DDD\n'

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] #! magic

2008-01-21 Thread Oleg Broytmann
On Mon, Jan 21, 2008 at 12:01:29PM +0100, Christian Heimes wrote:
 The arg -Es may work because Python's arg parser doesn't recognize it as
 two args -E -s but as the arg -E.

   Thank goodness python is better than that:

$ python -Es
Unknown option: -s
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

$ python -E -s
Unknown option: -s
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] #! magic (was PEP: per user site-packages directory)

2008-01-20 Thread Oleg Broytmann
On Sun, Jan 20, 2008 at 06:00:31PM +0100, Christian Heimes wrote:
 #!/usr/bin/env python -E -s

   On most Unicies #! magic may have only one parameter after the program;
the program here is env, the parameter is python, and that's all. Adding
python options will result in different errors - some platforms silently
ignores the options, some reports an error, some tries to find python -E -s
in the PATH and report Bad command or file name.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] #! magic

2008-01-20 Thread Oleg Broytmann
On Sun, Jan 20, 2008 at 06:25:57PM +0100, Jeroen Ruigrok van der Werven wrote:
 -On [20080120 18:12], Oleg Broytmann ([EMAIL PROTECTED]) wrote:
On most Unicies #! magic may have only one parameter after the program;
 the program here is env, the parameter is python, and that's all. Adding
 python options will result in different errors - some platforms silently
 ignores the options, some reports an error, some tries to find python -E -s
 in the PATH and report Bad command or file name.
 
 IEEE Std 1003.1, 2004:
 
 The shell reads its input

   A shell has nothing to do with it as it is the OS (exec system call)
that upon reading the magic of the file sees #! and executes the program
(up to the first space) and pass to the program the first (and the only)
parameter.

#! /usr/bin/env python -O

   [trying to execute the script on Linux]

/usr/bin/env: python -O: No such file or directory

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-Dev Digest, Vol 54, Issue 57

2008-01-20 Thread Oleg Broytmann
On Sun, Jan 20, 2008 at 06:46:31PM +0100, Jan Claeys wrote:
 Op woensdag 16-01-2008 om 02:33 uur [tijdzone +0100], schreef Christian
 Heimes: 
  Bill Janssen wrote:
   Good point, but I prefer ~/Library/Python to either of these.
  
  ~/Library/ is a Mac OS X thing. I haven't seen it on other Unix systems.
 
 There is (at least) one linux distro using it, but it's not very
 well-known.

   Gobo Linux?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] #! magic

2008-01-20 Thread Oleg Broytmann
On Sun, Jan 20, 2008 at 07:30:03PM +0100, Christian Heimes wrote:
 Oleg Broytmann wrote:
  #! /usr/bin/env python -O
  
 [trying to execute the script on Linux]
  
  /usr/bin/env: python -O: No such file or directory
  
  Oleg.
 
 Oh right. I was sure that I've seen a shebang with options somewhere. It
 might have been a shell script or a perl script.

   Yes, one can write
#! /usr/bin/python -O
   This works. The OS (exec system call) splits the string into a program
(python) and a single parameter (-O), and python knows how to handle -O.

   The problem with
#! /usr/bin/env python -O
   is that exec splits it into a program (env) and a single parameter
(python -O) and env doesn't know how to run python -O.

 Yet another python executable could solve the issue

   I doubt it. It is env that doesn't know how to run python -O in my
example, not python's problem.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-Dev Digest, Vol 54, Issue 57

2008-01-20 Thread Oleg Broytmann
On Sun, Jan 20, 2008 at 07:34:02PM +0100, Jan Claeys wrote:
 Op zondag 20-01-2008 om 20:46 uur [tijdzone +0300], schreef Oleg
 Broytmann:
  On Sun, Jan 20, 2008 at 06:46:31PM +0100, Jan Claeys wrote:
   Op woensdag 16-01-2008 om 02:33 uur [tijdzone +0100], schreef Christian
   Heimes: 
~/Library/ is a Mac OS X thing. I haven't seen it on other Unix systems.
   
   There is (at least) one linux distro using it, but it's not very
   well-known.
  
 Gobo Linux?
 
 Now that I think about it, I'm not sure they use it under $HOME too, but
 I was thinking about that distro, yes, as they use such a scheme for the
 rest of their system (and it seems natural to do so throughout then).

   I don't know if they have a scheme for $HOME.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] #! magic

2008-01-20 Thread Oleg Broytmann
On Mon, Jan 21, 2008 at 12:17:20AM +0200, Tristan Seligmann wrote:
 * Oleg Broytmann [EMAIL PROTECTED] [2008-01-20 20:12:38 +0300]:
 
  On Sun, Jan 20, 2008 at 06:00:31PM +0100, Christian Heimes wrote:
   #!/usr/bin/env python -E -s
  
 On most Unicies #! magic may have only one parameter after the program;
  the program here is env, the parameter is python, and that's all. Adding
  python options will result in different errors - some platforms silently
  ignores the options, some reports an error, some tries to find python -E 
  -s
  in the PATH and report Bad command or file name.
 
 Distro tools shouldn't be using /usr/bin/env in any case. Does
 
 #!/usr/bin/python -E -s
 
 work?

   No:

Unknown option: - 
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

   -Es together work. I think this is why Unix has the tradition of
combining options.

PS. My python doesn't understand -s, so I tested a different options, but
the result is the same. There are Unix variants that understand many
options (I believe FreeBSD allows them) but most allow no more than one
parameter in #!.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP: per user site-packages directory

2008-01-15 Thread Oleg Broytmann
On Mon, Jan 14, 2008 at 11:41:47PM +, Jon Ribbens wrote:
 It makes sense, but personally I have never heard before of ~/.local.
 Whereas ~/bin is something I am quite familiar with.

   Me too. python-dev is the only place I have heard of ~/.local. I have
been using Linux (different distributions), Solaris and FreeBSD for quite
a long time (though I have never used GNOME/KDE/etc.)

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] PEP: per user site-packages directory

2008-01-15 Thread Oleg Broytmann
On Tue, Jan 15, 2008 at 01:21:46PM +0100, Christian Heimes wrote:
 It took me a while to find a reference to .local. It's part of the
 FreeDesktop.Org standards:
 http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html

   The site only mentions $HOME/.local/share, there is no $HOME/.local/bin
at the site.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-Dev Digest, Vol 54, Issue 57

2008-01-15 Thread Oleg Broytmann
On Tue, Jan 15, 2008 at 12:11:37PM -0800, Daniel Arbuckle wrote:
 I use ~/local, with a layout analogous to /usr, all the time. It's not
 a standard, but in my experience it is by far the best solution to
 installing things in the home directory. It doesn't matter much
 whether you call it local or .local or .pythonlocal (although that
 last would limit the utility somewhat, by implying that other things
 should be installed there). It does matter that it be a _subdirectory_
 of ~, and that it be structured like /usr.

   ~/.python
   ~/.python/bin
   ~/.python/lib
   ~/.python/lib/python2.5

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-Dev Digest, Vol 54, Issue 57

2008-01-15 Thread Oleg Broytmann
On Tue, Jan 15, 2008 at 02:34:02PM -0600, [EMAIL PROTECTED] wrote:
 Oleg~/.python
 Oleg~/.python/bin
 Oleg~/.python/lib
 Oleg~/.python/lib/python2.5
 
 The drawback of this approach is that it implies that Perl, Tcl, IPython,
 etc. belong in their own .whatever directory.

   How many users install (parts of) all of these into their homes?

 The IT folks here at work do
 things that way (though not in home directories).  If I want to build a
 package which relies on zlib, libpng, libtiff, libjpeg, etc., imagine what
 my CPPFLAGS, CFLAGS and LDFLAGS arguments look like.  :barf:

   Why not use GNU stow?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Python-Dev Digest, Vol 54, Issue 57

2008-01-15 Thread Oleg Broytmann
On Wed, Jan 16, 2008 at 06:31:42AM +0900, Stephen J. Turnbull wrote:
 I think both for UI reasons (given above) and for API reasons (given
 by others) there should be a separate ~/SOMETHING/{bin,etc,lib,share}
 hierarchy for user-specific packaged contents.  I like ~/.local a
 little better than ~/local, but both work for me.

   Having ~/.python allows me remove it with just one command. It's harder
to clear ~/.local/{bin,lib} without affecting whatever I want to preserve
there.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-07 Thread Oleg Broytmann
On Sun, Jan 06, 2008 at 04:23:59PM -0800, Guido van Rossum wrote:
 I don't want py or python to be
 part of the stdlib package namespace. *If* (part of) the stdlib has to
 live under a single distinguished name, pick something like std or
 core. When I'm using Python I already know I'm using Python, I don't
 want to be reminded of that fact on every import line.

   When I'm using Jython - am I using Python of Java? After

from java.lang import Class

   should it be

from py import exceptions

   or

from core import exceptions

   ?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-06 Thread Oleg Broytmann
On Sun, Jan 06, 2008 at 11:12:43PM +, Paul Moore wrote:
 If we want a guaranteed-stdlib package form, we should probably have
 a top-level package, std or whatever.

   py.

 That notion has, I believe,
 been shot down before (no time to look up references now).

   Mr Van Rossum has spoken against it many times.

   Now I think - if we don't want a separate Python's top-level namespace
may be we should think about a separate top-level non-Python's (3rd
parties') namespace? With it we could have database.sqlite (Python's
sqlite) and user.database.sqlite (a newer version); and by doing import
database.sqlite you know exactly what version you are importing.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Return type of round, floor, and ceil in 2.6

2008-01-05 Thread Oleg Broytmann
On Sat, Jan 05, 2008 at 05:35:45PM -0200, Facundo Batista wrote:
 2008/1/5, Art Rasmussen [EMAIL PROTECTED]:
  Added Python to the referenced article (because I believe Python
  should be seen everywhere C#, PHP, Visual Basic, etc., are seen).
  Please let me know if the article needs updating/fixing.
 
 Well, don't know.
 
 It talks about the rounding in Python, but mentioning only the binary
 floating point. In Decimal you have a lot of different roundings
 available... it's worth to mention them?

   IMO it's worth to mention the existing of them, briefly.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] New Standard Library Module

2007-12-05 Thread Oleg Broytmann
On Wed, Dec 05, 2007 at 06:17:34PM +, Michael Foord wrote:
 Can I suggest a new module for the standard library: 'antigravity.py'.

   A friend of mine (the person who has suggested raise without
arguments) recommends implementing it in two phases. The first should be

from __future__ import antigravity

XKCD'ly yours ;)
Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] blocking a non-blocking socket

2007-12-02 Thread Oleg Broytmann
On Sun, Dec 02, 2007 at 12:23:01PM -0800, Bill Janssen wrote:
[skip]
 Or, should I just set the timeout:
 
 timeout = self.gettimeout()
 try:
 self.settimeout(None)
   self.do_handshake()
 finally:
 self.settimeout(timeout)

   Yes, this is the correct solution for all cases: if the timeout is None
(socket is blocking) or 0 (non-blocking) or not-0 (blocking with timeout)
- just set it back.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] [poll] New name for __builtins__

2007-11-30 Thread Oleg Broytmann
On Fri, Nov 30, 2007 at 03:05:18PM -0800, Guido van Rossum wrote:
 On Nov 30, 2007 2:17 PM, Nicko van Someren [EMAIL PROTECTED] wrote:
  +1 for __universal__
 
 It's almost as if nobody has seen my proposal to leave __builtins__
 alone and rename the __builtin__ module instead.

   I saw it, and I think it'd be the best.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] [poll] New name for __builtins__

2007-11-29 Thread Oleg Broytmann
On Thu, Nov 29, 2007 at 10:27:37AM -0500, Barry Warsaw wrote:
  Perhaps someone here can draw some inspiration from __monty__ python's
  flying __circus__.  It would be nice to have a name with a pythonic
  __ground__.
 
 Clearly then, it should be called __bruce__.

   No, __spam__!

__Oleg__Stressed__by__undersores__'ly yours.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] [poll] New name for __builtins__

2007-11-29 Thread Oleg Broytmann
On Fri, Nov 30, 2007 at 11:22:03AM +1300, Greg Ewing wrote:
 The next step up from global would be __galactic__.

   Let me skip __universe[al]__ and go directly to The Ultimate Questions:
Is there __life__ after __death__? Does __Deity__ exist? What attributes,
properties and keys has __He__ got?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] MacOSX -framework options and distutils weirdness

2007-10-12 Thread Oleg Broytmann
On Fri, Oct 12, 2007 at 09:21:15PM +1300, Greg Ewing wrote:
 So the bizarre state of affairs is that if distutils
 runs gcc through a shell script, it works, but if
 it runs gcc directly, it doesn't work.
 
 Anyone have any ideas on how that can happen?

   Do you have a few different copies of gcc installed with setup.py called
the wrong one and your shell script the right one?

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Iterating over objects of unknown length

2007-09-26 Thread Oleg Broytmann
Hello!

   (This seems like a developing with Python question and partially it is
but please read on.)

   I have a class that represents SQL queries. Instances of the class can
be iterated over. As an SQL query doesn't know in advance if it will
produce any row the class doesn't implement __len__(). Moreover, users of
the class sometimes write

if sqlQuery:
   for row in sqlQuery: ...
else:
   # no rows

which is a bug (the query doesn't know if it's True or False; to find it
out the user have to execute the query by trying to iterate over it). To
prevent users from writing such code the class implements __nonzero__()
that always raises an exception.
   Unfortunately, I found some libraries test the object in boolean context
before iterating over it and that, of course, triggers the exception from
__nonzero__().
   Even worse, some libraries test the object in boolean context regardless
of iterating over it. For example, logging module (this is where my
question becomes developing for Python) triggers the exception in such
simple case:

logginig.debug(Query: %s, sqlQuery)

   Funny, the code

logginig.debug(Query: %s, another: %s, sqlQuery, another_value)

   doesn't trigger the exception. This is due to the code in
logginig/__init__.py:

if args and (len(args) == 1) and args[0] and (type(args[0]) == 
types.DictType):
args = args[0]

(class LogRecord, method __init__). and args[0] triggers the exception.

   My questions are:

1. Should I consider this a bug in the logging module (and other libraries)
   and submit patches?
2. Or should I stop raising exceptions in __nonzero__()?

   In this particular case with logging the fix is simple - do and args[0]
after type check.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Iterating over objects of unknown length

2007-09-26 Thread Oleg Broytmann
On Wed, Sep 26, 2007 at 09:29:10AM -0700, Guido van Rossum wrote:
 But I also fail to see why you would be so draconian as to disallow
 truth testing of a query altogether. Your query looks like an
 iterator. There are tons of other iterators in the language, library
 and 3rd party code, and it would be madness to try to fix all of them
 in the way you suggest just because some users don't get the concept
 of iterators.

   Seems me myself didn't get it:

On Wed, Sep 26, 2007 at 12:33:33PM -0400, Phillip J. Eby wrote:
 This isn't consistent with iterators; e.g.:
 
  x=iter([])
  if x: print yes
 ...
 yes

On Wed, Sep 26, 2007 at 09:29:10AM -0700, Guido van Rossum wrote:
 So I'm for #1 *and* #2.

   I see now. Thank you!

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Iterating over objects of unknown length

2007-09-26 Thread Oleg Broytmann
On Thu, Sep 27, 2007 at 01:33:47PM +1200, Greg Ewing wrote:
 Oleg Broytmann wrote:
 if sqlQuery:
for row in sqlQuery: ...
 else:
# no rows
 
 To prevent users from writing such code the class implements __nonzero__()
 that always raises an exception.
 
 I'm not sure I like that idea. It's common practice to write
 'if x:' as a shorthand for 'if x is not None:' when it's known
 that x is an object that doesn't have a notion of emptiness.
 Another thing is that any code doing if x to test for
 emptiness is clearly expecting x to be a sequence, *not*
 an iterator, and you've violated the contract by passing
 it one. This is what you may be running into with the libraries
 you mention.

   In most cases the code in those libraries is, using the word of Mr. van
Rossum, archaic. It was developed for old versions of Python (long before
Python has got the iterator protocol). I will file bug reports and patches
(I have filed one about logginig/__init__.py) to allow developers to either
fix the code or document the fact the code really requires a finite
sequence.
   Unfortunately now when my code no longer raises an exception it would be
harder to spot the buggy libraries.

 Generally I think it's a bad idea to try to protect people
 from themselves when doing so can interfere with legitimate
 usage.

   I agree. I admitted in mailing list it was my design mistake. The
offending __nonzero__ was removed from SVN today.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] Summaries and the New Lists

2007-04-24 Thread Oleg Broytmann
On Tue, Apr 24, 2007 at 04:37:14PM -0400, Calvin Spealman wrote:
 So, the question I pose is how would everyone like to see this
 resolved? As I see it, there are two things I can do. I can either
 summaries each list separately, and try to sort out the cross overs.
 Or, I can start pulling in all three development lists into all the
 summaries. I prefer the second option

   I prefer the second, too.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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] More exposure for PEP8 (was: context manager - generator interaction?)

2007-04-06 Thread Oleg Broytmann
On Fri, Apr 06, 2007 at 10:58:41AM -0400, Barry Warsaw wrote:
 It might even be worthwhile to give PEP 8  
 more exposure in the tutorial or on the documentation ToC page.

   And bundle the PEP with the distributed documentation.

Oleg.
-- 
 Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.
___
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


  1   2   >