ANN: Jug 0.9.1. Parallel Programming Framework

2012-06-12 Thread Luis Pedro Coelho
Hello List,

This is to let you know of a new release of Jug.

Jug allows you to write code that is broken up into tasks and run different 
tasks on different processors (even across a cluster).

Jug is a pure Python implementation and should work on any platform.

WHAT'S NEW

Version 0.9.1 contains a few minor improvements and several bugfixes.

In particular, Tasklet usage is a lot less buggy (previously, several uses 
would trigger idiotic bugs, now they work as they should).

LINKS

*Mailing List*: http://groups.google.com/group/jug-users
*Documentation*: http://packages.python.org/Jug
*Code*: http://github.com/luispedro/jug
*Website*: http://luispedro.org/software/jug
*Video*: http://vimeo.com/8972696

Bug reports, suggestions, c are welcome. On the jug-users mailing list or by 
private email to me.
-- 
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org


-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Ann: New Stackless Website

2012-06-12 Thread Christian Tismer

I'm very happy to announce

==
Stackless Python has a New Website
==

Due to a great effort of the Nagare people:

http://www.nagare.org/

and namely by the tremendous work of Alain Pourier,

Stackless Python has now a new website!

This is no longer Plone based, but a nicely configured Trac site.

The switch to it has happened right now, the old website
will be around for a few days under

http://zope.stackless.com

while the new site is accessible as

http://www.stackless.com

stackless.com now allows the source to be browsed (an hourly updated
clone from hg.python.org) and includes a new issue tracker.

Please let me know if you encounter any problems.

cheers -- Chris

--
Christian Tismer :^)mailto:tis...@stackless.com
tismerysoft GmbH : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 :*Starship* http://starship.python.net/
14482 Potsdam: PGP key -  http://pgp.uni-mainz.de
work +49 173 24 18 776  mobile +49 173 24 18 776  fax n.a.
PGP 0x57F3BF04   9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
  whom do you want to sponsor today?   http://www.stackless.com/

--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Sybase module 0.40 released

2012-06-12 Thread Robert Boehne

 WHAT IS IT:
The Sybase module provides a Python interface to the Sybase relational
database system.  It supports all of the Python Database API, version
2.0 with extensions.

The module is available here:

http://downloads.sourceforge.net/python-sybase/python-sybase-0.40.tar.gz

The module home page is here:

http://python-sybase.sourceforge.net/

MAJOR CHANGES SINCE 0.39:

Modify the DateTimeAsPython output conversion to return None when NULL 
is output

support for Python without threads
Ignore additional non-error codes from Sybase (1918 and 11932)
Use outputmap in bulkcopy mode (thanks to patch by Cyrille Froehlich)
Raise exception when opening a cursor on a closed connection
Added unit tests
Added new exception DeadLockError when Sybase is in a deadlock situation
Add command properties CS_STICKY_BINDS and CS_HAVE_BINDS
Added support for inputmap in bulkcopy
reuse command and cursor when calling cursor.execute with same request
Use ct_setparam to define ct_cursor parameters types instead of ct_param
implicit conversion for CS_DATE_TYPE in CS_DATETIME_TYPE DataBuf
Adding ct_cmd_props wrapper
Increase DataBuf maxlength for params of a request when using 
CS_CHAR_TYPE params so that the buf can be reused


BUGS CORRECTED SINCE 0.39:

Corrected money type when using CS_MONEY4 (close bug 2615821)
Corrected thread locking in ct_cmd_props (thanks to patch by Cyrille 
Froehlich)
Corrected bug in type mapping in callproc (thanks to report by Skip 
Montanaro)

Correct passing None in a DataBuf (thanks to patch by Bram Kuijvenhoven)

The full ChangeLog is here:

https://python-sybase.svn.sourceforge.net/svnroot/python-sybase/tags/r0_40/ChangeLog

--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


[newbie] Equivalent to PHP?

2012-06-12 Thread Gilles
Hello

I'm an amateur programmer, and would like to know what the main
options are to build web applications in Python instead of PHP.

I notice that Python-based solutions are usually built as long-running
processes with their own web server (or can run in the back with eg.
Nginx and be reached through eg. FastCGI/WSGI ) while PHP is simply a
language to write scripts and requires a web server (short running
processes).

Since web scripts are usually very short anyway (user sends query,
server handles request, sends response, and closes the port) because
the user is waiting and browsers usually give up after 30 seconds
anyway... why did Python solutions go for long-running processes while
PHP was built from the start as short-running processes?

Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Alain Ketterlin
Gilles nos...@nospam.com writes:

 I notice that Python-based solutions are usually built as long-running
 processes with their own web server (or can run in the back with eg.
 Nginx and be reached through eg. FastCGI/WSGI ) while PHP is simply a
 language to write scripts and requires a web server (short running
 processes).

It's an artefact of the server infrastructure, there is no rule here.
Any solution used with one language could be used with the other.

 Since web scripts are usually very short anyway (user sends query,
 server handles request, sends response, and closes the port) because
 the user is waiting and browsers usually give up after 30 seconds
 anyway... why did Python solutions go for long-running processes while
 PHP was built from the start as short-running processes?

You misunderstand the problem here. It's not about the duration of the
actions, it's about the latency it takes to read/parse/execute the
script. HTTP is stateless anyway, so if the same interpreter handles
several requests, what you save by keeping the interpreter alive is the
load/parse phase. If you relaunch an interpreter for every HTTP request,
you pay the same price again and again for something which is not even
related to your scripts' execution.

-- Alain.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Chris Angelico
On Tue, Jun 12, 2012 at 7:39 PM, Gilles nos...@nospam.com wrote:
 Since web scripts are usually very short anyway (user sends query,
 server handles request, sends response, and closes the port) because
 the user is waiting and browsers usually give up after 30 seconds
 anyway... why did Python solutions go for long-running processes while
 PHP was built from the start as short-running processes?

Think of it as Apache + PHP versus Python. Apache keeps running, it's
only your PHP script that starts and stops. With a long-running
process, you keep everything all in together, which IMHO is simpler
and better.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Gilles
On Tue, 12 Jun 2012 12:12:55 +0200, Alain Ketterlin
al...@dpt-info.u-strasbg.fr wrote:
You misunderstand the problem here. It's not about the duration of the
actions, it's about the latency it takes to read/parse/execute the
script. HTTP is stateless anyway, so if the same interpreter handles
several requests, what you save by keeping the interpreter alive is the
load/parse phase. If you relaunch an interpreter for every HTTP request,
you pay the same price again and again for something which is not even
related to your scripts' execution.

Thanks for the input.

But I read that PHP-based heavy-duty web servers compile the scripts
once and keep them in a cache, so they don't have to be
read/parsed/executed with each new query.

In that case, what is the benefit of using a long-running process in
Python?

I enjoy writing scripts in Python much more than PHP, but with so many
sites written in PHP, I need to know what major benefits there are in
choosing Python (or Ruby, ie. not PHP).

Apparently, very few people use Python à la PHP, ie. Python code
embedded in web pages?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Octavian Rasnita
From: Chris Angelico ros...@gmail.com
Subject: Re: [newbie] Equivalent to PHP?


 On Tue, Jun 12, 2012 at 7:39 PM, Gilles nos...@nospam.com wrote:
 Since web scripts are usually very short anyway (user sends query,
 server handles request, sends response, and closes the port) because
 the user is waiting and browsers usually give up after 30 seconds
 anyway... why did Python solutions go for long-running processes while
 PHP was built from the start as short-running processes?


Perl, Ruby, Python and PHP also can do the same thing.

You can use a persistent program which is loaded/parsed/compiled once and kept 
into memory and it will just answer the requests, or you can create a program 
which is loaded/parsed/compiled on each request.

The first way is much better for performance reasons but it consumes much more 
memory and it is more complicated, because the programs can have memory leaks 
(they will consume more and more memory after a long period), while the second 
way is more simple to do, but the performance is not great.

Most PHP programs are done using the second way, because it is much simple to 
do and it is much simple to configure the environment for it, and most of the 
free web hosting sites that offer PHP support don't offer something better.
And... most of the sites don't need a very good performance, because they 
usually don't have millions visitors per day.

Also, most of the sites made in PHP use low level programs using only what the 
default PHP distribution installed on the server offers, so no web frameworks, 
or form managers, or templating systems or many other modules that can do a 
part of the work.
The PHP distribution has compiled C programs which run pretty fast, while 
loading/parsing/compiling a lot of other modules made in Ruby/Perl/Python/PHP 
would decrease the performance, so a persistent environment is usually required 
in case those modules are used. And usually Python and Perl and Ruby programs 
use a lot of modules because for these languages there are a lot of modules 
available that can do a lot of things for free, while for PHP there are much 
fewer, and even if there are, (because there are templating systems and web 
frameworks for PHP also), they are much seldomly used, because those who choose 
to use a broken language like PHP, usually choose it not only for its main 
advantage regarding the easiness of deployment, but choose it because it is 
much more simple and easy to learn, and they usually don't like to learn a lot 
of other modules.
Otherwise... if you want you can also create a web app using PHP and 
CodeIgniter web framework and run it with fastcgi...

Octavian

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread D'Arcy Cain

On 12-06-12 06:36 AM, Gilles wrote:

I enjoy writing scripts in Python much more than PHP, but with so many
sites written in PHP, I need to know what major benefits there are in
choosing Python (or Ruby, ie. not PHP).


I think that you just answered your own question in the first line of
that paragraph.  With computers running so fast and memory and disk
being so cheap, the only decision left for most applications is what
language do you prefer.  Python wins because it is so nice to work
with.  It's clean and you don't have to deal with the daily security
holes of PHP.


Apparently, very few people use Python à la PHP, ie. Python code
embedded in web pages?


I guess I am in the minority then.  I do plan to turn one of my larger
projects into a standalone web server some day but so far writing
simple Python CGI scripts has served me fine.  I even do some embedding
by using server side scripting.

--
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
IM: da...@vex.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Chris Angelico
On Tue, Jun 12, 2012 at 8:36 PM, Gilles nos...@nospam.com wrote:
 Thanks for the input.

 But I read that PHP-based heavy-duty web servers compile the scripts
 once and keep them in a cache, so they don't have to be
 read/parsed/executed with each new query.

 In that case, what is the benefit of using a long-running process in
 Python?

Apache's mod_php partially evens out the difference, but not
completely, and of course, it's perfectly possible to write a dispatch
loop in PHP, as Octavian said.

Python is a far better language than PHP, I would strongly recommend
making use of it if you can.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Matej Cepl

On 12/06/12 11:39, Gilles wrote:

I notice that Python-based solutions are usually built as long-running
processes with their own web server (or can run in the back with eg.
Nginx and be reached through eg. FastCGI/WSGI ) while PHP is simply a
language to write scripts and requires a web server (short running
processes).


I don't think it is a proper description of the situation (please, 
somebody correct my mistakes, I am not 100% sure about it myself). WSGI 
applications (which is basically all web applications in Python) could 
run in the hosted servers (using for example mod_wsgi for Apache), and I 
would expect that it is the situation with most production uses.


From the programmer's point of view WSGI application (read 
http://en.wikipedia.org/wiki/Wsgi) is just one script which takes HTTP 
request on input and generates HTTP Response on output, so it is 
actually quite simple. And actually quite similar to what JSGI, PSGI, 
and Rake do (I am not sure who was first whether WSGI or Rake).



anyway... why did Python solutions go for long-running processes while
PHP was built from the start as short-running processes?


It is all about caching ... I am not sure how it  is done exactly, but I 
would expect for example mod_wsgi to cache parsed Python script in 
memory as well.


Matěj
--
http://mail.python.org/mailman/listinfo/python-list


using identifiers before they are defined

2012-06-12 Thread Julio Sergio
I'm puzzled with the following example, which is intended to be a part of a 
module, say tst.py:

  a = something(5)

  def something(i):
  return i



When I try: 

- import tst

The interpreter cries out:

Traceback (most recent call last):
  File stdin, line 1, in module
  File tst.py, line 11, in module
a = something(5)
NameError: name 'something' is not defined

I know that changing the order of the definitions will work, however there are 
situations in which referring to an identifier before it is defined is 
necessary, e.g., in crossed recursion. 

So I modified my module:

  global something

  a = something(5)


  def something(i):
  return i


And this was the answer I got from the interpreter:

- import tst

Traceback (most recent call last):
  File stdin, line 1, in module
  File tst.py, line 12, in module
a = something(5)
NameError: global name 'something' is not defined


Do you have any comments?

Thanks,

--Sergio.




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Jose H. Martinez
You should define the function first and then call it.


 def something(i):
 return i

a = something(5)

If you want a reference to the function somewhere else you can do this:

global alias = something

print alias(i)



On Tue, Jun 12, 2012 at 1:53 PM, Julio Sergio julioser...@gmail.com wrote:

 I'm puzzled with the following example, which is intended to be a part of a
 module, say tst.py:

  a = something(5)

  def something(i):
  return i



 When I try:

 - import tst

 The interpreter cries out:

 Traceback (most recent call last):
  File stdin, line 1, in module
  File tst.py, line 11, in module
a = something(5)
 NameError: name 'something' is not defined

 I know that changing the order of the definitions will work, however there
 are
 situations in which referring to an identifier before it is defined is
 necessary, e.g., in crossed recursion.

 So I modified my module:

  global something

  a = something(5)


  def something(i):
  return i


 And this was the answer I got from the interpreter:

 - import tst

 Traceback (most recent call last):
  File stdin, line 1, in module
  File tst.py, line 12, in module
a = something(5)
 NameError: global name 'something' is not defined


 Do you have any comments?

 Thanks,

 --Sergio.




 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Emile van Sebille

On 6/12/2012 10:53 AM Julio Sergio said...
snip


So I modified my module:

   global something

   a = something(5)


   def something(i):
   return i


And this was the answer I got from the interpreter:

-  import tst

Traceback (most recent call last):
   File stdin, line 1, inmodule
   File tst.py, line 12, inmodule
 a = something(5)
NameError: global name 'something' is not defined


Do you have any comments?


python executes each line as it encounters it.  a=something(5) as you 
have it attempts to bind the label 'a' to the result of something(5) 
which has not yet been defined.  You seem to want it to compile 
everything first, then execute but it doesn't work that way.


Emile





--
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread MRAB

On 12/06/2012 18:53, Julio Sergio wrote:

I'm puzzled with the following example, which is intended to be a part of a
module, say tst.py:

   a = something(5)

   def something(i):
   return i



When I try:

-  import tst

The interpreter cries out:

Traceback (most recent call last):
   File stdin, line 1, inmodule
   File tst.py, line 11, inmodule
 a = something(5)
NameError: name 'something' is not defined

I know that changing the order of the definitions will work, however there are
situations in which referring to an identifier before it is defined is
necessary, e.g., in crossed recursion.

So I modified my module:

   global something

   a = something(5)


   def something(i):
   return i


And this was the answer I got from the interpreter:

-  import tst

Traceback (most recent call last):
   File stdin, line 1, inmodule
   File tst.py, line 12, inmodule
 a = something(5)
NameError: global name 'something' is not defined


Do you have any comments?

In Python, def is a statement, not a declaration. It binds the body of 
the function

to the name when the def statement is run.

A Python script is, basically, run from top to bottom, and both def
and class are actually statements, not declarations.

A function can refer to another function, even one that hasn't been
defined yet, provided that it has been defined by the time it is called.

For example, this:

def first():
second()

def second():
pass

first()

is OK because it defines function first, then function second, then
calls first. By the time first calls second, second has been
defined.
--
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Julio Sergio
Jose H. Martinez josehmartinezz at gmail.com writes:

 
 
 You should define the function first and then call it.
 
 
  def something(i):     return i
 
 
 a = something(5)
 
 
 If you want a reference to the function somewhere else you can do this:
 

I know that. That was what I meant by changing the order of the definitions 
will work in my original message.

And I insist in the issue, which is not trivial... In my message I mentioned 
crossed recursion, and I delve into it here:

Suppose I have to define two functions, aa, and, bb that are designed to call 
each other:

  def aa():
 ...
 ... a call of bb() somewhere in the body of aa
 ...

  def bb():
 ...
 ... a call of aa() somewhere in the body of bb
 ...


Whatever the order of definition of aa and bb the problem remains, one of the 
two identifiers is not known ...

Most of computer languages have mechanisms to deal with this issue. Is there 
any 
in Python or it is in disadvantage with respect to other languages like C++, 
Java, Perl, PHP, etc.?




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Jerry Hill
On Tue, Jun 12, 2012 at 2:33 PM, Julio Sergio julioser...@gmail.com wrote:
 Suppose I have to define two functions, aa, and, bb that are designed to call
 each other:

  def aa():
     ...
     ... a call of bb() somewhere in the body of aa
     ...

  def bb():
     ...
     ... a call of aa() somewhere in the body of bb
     ...


 Whatever the order of definition of aa and bb the problem remains, one of the
 two identifiers is not known ...

This works just fine in python, exactly as you've written it.  What's
the actual problem you're having?

-- 
Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Evan Driscoll

On 01/-10/-28163 01:59 PM, Julio Sergio wrote:

I know that changing the order of the definitions will work, however there are
situations in which referring to an identifier before it is defined is
necessary, e.g., in crossed recursion.


Mutual recursion isn't a problem: the following strange expression of 
factorial works fine:


def strange_helper(x):
return factorial(x)

def factorial(x):
if x==0:
return 1
else:
return x * strange_helper(x-1)

print factorial(5)


The reason is names are never looked up when the parser sees them, but 
rather only when execution reaches them. So the fact that 'factorial' 
hasn't been defined yet when the parser is dealing with 'strange_helper' 
is fine, because when 'strange_helper' is actually *called*, 'factorial' 
has been defined.


Here's another example to illustrate, in a different manner that doesn't 
use this undefined thing:


def foo():
print Inside the first version of foo

def call_foo():
foo()

call_foo()

def foo():
print Inside the second version of foo

call_foo()

This prints:
 Inside the first version of foo
 Inside the second version of foo


Evan
--
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Ethan Furman

Julio Sergio wrote:

Jose H. Martinez josehmartinezz at gmail.com writes:



You should define the function first and then call it.


 def something(i): return i


a = something(5)


If you want a reference to the function somewhere else you can do this:



I know that. That was what I meant by changing the order of the definitions 
will work in my original message.


And I insist in the issue, which is not trivial... In my message I mentioned 
crossed recursion, and I delve into it here:


Suppose I have to define two functions, aa, and, bb that are designed to call 
each other:


  def aa():
 ...
 ... a call of bb() somewhere in the body of aa
 ...

  def bb():
 ...
 ... a call of aa() somewhere in the body of bb
 ...


Whatever the order of definition of aa and bb the problem remains


No.  The reply from MRAB explains this.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Jose H. Martinez
Seems like what you need is

from othermodule import bb

def aa():
bb()



On Tue, Jun 12, 2012 at 2:51 PM, Ethan Furman et...@stoneleaf.us wrote:

 Julio Sergio wrote:

 Jose H. Martinez josehmartinezz at gmail.com writes:


 You should define the function first and then call it.


  def something(i): return i


 a = something(5)


 If you want a reference to the function somewhere else you can do this:


 I know that. That was what I meant by changing the order of the
 definitions will work in my original message.

 And I insist in the issue, which is not trivial... In my message I
 mentioned crossed recursion, and I delve into it here:

 Suppose I have to define two functions, aa, and, bb that are designed to
 call each other:

  def aa():
 ...
 ... a call of bb() somewhere in the body of aa
 ...

  def bb():
 ...
 ... a call of aa() somewhere in the body of bb
 ...


 Whatever the order of definition of aa and bb the problem remains


 No.  The reply from MRAB explains this.

 ~Ethan~
 --
 http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-12 Thread CM
On Jun 11, 6:55 pm, Dietmar Schwertberger n...@schwertberger.de
wrote:

 But then we're back to the initial point: As long as there's no GUI
 builder for Python, most people will stick to Excel / VBA / VB.

Then good thing there *are* GUI builder/IDEs for Python, one of which
was good enough for me to take me from essentially zero modern
programming experience to a sizable ( ~15k LOC) application.
-- 
http://mail.python.org/mailman/listinfo/python-list


Using pdb with greenlet?

2012-06-12 Thread Salman Malik

Hi,

I am sort of a newbie to Python ( have just started to use pdb). 

My problem is that I am debugging an application that uses greenlets and when I 
encounter something in code that spawns the coroutines or wait for an event, I 
lose control over the application (I mean that after that point I can no longer 
do 'n' or 's' on the code). Can anyone of you tell me how to tame greenlet with 
pdb, so that I can see step-by-step as to what event does a coroutine sees and 
how does it respond to it.

Any help would be highly appreciated.

Thanks,
Salman  
  -- 
http://mail.python.org/mailman/listinfo/python-list


Re: which one do you prefer? python with C# or java?

2012-06-12 Thread Tim Johnson
* Tomasz Rola rto...@ceti.pl [120611 11:18]:
 On Sat, 9 Jun 2012, Yesterday Paid wrote:
 
  I'm planning to learn one more language with my python.
  Someone recommended to do Lisp or Clojure, but I don't think it's a
  good idea(do you?)
  So, I consider C# with ironpython or Java with Jython.
  It's a hard choice...I like Visual studio(because my first lang is VB6
  so I'm familiar with that)
  but maybe java would be more useful out of windows.
  
  what do you think?
 
 If you don't know C yet, I second recommendation to learn it. It is a very 
 70-tish and 80-tish language, but it is still very relevant if you want to 
 call yourself a programmer (rather than a hobbyist, with all credits due 
 to clever genius hobbyists out there). There are things I would rather do 
 in C than in any other language (like, writing a Python interpreter or 
 Linux kernel - wait, what you say they have been written already?). Also, 
 it gives one a way to handtune the code quite a lot (at expense of time, 
 but this is sometimes acceptable), to the point where next choice is 
 assembly (and results not necessarily better)...
 
 Later on, since C and C++ share quite a bit, you can gradually include C++ 
 elements into your code, thus writing in a kinda bettered C (compiled 
 with C++ compiler), using constructs like const to make your programs 
 more correct. And you will learn to not use new for variables, which is 
 good thing. However, some C++ constructs include performance penalty, so 
 it is good to not better it too much.
  I concur, I worked in C and C++ for 12 years. I added C++ later in
  my programming life. I don't recommend C++ for single programmers.
  - that is to say - 1 coder for 1 codebase. One can do good enough
  OOP in ansi C believe it or not, I learned to.

  It is interesting to note that most of linux is written in C,
  rather than C++ and is not python as well?
 
 - Common Lisp - nice industrial standard (depends on one's preferred 
 definition of nice, of course, as well as industrial and standard)
  I took a hard look at Common Lisp at one time. I got the
  impression that the Common Lisp is not to Lisp what Ansi C is to
  C. 
  
  IOWS, there does remain incompatibilities between different
  Common Lisp implementations.

  Whereas Ansi C is pretty strict as code portability (or was so
  when I was working in it)
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Julio Sergio
Ethan Furman ethan at stoneleaf.us writes:

 
 
 No.  The reply from MRAB explains this.
 
 ~Ethan~
 

Thanks, you're right!
I was confusing statemens with declarations.





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Ethan Furman

Julio Sergio wrote:

Ethan Furman ethan at stoneleaf.us writes:



No.  The reply from MRAB explains this.

~Ethan~



Thanks, you're right!
I was confusing statemens with declarations.


Yeah, it took me a while to get that straight as well.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


RE: Create directories and modify files with Python

2012-06-12 Thread Prasad, Ramit
  Thanks for the directions. By the way, can you see my post in Google Groups?
 I'm not able to, and I don't know why.
 
 They may have copied the Gmail idea that you never need to see anything
 anything you posted yourself.

I can see all my posts in a Gmail thread/conversation but if there are no 
replies then I would have to look in All Mail. But for normal email
conversations it does have my posts in there. 

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


multiprocessing: excepthook not getting called

2012-06-12 Thread Dave Cook
Why doesn't my excepthook get called in the child process?

import sys
import multiprocessing as mp

def target():
name = mp.current_process().name
def exceptHook(*args):
print 'exceptHook:', name, args
sys.excepthook = exceptHook
raise ValueError

if __name__=='__main__':
p = mp.Process(target=target)
p.start()
p.join()
# try it here in main
target()

Thanks,
Dave Cook
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-12 Thread rdsteph
On Jun 10, 12:37 pm, Dietmar Schwertberger maill...@schwertberger.de
wrote:
 Personally, I prefer Python with console, wx or Qt for local
 applications and Python/HTTP/HTML/Javascript for multi-user
 database applications.

 Regards,

 Dietmar

+1

I think this is the wave of the furture for deploying simple programs
to many users. It is almost 100% cross platform (can be used on
desktop, smartphone, tablet, windows, linux, mac etc) and is very easy
to do, even for casual non-programmers who do a little programming
(such as many engineers).

I think efforts to make a better, and more definitive, GUI builder
for Python should focus on makigng an easy to use IDE for creating
these kinds of Python-HTMl-Javascript front ends for applications.

*That* would really help Python's popularity to take off and expode.

Ron Stephens

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where to set default data - where received, or where used

2012-06-12 Thread Chris Angelico
On Tue, Jun 12, 2012 at 4:37 AM, Dennis Carachiola dnca...@gmail.com wrote:
 Here's my question.  I could do this by creating the dictionary with
 the default values, then read the file into it.  Or I could use a
 'get' with default values at the location in the program where those
 values are used.

Both options have their recommendations. As others have said, setting
your defaults in one place has advantages of coherence; but setting
them at point of read keeps all the code using it together. You can
have an entirely dumb I/O submodule that feeds smart other-modules.
Take your pick based on what you're doing.

What I would definitely suggest, though, is making a structured config
file. (You could cheat by importing it as a module and making it
simply Python code.) Provide a template config file with lots of
explanatory comments, and (crucially) every config entry given,
commented out, and set to its default.

# Configures the default and maximum flurble percentages
# Flurblization increases from the default until either the maximum is
# reached, or max_sort_memory is exceeded, whichever comes first.
#flurble_default = 10
#flurble_max = 30

Having all your defaults in one place makes it easier to produce this
sort of file; in fact, you could have your documentation there as
well. It does become a little more maintenance work, though. It's
possible to have a hybrid, where you run a preprocessor over your code
that analyzes it, collects all config entries, and builds your config
file parser... but that may be beyond the scope of your project.

Anything you can imagine can be done in code. It's just a question of
how much work. :)

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Gilles
On Tue, 12 Jun 2012 07:42:56 -0400, D'Arcy Cain da...@druid.net
wrote:
I guess I am in the minority then.  I do plan to turn one of my larger
projects into a standalone web server some day but so far writing
simple Python CGI scripts has served me fine.  I even do some embedding
by using server side scripting.

Out of curiosity, why did you choose to write CGI scripts or embedded
server-side scripting while standalone web servers are usually
presented as _the_ solution for Python (Django, Pylons, etc.)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Gilles
On Tue, 12 Jun 2012 22:01:10 +1000, Chris Angelico ros...@gmail.com
wrote:
Apache's mod_php partially evens out the difference, but not
completely, and of course, it's perfectly possible to write a dispatch
loop in PHP, as Octavian said.

It looks like mod_php and equivalents for web servers other than
Apache are anecdotal compared to solutions based on standalone web
servers. Is that the case? Why is that?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Gilles
On Tue, 12 Jun 2012 20:18:21 +1000, Chris Angelico ros...@gmail.com
wrote:
Think of it as Apache + PHP versus Python. Apache keeps running, it's
only your PHP script that starts and stops. With a long-running
process, you keep everything all in together, which IMHO is simpler
and better.

Why is a long-running process better?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Gilles
On Tue, 12 Jun 2012 14:28:22 +0300, Octavian Rasnita
orasn...@gmail.com wrote:
Otherwise... if you want you can also create a web app using PHP and 
CodeIgniter web framework and run it with fastcgi...

Thanks for the infos.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Chris Angelico
On Wed, Jun 13, 2012 at 9:59 AM, Gilles nos...@nospam.com wrote:
 On Tue, 12 Jun 2012 20:18:21 +1000, Chris Angelico ros...@gmail.com
 wrote:
Think of it as Apache + PHP versus Python. Apache keeps running, it's
only your PHP script that starts and stops. With a long-running
process, you keep everything all in together, which IMHO is simpler
and better.

 Why is a long-running process better?

It's far simpler to manage, it retains running state, and is easily
enough encapsulated. It's the non-magic way of doing things. Also, it
plays very nicely with the MUD style of process, which is something I
do a lot with Pike. Plus, if you manage it right, you have a guarantee
that you can never be in a half-updated state - that's somewhat tricky
when you have inter-dependencies in PHP code and the file system
itself manages things. What happens if a request comes in while you're
half-way through uploading new code to the server? By default, you
could use half old code and half new code. Keeping everything in
memory makes it easier to prevent that.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using identifiers before they are defined

2012-06-12 Thread Ben Finney
Julio Sergio julioser...@gmail.com writes:

 Suppose I have to define two functions, aa, and, bb that are designed
 to call each other:

   def aa():
  ...
  ... a call of bb() somewhere in the body of aa
  ...

   def bb():
  ...
  ... a call of aa() somewhere in the body of bb
  ...


 Whatever the order of definition of aa and bb the problem remains, one
 of the two identifiers is not known ...

What problem? Can you show actual code that we can execute, which
demonstrates the problem?

-- 
 \ “I turned to speak to God/About the world's despair; But to |
  `\   make bad matters worse/I found God wasn't there.” —Robert Frost |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: which one do you prefer? python with C# or java?

2012-06-12 Thread rusi
On Jun 12, 3:19 am, Matej Cepl mc...@redhat.com wrote:
 On 11/06/12 06:20, rusi wrote:

  Hi Matěj! If this question is politically incorrect please forgive me.
  Do you speak only one (natural) language -- English?
  And if this set is plural is your power of expression identical in
  each language?

 I have written about that later ... no, I am a native Czech, but I have
 passive Russian, and active English. But there is a difference ... I can
 read and enjoy beautiful texts in Russian or English (couple of months
 read Eugen Onegin in Russian and that's just a beauty! or C.S.Lewis ...
 oh my!) but I will never be able to write professionally in these
 languages. I can write (as evidenced by this message) somehow in
 English, but I cannot imagine that I would be ever professional art
 writer or (even worse) poet. I could imagine (if spent couple of
 thousands of days working on it) that I would be a Czech professional
 writer though.

 Matěj

If we were back-translate that standard to the programming field it
would go something like:
You cannot call yourself a programmer until you create something of
significance.
So Linus writing the linux kernel or Knuth writing Tex or Stallman
writing emacs, GvR writing Python are programmers; the rest not.

Believe me your English is good enough and better than some mono-
lingual ranters on this list who cannot write 2 straight correct
sentences yet take it upon themselves to correct others' English.

[Sorry for pontificating. I am nearing 50 and have wasted too much of
my life in the misguided pursuit of perfectionism.  I would wish for
younger folks to not err samely]

To come back to the OP's question, Alan Perlis said:
A language that doesn't affect the way you think about programming, is
not worth knowing.
More gems here: http://en.wikiquote.org/wiki/Alan_Perlis

If you use this to choose what language to learn, you cant go wrong.
Most programmers who know dozens of programming languages really know
only one imperative language iced with different syntax.  Which
reminds me of another quip by Alan Perlis:

Syntactic sugar causes cancer of the semicolon.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Equivalent to PHP?

2012-06-12 Thread D'Arcy Cain

On 12-06-12 07:57 PM, Gilles wrote:

On Tue, 12 Jun 2012 07:42:56 -0400, D'Arcy Cainda...@druid.net
wrote:

I guess I am in the minority then.  I do plan to turn one of my larger
projects into a standalone web server some day but so far writing
simple Python CGI scripts has served me fine.  I even do some embedding
by using server side scripting.


Out of curiosity, why did you choose to write CGI scripts or embedded
server-side scripting while standalone web servers are usually
presented as _the_ solution for Python (Django, Pylons, etc.)?


History and laziness I suppose.  My biggest project started out as Tcl
and was switched to Python around 1.5.  Besides, the boys and girls
at Apache have done a great job.  May as well build on that.  Even
if I go with a standalone server I will probably put Apache in front
of it for images, style sheets and other static content.  I also want
to look into writing Apache modules in Python some day.

--
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
IM: da...@vex.net
--
http://mail.python.org/mailman/listinfo/python-list


[issue15050] Python 3.2.3 fail to make

2012-06-12 Thread Grey_Shao

New submission from Grey_Shao shoj...@163.com:

When I try to compile the Python 3.2.3, I failed to make
After I ungzip and untar the source package of the Python 3.2.3, Then run the 
following commands:
1. ./configure
2. make
When step 2, the errors below happens:
gcc -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes   
 -I. -IInclude -I./Include-DPy_BUILD_CORE -o Mod
ules/python.o ./Modules/python.c
In file included from Include/Python.h:50,
 from ./Modules/python.c:3:
Include/pyport.h:260:13: #error This platform's pyconfig.h needs to define 
PY_FORMAT_LONG_LONG
*** Error code 1
make: Fatal error: Command failed for target `Modules/python.o'

Can you help me

My system OS is:
uname -a
SunOS HPCT01 5.9 Generic_117171-02 sun4u sparc SUNW,Sun-Fire-280R

I attached install history file

Thanks

--
components: None
files: Python3.2.3_Install_History_20120612.txt
messages: 162662
nosy: shojnhv
priority: normal
severity: normal
status: open
title: Python 3.2.3 fail to make
type: compile error
versions: Python 3.2
Added file: 
http://bugs.python.org/file25941/Python3.2.3_Install_History_20120612.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15050
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15050] Python 3.2.3 fail to make

2012-06-12 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Can you please attach the config.log file also?

Also, can you please report what the value of PRId64 in /usr/include/inttypes.h 
is?

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15050
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14119] Ability to adjust queue size in Executors

2012-06-12 Thread Brian Quinlan

Brian Quinlan br...@sweetapp.com added the comment:

I've had people request that they be able control the order of processed work 
submissions. So a more general way to solve your problem might be to make the 
two executors take an optional Queue argument in their constructors.

You'd have to explain in detail in the document how the queues are used.

What do you think?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14119
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10133] multiprocessing: conn_recv_string() broken error handling

2012-06-12 Thread Hallvard B Furuseth

Hallvard B Furuseth h.b.furus...@usit.uio.no added the comment:

Richard Oudkerk rep...@bugs.python.org wrote:
 Thanks for the patch, I have applied it.  (I don't think there was a
 problem with the promotion rules because res was a never converted to
 UINT32.)

 True now that res is a Py_ssize_t.  It was int when I wrote the patch.

 Hallvard

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10133
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15033] Different exit status when using -m

2012-06-12 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Technically, it returns -1 (which later gets coerced to an unsigned value).

However, there's no good reason for the inconsistency - the offending line 
(663) in main.c should be changed to be:

sts = (RunModule(module, 1) != 0);

It is currently just:

sts = RunModule(module, 1);

An additional test in test_cmd_line_script is also needed to ensure that both 
variants give a returncode of 1 in the future.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15033
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] .pyo file can't be imported unless -O is given

2012-06-12 Thread Michael Herrmann

Michael Herrmann mherrmann...@gmail.com added the comment:

Hi,

I need to use a third-party library that ships as a mixture of .pyc and .pyo 
files. I found it a little surprising and inconvenient that I have to set the 
-O flag just to read .pyo files. I don't mind whether .pyc or .pyo files are 
being created during compilation, I just want to be able to read from both .pyc 
and .pyo files without having to use the -O flag. Can somebody fix this? I 
unfortunately have absolutely no clue how.

Thanks!

--
components: +Interpreter Core -Documentation
nosy: +mherrmann.at

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13598] string.Formatter doesn't support empty curly braces {}

2012-06-12 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

One brief comment on the wording of the error message: the inconsistent naming 
is actually copied from the str.format code.

 {foo} {} {bar}.format(2, foo='fooval', bar='barval')
'fooval 2 barval'
 {foo} {0} {} {bar}.format(2, foo='fooval', bar='barval')
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: cannot switch from manual field specification to automatic field 
numbering

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13598
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13578] Add subprocess.iter_output() convenience function

2012-06-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
versions: +Python 3.4 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13578
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-06-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
versions: +Python 3.4 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14803
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13783] Clean up PEP 380 C API additions

2012-06-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee: docs@python - ncoghlan
priority: normal - release blocker

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13783
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13062] Introspection generator and function closure state

2012-06-12 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee:  - ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13062
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15038] Optimize python Locks on Windows

2012-06-12 Thread Paul Moore

Paul Moore p.f.mo...@gmail.com added the comment:

Applies and builds cleanly on Win7 32-bit. The speed difference is visible here 
too:

PS D:\Data\cpython\PCbuild .\python.exe -m timeit -s from _thread import 
allocate_lock; l=allocate_lock() l.acquire();l.release()
100 loops, best of 3: 0.608 usec per loop
PS D:\Data\cpython\PCbuild hg revert --all
reverting pythoncore.vcxproj
reverting pythoncore.vcxproj.filters
reverting ..\Python\ceval_gil.h
forgetting ..\Python\condvar.h
reverting ..\Python\thread_nt.h
PS D:\Data\cpython\PCbuild .\python.exe -m timeit -s from _thread import 
allocate_lock; l=allocate_lock() l.acquire();l.release()
100 loops, best of 3: 1.66 usec per loop

The test suite had a few Python crashes, but a build of trunk did too. No time 
to diagnose these now, but I didn't see any failures that weren't also in the 
unpatched build.

Basically, test suite results look the same as for the unpatched build.

--
nosy: +pmoore

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15038
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] .pyo file can't be imported unless -O is given

2012-06-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Michael, I don’t think your proposed change would be considered favorably: 
importing .pyc or .pyo is well defined for CPython and the -O switch is really 
required for .pyo.  However you may be able to import them anyway without any 
change to Python if you write a custom importer (more info in PEP 302 and the 
import docs) which reuses the low-level imp module to find and load .pyo files.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
title: .pyo file can't be imported unless -O is given - Document that 
importing .pyo files needs python -O

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13062] Introspection generator and function closure state

2012-06-12 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

I didn't get around to updating my patch with Nick's comments yet.

Nick, the v3 patch I have attached still applies.  I am happy to update it per 
your comments (promptly this time) or you can take it over.  Whichever.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13062
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Michael Herrmann

Michael Herrmann mherrmann...@gmail.com added the comment:

Hi Eric,

thank you for your quick reply. I'm not the first one who encounters this 
problem and in my opinion it is simply counter-intuitive that you cannot read a 
mixture of .pyo and .pyc files. That is why I think that my proposed change is 
valuable. In the meantime, I will follow your suggestion and try to use the 
imp-module to load the .pyo-files myself. Thank you!

Best regards,
Michael

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Actually it's a lot easier than that, although it is very much a hack: just 
rename the .pyo files to .pyc, and python without -O will happily import them.  
Since the optimization happens when the bytecode is written, this does what you 
want.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Eric O. LEBIGOT

Eric O. LEBIGOT eric.lebi...@normalesup.org added the comment:

Hi Michael,

Thank you for your message.

You are mentioning the suggestion of the other Eric (Araujo). My suggestion 
was to rename your .pyo files as .pyc files; it is hackish (according to a 
previous post from Eric Araujo), but might save you some trouble, on the short 
term, as .pyc do not need -O.

Best wishes,

EOL

On Jun 12, 2012, at 21:25, Michael Herrmann wrote:

 
 Michael Herrmann mherrmann...@gmail.com added the comment:
 
 Hi Eric,
 
 thank you for your quick reply. I'm not the first one who encounters this 
 problem and in my opinion it is simply counter-intuitive that you cannot read 
 a mixture of .pyo and .pyc files. That is why I think that my proposed change 
 is valuable. In the meantime, I will follow your suggestion and try to use 
 the imp-module to load the .pyo-files myself. Thank you!
 
 Best regards,
 Michael
 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue12982
 ___

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15003] make PyNamespace_New() public

2012-06-12 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

 Is this documented in whatsnew?
 I'm not sure what has been (none of my patches have done so).
Okay; if a committer does not add a note we can open a doc bug to not forget 
that.

 Also, I remember a discussion about making it public or not, but
 don’t recall a decision.
 Amaury brought it up in msg162127.  His point was that the type is public in 
 Python, so why not the C API?
Actually I was talking about making it public at all, i.e. in Python too.

 The use cases are different for the different types.  
 StructSequence/namedtuple provides fixed data structures
 for structured records.  A dict is essentially the opposite: an un-fixed data 
 structure for dynamic namespaces,
 making no firm promises as to what the future holds.
Right; I just don’t see why the clock info needs to be a dict instead of a 
structseq or simplenamespace, but maybe it’s explained in the PEP and I missed 
it.  Also it seems to me that the only advantage of simplenamespace over 
structseqs is that it has no order and can’t be unpacked; I don’t find that a 
very strong argument (I do see its value, e.g. “major, minor, *etc = 
sys.version_info” makes sense but we really don’t want to assign order to 
sys.implementation elements), but I guess this ship has sailed when the 
implementation was approved.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15003
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Michael Herrmann

Michael Herrmann mherrmann...@gmail.com added the comment:

Dear Eric OL,

I see - I had read your e-mail but because of the similar names I thought the 
message here was yours too, and thus only replied once. I apologize!

I can of course find a workaround such as renaming .pyo to .pyc. However, I 
would like to avoid having to modify the distribution of the third party 
library I am using in any way. The reason is that if a new version of this 
third party library is released and I have to upgrade to this new version, I 
will again have to manually do all the changes I had to do for the old version 
for the new version, and of course some changes won't work any more and there 
will be problems...

I'm finding it tedious to use the imp-module to read in the .pyo-files by hand 
and might just fall back to your suggestion. Thank you for it. Nevertheless, I 
am still hoping that this may be resolved in a future release.

Best,
Michael

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13475] Add '-p'/'--path0' command line option to override sys.path[0] initialisation

2012-06-12 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

any chance on this for 3.3?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13475
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15049] line buffering isn't always

2012-06-12 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Without looking at the code, it seems that

http://docs.python.org/release/3.1.5/library/io.html?highlight=io#io.TextIOWrapper

gives the answer

If line_buffering is True, flush() is implied when a call to write contains a 
newline character.

So, line buffering may have a meaning only for writing. I don't think there 
is a reasonable way to implement it for reading.

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15049
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14599] Windows test_import failure thanks to ImportError.path

2012-06-12 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

It's not a problem, Stefan. I just happened to have already added the 
importlib.invalidate_caches() call to test_reprlib so I know that isn't the 
issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14599
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15038] Optimize python Locks on Windows

2012-06-12 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

I've tested Ubuntu 64 myself using a Virtualbox, confirming that the pythread 
functionality is untouched.
(funny how those vi keystrokes seem to be embedded into your amygdala after 
decades of disuse)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15038
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13857] Add textwrap.indent() as counterpart to textwrap.dedent()

2012-06-12 Thread Chris Jerdonek

Chris Jerdonek chris.jerdo...@gmail.com added the comment:

Great. Looks good!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13857
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15049] line buffering isn't always

2012-06-12 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

That makes sense.  I'll add a mention of this to the 'open' docs that discuss 
the buffering parameter.

--
assignee:  - r.david.murray
components: +Documentation

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15049
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15051] Can't compile Python 3.3a4 on OS X

2012-06-12 Thread Virgil Dupras

New submission from Virgil Dupras hs...@hardcoded.net:

I try to compile Pyhton 3.3a4 on a OS X 10.7 with XCode 4.3.3 and it fails. I 
tried a few configuration options, but even with a basic ./configure  make, 
I get this:

./python.exe -SE -m sysconfig --generate-posix-vars
Could not find platform dependent libraries exec_prefix
Consider setting $PYTHONHOME to prefix[:exec_prefix]
python.exe(11771) malloc: *** mmap(size=7310873954244194304) failed (error 
code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Could not import runpy module
make: *** [Lib/_sysconfigdata.py] Segmentation fault: 11

I tried setting PYTHONHOME to `pwd`, to no avail. Am I doing something wrong? 
The same thing happens with v3.3a3. If I go back to v3.2.3, it compiles fine on 
the same system. I also tried on the repo's tip, same error.

--
components: Build
messages: 162683
nosy: vdupras
priority: normal
severity: normal
status: open
title: Can't compile Python 3.3a4 on OS X
type: compile error
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15051
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15051] Can't compile Python 3.3a4 on OS X

2012-06-12 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

There is a bug in the version of GCC that's shipped with Xcode.

Try building using clang:

configure ... CC=clang CXX=clang++

--
nosy: +ronaldoussoren

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15051
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15051] Can't compile Python 3.3a4 on OS X

2012-06-12 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

This is a duplicate of #13241

We (and in particular Ned Deily are working on a change to the build process 
that would fix this, and will make it possible to build extensions on OSX 
regardless of which Xcode variant you use and which variant was used to build 
the python binaries.

--
resolution:  - duplicate
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15051
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15048] Manually Installed Python Includes System Wide Paths

2012-06-12 Thread James Kyle

James Kyle b...@jameskyle.org added the comment:

I think Ned does have some good points regarding the minimal impact a reversion 
would have.

The most poignant point is that /Library/ on OS X is not a user controlled 
directory whereas ~/.local is. If ~/.local exists and has packages installed, 
it's because the user has made a conscious choice. If they regret that choice, 
they can remove ~/.local. 

Every package installed in ~/.local is the result of direct action by the user 
impacted. The same cannot be said for /Library.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15052] Outdated comments in build_ssl.py

2012-06-12 Thread Jeremy Kloth

New submission from Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:

The comment regarding a Perl installation not being required is no longer true 
with regards to OpenSSL 1.0+ (at least 1.0.0j and 1.0.1c).  A Perl script(s) is 
used to generate source files within the generated Makefiles.

I would suggest to remove the outdated and misleading comment.

--
components: Build
messages: 162687
nosy: jkloth
priority: normal
severity: normal
status: open
title: Outdated comments in build_ssl.py
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15052
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Michael, you should ask the closed source library distributor to distribute all 
files as .pyc so you have access to docstrings while programming and to avoid 
the problem with reading them. He could also distribute an all-.pyo version. A 
mixture seems accidental.

Is the import restriction currently intended? If a change *is* made, should it 
be regarded as an enhancement rather than a bug fix? I asked both question on 
pydev for more input.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15044] _dbm not building on Fedora 17

2012-06-12 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

The gdbm provided with Fedora 17 provides /usr/include/ndbm.h.

This makes setup.py think that it should try link with -lndbm when it actually 
requires -lgdbm_compat.

A workaround is to specify --with-dbmliborder=gdbm to force gdbm to be used.

I'll try and make a patch for this.

--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15044
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14102] argparse: add ability to create a man page

2012-06-12 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14102
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1644818] Allow built-in packages and submodules as well as top-level modules

2012-06-12 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1644818
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12982] Document that importing .pyo files needs python -O

2012-06-12 Thread Ronan Lamy

Changes by Ronan Lamy ronan.l...@gmail.com:


--
nosy: +Ronan.Lamy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12982
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12510] IDLE: calltips mishandle raw strings and other examples

2012-06-12 Thread Roger Serwy

Roger Serwy roger.se...@gmail.com added the comment:

The _self_pat RE needs to be changed to just remove the first argument. 
Presently, another bug exists with the current implementation:

 class A:
def t(self, self1, self2):
pass
 a = A()
 a.t(

gives (1,2) as the calltip, instead of (self1, self2) for 3.x. Python 2.7 
gives the correct calltip.

The attached patch modifies _self_pat to remove only the first argument, 
modifies the classmethod test, and adds a test for notself, as Terry 
requested in msg162511.

--
Added file: http://bugs.python.org/file25942/issue12510_self_pat.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12510
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15044] _dbm not building on Fedora 17

2012-06-12 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Attached is a patch which fixes the issue on Fedora 17.

If this doesn't break other OSes I'll commit it for 2.7, 3.2 and 3.3.

--
keywords: +patch
versions: +Python 2.7, Python 3.2
Added file: http://bugs.python.org/file25943/gdbm.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15044
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15021] xmlrpc server hangs

2012-06-12 Thread Abhishek Singh

Abhishek Singh abhishekrsi...@gmail.com added the comment:

I found my problem.

I was also using pipes to implement my show output (between python and C). The 
pipe was getting full, and xmlrpc server was locking up because of that.

The gdb traceback was confusing though (will re-open if I see this again, and 
if it is indeed a different issue).

--
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15021
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15053] imp.lock_held() Changed in Python 3.3 mention accidentally one function up

2012-06-12 Thread Brett Cannon

New submission from Brett Cannon br...@python.org:

If you look at http://docs.python.org/dev/py3k/library/imp.html#imp.get_tag you 
will notice it has the Changed in Python 3.3 notice for imp.lock_held() in 
it, the function *below* imp.get_tag().

--
assignee: docs@python
components: Documentation
messages: 162694
nosy: brett.cannon, docs@python, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: imp.lock_held() Changed in Python 3.3 mention accidentally one 
function up
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15053
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14963] Use an iterative implementation for contextlib.ExitStack.__exit__

2012-06-12 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4442] document immutable type subclassing via __new__

2012-06-12 Thread Chris Withers

Chris Withers ch...@simplistix.co.uk added the comment:

It's the fact that for immutable types, initialization is done in __new__ 
instead of __init__ that isn't documented anywhere. 

This should be Python-level rather than C-level documentation.

The example I gave in #msg76473 is confusing without docs anywhere that explain 
why this is.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4442
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15053] imp.lock_held() Changed in Python 3.3 mention accidentally one function up

2012-06-12 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Well, if the versionchanged were for get_tag(), it would be indented 
appropriately. But it is actually for the The following functions help 
interact with the import system’s internal locking mechanism paragraph.

Feel free to improve :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15053
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4442] document immutable type subclassing via __new__

2012-06-12 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Actually, it is documented: 
http://docs.python.org/dev/reference/datamodel.html#basic-customization

__new__() is intended mainly to allow subclasses of immutable types (like int, 
str, or tuple) to customize instance creation.

It could certainly be better documented, but where?  The tutorial?

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4442
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15050] Python 3.2.3 fail to make

2012-06-12 Thread Grey_Shao

Grey_Shao shoj...@163.com added the comment:

Thanks for your kindly help
I attach the config.log in the attachment data.7z
The value of the PRId64 is:
#ifdef  _LP64
#define PRId64  ld
#else   /* _ILP32 */
#if __STDC__ - 0 == 0  !defined(_NO_LONGLONG)
#define PRId64  lld
#endif
#endif
I also attach the related inttypes.h files in the attachment data.7z

Thanks for your help

--
Added file: http://bugs.python.org/file25945/Data.7z

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15050
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14377] Modify serializer for xml.etree.ElementTree to allow forcing the use of long tag closing

2012-06-12 Thread Ariel Poliak

Ariel Poliak apol...@gmail.com added the comment:

Made a new patch.
This one contains changes for xml.etree.ElementTree for cpython, jython, and 
stackless.
It also contains changes to Modules/_elementtree.c for cpython and stackless.

The changes within this patch do not change the signature for the _serialize_* 
methods, so it can be used with any third-party library that extends 
ElementTree.

--
Added file: 
http://bugs.python.org/file25946/ElementTree-force_long_tags-v3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14377
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14119] Ability to adjust queue size in Executors

2012-06-12 Thread Nam Nguyen

Nam Nguyen bits...@gmail.com added the comment:

+1

That was actually what I did. I replaced the internal queue with another one 
whose limit was properly set.

If you are busy to write one, let me find some time to create another patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14119
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com