Re: New user: Windows, Postgresql, Python

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Marco Colombo <marco(at)esi(dot)it>
Cc: Paul Moore <pf_moore(at)yahoo(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: New user: Windows, Postgresql, Python
Date: 2005-03-16 14:34:54
Message-ID: 20050316143454.GA14572@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 16, 2005 at 01:46:23PM +0100, Marco Colombo wrote:
>
> It seems python documentation is plain wrong, or I'm not able to
> read it at all:
>
> http://docs.python.org/ref/physical.html
>
> "A physical line ends in whatever the current platform's convention is for
> terminating lines. On Unix, this is the ASCII LF (linefeed) character. On
> Windows, it is the ASCII sequence CR LF (return followed by linefeed). On
> Macintosh, it is the ASCII CR (return) character."

Perhaps the Python documentation could use some clarification about
when the platform's convention is required and when it isn't.

The "Embedding Python" documentation shows embedded code with lines
ending in \n and without saying anything about requiring the
platform's convention:

http://docs.python.org/ext/high-level-embedding.html

> This is the language _reference_ manual, btw. I'm very surprised to hear
> python on windows is so broken.
>
> Anyway, that makes life simpler for us. plpython programs are \n separated,
> no matter what platform the server runs on.

That the behavior makes life simpler is an argument against it being
broken (although it would be even less broken if it were more
flexible about what line endings it allows). A detailed response
would be getting off-topic for PostgreSQL, but I'll stand by what
I said earlier: I would find it bizarre if embedded Python code had
to use different line endings on different platforms. That would
mean the programmer couldn't simply do this:

PyRun_SimpleString("x = 1\n"
"print x\n");

Instead, the programmer would have to do a compile-time or run-time
check and build the string in a platform-dependent manner. What
problem would the language be solving by requiring that?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hicks, Bob 2005-03-16 14:47:37 Windows and Pg8
Previous Message Miroslav Šulc 2005-03-16 14:34:47 psql file restore - problem with encoding