PyDev 2.4.0 Released

2012-02-02 Thread Fabio Zadrozny
Hi All,

PyDev 2.4.0 has been released

Details on PyDev: http://pydev.org
Details on its development: http://pydev.blogspot.com

Release Highlights:
---

PyDev is now faster and uses less memory (many performance and memory
improvements were done)!

The contents of the homepage are now migrated to a wiki at
https://wiki.appcelerator.org/display/tis/Python+Development ...
(later most of the homepage will become a mirror of the wiki).

Others

* Organize imports: Fixed issue where other statements in a commit
line got lost (now such a line is ignored).
* PyDev Package Explorer: closed project no longer remains with old icons.
* Fixed deadlock when setting project as Django.
* Fixed issue in code formatting *args on lambda statement.
* TODO tags: only searched now in a string/comment partition.
* Fixed issue when saving empty document (bad location on code-formatter).
* Fixed issue removing comments from document.
* Applied patch for internal Jython 2.2.1 to fix list.sort
(http://bugs.jython.org/issue1835099).
* Fixed resolution of template variable prev_class_or_method and
next_class_or_method.


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython
and IronPython development -- making Eclipse a first class Python IDE
-- It comes with many goodies such as code completion, syntax
highlighting, syntax analysis, refactor, debug and many others.


Cheers,

-- 
Fabio Zadrozny
--
Software Developer

Appcelerator
http://appcelerator.com/

Aptana
http://aptana.com/

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Registry entries set up by the Windows installer

2012-02-02 Thread Paul Moore
On 2 February 2012 00:28, Mark Hammond skippy.hamm...@gmail.com wrote:
 For setting PYTHONPATH it uses both - HKEY_CURRENT_USER is added before
 HKEY_LOCAL_MACHINE.  I can't recall which one distutils generated
 (bdist_wininst) installers will use - it may even offer the choice.
[...]
 Yep, I think that is correct.

Thanks for the information.

 Is there anything else I've missed?

 I'm also not sure which one the pylauncher project will prefer, which may
 become relevant should that get rolled into Python itself.

Good point - I can look in the source for that, if I need to.

 The reason I ask, is that I'm starting to work with virtualenv, and I
 want to see what would be involved in (re-)setting the registry
 entries to match the currently active virtualenv. virtualenvwrapper-
 powershell seems to only deal with HKCU (which is a big plus on
 Windows 7, as it avoids endless elevation requests :-)) but that
 doesn't work completely cleanly with my all-users install. (Note: I'm
 not entirely sure that changing global settings like this to patch a
 per-console virtualenv is a good idea, but I'd like to know how hard
 it is before dismissing it...)


 Out of interest, what is the reason forcing you to look at that -
 bdist_wininst installers?  FWIW, my encounters with virtualenv haven't
 forced me to hack the registry - I just install bdist_wininst packages into
 the parent Python which isn't ideal but works fine for me.  This was a
 year or so ago, so the world might have changed since then.

It's bdist_msi.rather than bdist_wininst.

I want to avoid putting packages into the main Python - at least,
from my limited experiments the virtual environment doesn't see them
(I may be wrong about this, I only did a very limited test and I want
to do some more detailed testing before I decide).

For bdist_wininst packages, I can install using easy_install - this
will unpack and install bdist_wininst installers. (I don't actually
like easy_install that much, but if it works...). But easy_install
won't deal with MSI installers, and you can't force them to install in
an unregistered Python. The only way I can think of is to do an admin
install to unpack them, and put the various bits in place manually...

The other reason for changing the registry is the .py file
associations. But as I said, I'm not yet convinced that this is a good
idea in any case...

Thanks for the help,
Paul.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread John O'Hagan
On Thu, 2 Feb 2012 01:34:48 -0500
Devin Jeanpierre jeanpierr...@gmail.com wrote:

 On Wed, Feb 1, 2012 at 10:18 PM, John O'Hagan
 resea...@johnohagan.com wrote:
  On Fri, 13 Jan 2012 10:40:47 -0800
  Ethan Furman et...@stoneleaf.us wrote:
 
  Steven D'Aprano wrote:
   Normally this is harmless, but there is one interesting little
   glitch you can get:
  
   t = ('a', [23])
   t[1] += [42]
   Traceback (most recent call last):
     File stdin, line 1, in module
   TypeError: 'tuple' object does not support item assignment
   t
   ('a', [23, 42])
 
  IMHO, this is worthy of bug-hood: shouldn't we be able to conclude
  from the TypeError that the assignment failed?
 
 It did fail. The mutation did not.

You're right, in fact, for me the surprise is that t[1] += is interpreted as 
an assignment at all, given that for lists (and other mutable objects which use 
+=) it is a mutation. Although as Steven says elsewhere, it actually is an 
assignment, but one which ends up reassigning to the same object. 
 
But it shouldn't be both. I can't think of another example of (what appears to 
be but is not) a single operation failing with an exception, but still doing 
exactly what you intended.

 
 I can't think of any way out of this misleadingness, although if you
 can that would be pretty awesome.

In the case above, the failure of the assignment is of no consequence. I think 
it would make more sense if applying += to a tuple element were treated (by 
the interpreter I suppose) only on the merits of the element, and not as an 
assignment to the tuple. 

John



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


Signup and get starts to earn.....

2012-02-02 Thread Devi Priya
http://123maza.com/46/dos754/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread Steven D'Aprano
On Thu, 02 Feb 2012 19:11:53 +1100, John O'Hagan wrote:

 You're right, in fact, for me the surprise is that t[1] += is
 interpreted as an assignment at all, given that for lists (and other
 mutable objects which use +=) it is a mutation. Although as Steven
 says elsewhere, it actually is an assignment, but one which ends up
 reassigning to the same object.
  
 But it shouldn't be both.

Do you expect that x += 1 should succeed? After all, increment and 
decrement numbers is practically THE use-case for the augmented 
assignment operators.

How can you expect x += 1 to succeed without an assignment? Numbers in 
Python are immutable, and they have to stay immutable. It would cause 
chaos and much gnashing of teeth if you did this:

x = 2
y = 7 - 5
x += 1
print y * 100
= prints 300

So if you want x += 1 to succeed, += must do an assignment.

Perhaps you are thinking that Python could determine ahead of time 
whether x[1] += y involved a list or a tuple, and not perform the finally 
assignment if x was a tuple. Well, maybe, but such an approach (if 
possible!) is fraught with danger and mysterious errors even harder to 
debug than the current situation. And besides, what should Python do 
about non-built-in types? There is no way in general to predict whether 
x[1] = something will succeed except to actually try it.

 I can't think of another example of (what
 appears to be but is not) a single operation failing with an exception,
 but still doing exactly what you intended.

Neither can I, but that doesn't mean that the current situation is not 
the least-worst alternative.


 I can't think of any way out of this misleadingness, although if you
 can that would be pretty awesome.
 
 In the case above, the failure of the assignment is of no consequence. I
 think it would make more sense if applying += to a tuple element were
 treated (by the interpreter I suppose) only on the merits of the
 element, and not as an assignment to the tuple.

How should the interpreter deal with other objects which happen to raise 
TypeError? By always ignoring it?

x = [1, None, 3]
x[1] += 2  # apparently succeeds

Or perhaps by hard-coding tuples and only ignoring errors for tuples? So 
now you disguise one error but not others?



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


Re: Disable use of pyc file with no matching py file

2012-02-02 Thread Terry Reedy

On 2/2/2012 1:42 AM, Devin Jeanpierre wrote:

On Wed, Feb 1, 2012 at 2:53 PM, Terry Reedytjre...@udel.edu  wrote:

And it bothers me that you imput such ignorance to me. You made what I think
was a bad analogy and I made a better one of the same type, though still
imperfect. I acknowledged that the transition will take years.


Ah. It is a common attitude among those that make these sorts of
comments about Python 3, and I hadn't read anything in what you said
that made me think that you were considering more than the superficial
costs of moving.


I thought '95% in 10 years' would be a hint that I know upgrading is not 
trivial for every one ;-).



I am sorry that I did not give you the benefit of the doubt.


Apology accepted.

--
Terry Jan Reedy

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


Re: changing sys.path

2012-02-02 Thread Andrea Crotti

On 02/02/2012 12:51 AM, Steven D'Aprano wrote:

On Wed, 01 Feb 2012 17:47:22 +, Andrea Crotti wrote:


Yes they are exactly the same, because in that file I just write exactly
the same list,
but when modifying it at run-time it doesn't work, while if at the
application start
there is this file everything works correctly...

That's what really puzzles me.. What could that be then?


Are you using IDLE or WingIDE or some other IDE which may not be
honouring sys.path? If so, that's a BAD bug in the IDE.
Are you changing the working directory manually, by calling os.chdir? If
so, that could be interfering with the import somehow. It shouldn't, but
you never know...

Are you adding absolute paths or relative paths?


No, no and absolute paths..



You say that you get an ImportError, but that covers a lot of things
going wrong. Here's a story. Could it be correct? I can't tell because
you haven't posted the traceback.

When you set site-packages/my_paths.pth you get a sys path that looks
like ['a', 'b', 'fe', 'fi', 'fo', 'fum']. You then call import spam
which locates b/spam.py and everything works.

But when you call sys.path.extend(['a', 'b']) you get a path that looks
like ['fe', 'fi', 'fo', 'fum', 'a', 'b']. Calling import spam locates
some left over junk file, fi/spam.py or fi/spam.pyc, which doesn't
import, and you get an ImportError.



And no the problem is not that I already checked inspecting at run-time..
This is the traceback and it might be related to the fact that it runs 
from the

.exe wrapper generated by setuptools:

Traceback (most recent call last):
  File c:\python25\scripts\dev_main-script.py, line 8, in module
load_entry_point('psi.devsonly==0.1', 'console_scripts', 'dev_main')()
  File h:\git_projs\psi\psi.devsonly\psi\devsonly\bin\dev_main.py, 
line 152, in main

Develer(ns).full_run()
  File h:\git_projs\psi\psi.devsonly\psi\devsonly\bin\dev_main.py, 
line 86, in full_run

run(project_name, test_only=self.ns.test_only)
  File h:\git_projs\psi\psi.devsonly\psi\devsonly\environment.py, 
line 277, in run

from psi.devsonly.run import Runner
  File h:\git_projs\psi\psi.devsonly\psi\devsonly\run.py, line 7, in 
module

from psi.workbench.api import Workbench, set_new_dev_main
ImportError: No module named workbench.api


Another thing which might matter is that I'm launching Envisage 
applications, which
heavily rely on the use of entry points, so I guess that if something is 
not in the path
the entry point is not loaded automatically (but it can be forced I 
guess somehow).


I solved in another way now, since I also need to keep a dev_main.pth in 
site-packages

to make Eclipse happy, just respawning the same process on ImportError works
already perfectly..
--
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread Thomas Rachel

Am 13.01.2012 13:30 schrieb Chris Angelico:


It seems there's a distinct difference between a+=b (in-place
addition/concatenation) and a=a+b (always rebinding),


There is indeed.

a = a + b is a = a.__add__(b), while

a += b is a = a.__iadd__(b).

__add__() is supposed to leave the original object intact and return a 
new one, while __iadd__() is free to modify (preference, to be done if 
possible) or return a new one.


A immutable object can only return a new one, and its __iadd__() 
behaviour is the same as __add__().


A mutable object, however, is free to and supposed to modify itself and 
then return self.



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


Re: xhtml encoding question

2012-02-02 Thread Peter Otten
Ulrich Eckhardt wrote:

 Am 01.02.2012 10:32, schrieb Peter Otten:
 It doesn't matter for the OP (see Stefan Behnel's post), but If you want
 to replace characters in a unicode string the best way is probably the
 translate() method:

 print u\xa9\u2122
 ©™
 u\xa9\u2122.translate({0xa9: ucopy;, 0x2122: utrade;})
 u'copy;trade;'

 
 Yes, this is both more expressive and at the same time probably even
 more efficient.
 
 
 Question though:
 
   u'abc'.translate({u'a': u'A'})
 u'abc'
 
 I would call this a chance to improve Python. According to the
 documentation, using a string is invalid, but it neither raises an
 exception nor does it do the obvious and accept single-character strings
 as keys.
 
 
 Thoughts?

How could this raise an exception? You'd either need a typed dictionary (int 
-- unicode) or translate() would have to verify that all keys are indeed 
integers. The former would go against the grain of Python, the latter would 
make the method less flexible as the set of keys currently need not be 
predefined:

 class A(object):
... def __getitem__(self, key):
... return unichr(key).upper()
...
 ualpha.translate(A())
u'ALPHA'

Using unicode instead of integer keys would be nice but breaks backwards 
compatibility, using both could double the number of dictionary lookups.

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


Re: copy on write

2012-02-02 Thread Hrvoje Niksic
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:

 Perhaps you are thinking that Python could determine ahead of time
 whether x[1] += y involved a list or a tuple, and not perform the
 finally assignment if x was a tuple. Well, maybe, but such an approach
 (if possible!) is fraught with danger and mysterious errors even
 harder to debug than the current situation. And besides, what should
 Python do about non-built-in types? There is no way in general to
 predict whether x[1] = something will succeed except to actually try
 it.

An alternative approach is to simply not perform the final assignment if
the in-place method is available on the contained object.  No prediction
is needed to do it, because the contained object has to be examined
anyway.  No prediction is needed, just don't.  Currently,
lhs[ind] += rhs is implemented like this:

item = lhs[ind]
if hasattr(item, '__iadd__'):
lhs.__setitem__(ind, item.__iadd__(rhs))
else:
lhs.__setitem__(ind, item + rhs)
# (Note item assignment in both if branches.)

It could, however, be implemented like this:

item = lhs[ind]
if hasattr(item, '__iadd__'):
item += rhs  # no assignment, item supports in-place change
else:
lhs.__setitem__(ind, lhs[ind] + rhs)

This would raise the exact same exception in the tuple case, but without
executing the in-place assignment.  On the other hand, some_list[ind] += 1
would continue working exactly the same as it does now.

In the same vein, in-place methods should not have a return value
(i.e. they should return None), as per Python convention that functions
called for side effect don't return values.

The alternative behavior is unfortunately not backward-compatible (it
ignores the return value of augmented methods), so I'm not seriously
proposing it, but I believe it would have been a better implementation
of augmented assignments than the current one.  The present interface
doesn't just bite those who try to use augmented assignment on tuples
holding mutable objects, but also those who do the same with read-only
properties, which is even more reasonable.  For example, obj.list_attr
being a list, one would expect that obj.list_attr += [1, 2, 3] does the
same thing as obj.list_attr.extend([1, 2, 3]).  And it almost does,
except it also follows up with an assignment after the list has already
been changed, and the assignment to a read-only property raises an
exception.  Refusing to modify the list would have been fine, modifying
it without raising an exception (as described above) would have been
better, but modifying it and *then* raising an exception is a surprise
that takes some getting used to.
-- 
http://mail.python.org/mailman/listinfo/python-list


CTRL-Z on windows for 2.7 and 3.2

2012-02-02 Thread Blockheads Oi Oi
Not that I'll lose any sleep over it, but section 2.1 of the tutorial 
for both versions doesn't reflect the minor difference between the 
behavior shown below.  Which is correct, the docs or what actually happens?


c:\Users\Mark\Sudokuc:\Python27\python.exe
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit 
(Intel)] on win32

Type help, copyright, credits or license for more information.
 # you don't need to hit ENTER

c:\Users\Mark\Sudokuc:\Python32\python.exe
Python 3.2.2 (default, Sep  4 2011, 09:51:08) [MSC v.1500 32 bit 
(Intel)] on win32

Type help, copyright, credits or license for more information.
 ^Z # you do need to hit ENTER


c:\Users\Mark\Sudoku
--
Cheers.

Mark Lawrence.

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


Re: xhtml encoding question

2012-02-02 Thread Ulrich Eckhardt

Am 02.02.2012 12:02, schrieb Peter Otten:

Ulrich Eckhardt wrote:


u'abc'.translate({u'a': u'A'})
u'abc'

I would call this a chance to improve Python. According to the
documentation, using a string [as key] is invalid, but it neither raises
an exception nor does it do the obvious and accept single-character
strings as keys.


Thoughts?


How could this raise an exception? You'd either need a typed dictionary (int
--  unicode) or translate() would have to verify that all keys are indeed
integers.


The latter is exactly what I would have done, i.e. scan the dictionary 
for invalid values, in the spirit of not letting errors pass unnoticed.




The former would go against the grain of Python, the latter would
make the method less flexible as the set of keys currently need not be
predefined:


class A(object):

... def __getitem__(self, key):
... return unichr(key).upper()
...

ualpha.translate(A())

u'ALPHA'


Working with __getitem__ is a point. I'm not sure if it is reasonable to 
expect this to work though. I'm -0 on that. I could also imagine a 
completely separate path for iterable and non-iterable mappings.




Using unicode instead of integer keys would be nice but breaks backwards
compatibility, using both could double the number of dictionary lookups.


Dictionary lookups are constant time and well-optimized, so I'd actually 
go for allowing both and paying that price. I could even imagine 
preprocessing the supplied dictionary while checking for invalid values. 
The result could be a structure that makes use of the fact that Unicode 
codepoints are  22 bits and that makes the way from the elements of the 
source sequence to the according map entry as short as possible (I'm not 
sure if using codepoints or single-character strings is faster). 
However, those are early optimizations of which I'm not sure if they are 
worth it.


Anyway, thanks for your thoughts, they are always appreciated!

Uli

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


Re: copy on write

2012-02-02 Thread 88888 Dihedral
在 2012年1月14日星期六UTC+8上午6时48分29秒,Evan Driscoll写道:
 On 01/13/2012 03:20 PM, Neil Cerutti wrote:
  They perform the same action, but their semantics are different.
  operator+ will always return a new object, thanks to its
  signature, and operator+= shall never do so. That's the main
  difference I was getting at.
 
 I was talking about the combination of + and =, since the discussion is 
 about 'a = a + b' vs 'a += b', not 'a + b' vs 'a += b' (where the 
 differences are obvious).
 
 And I stand by my statement. In 'a = a + b', operator+ obviously returns 
 a new object, but operator= should then go and assign the result to and 
 return a reference to 'a', just like how 'a += b' will return a 
 reference to 'a'.


The operation a+b means add(a,b) and returns a result instance, furthermore a 
and b can't be modified.

The expression a = a+b are two operations not one. But in C or C++ the  problem 
is mixing operations and expressions in a free style allowed.
 
The operation a+=b means a modified by b and b can't be changed.
Note that no new instance is necessary in a+=b.
 
 

 If you're working in C++ and overload your operators so that 'a += b' 
 and 'a = a + b' have different observable behaviors (besides perhaps 
 time), then either your implementation is buggy or your design is very 
 bad-mannered.
 
 Evan

Do you mean the result instances after 'a+=b' and 'a=a+b' or 
the actions of behaviors of instances involved  in performing 'a+=b' and 
'a=a+b'?
-- 
http://mail.python.org/mailman/listinfo/python-list


newbie socket help

2012-02-02 Thread loial
I am trying to write a python script to read data from a printer port
using python sockets, but it seems I am locking up the port.

Is there a way to ensure that I do not block the port to other
applications?

My knowledge of python sockets is minimal, so any help would be
appreciated.
-- 
http://mail.python.org/mailman/listinfo/python-list


SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Michal Hantl
Hello,
 I've been looking for something similar to CoffeeScript, but for python.

Does anyone know of such project? 


So far I haven't found any attempt to do this, so I took few regular 
expressions and hacked this:
https://plus.google.com/116702779841286800811/posts/56sBdwiZ4fT

Any advice on what parses to use for the CoffeeScript-like syntaxe? I would 
like to use parser written in Python so I don't introduce dependencies.

Any advice from Python gurus / language experimentators?

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


Re: changing sys.path

2012-02-02 Thread jmfauth
On 2 fév, 11:03, Andrea Crotti andrea.crott...@gmail.com wrote:
 On 02/02/2012 12:51 AM, Steven D'Aprano wrote:



  On Wed, 01 Feb 2012 17:47:22 +, Andrea Crotti wrote:

  Yes they are exactly the same, because in that file I just write exactly
  the same list,
  but when modifying it at run-time it doesn't work, while if at the
  application start
  there is this file everything works correctly...

  That's what really puzzles me.. What could that be then?

  Are you using IDLE or WingIDE or some other IDE which may not be
  honouring sys.path? If so, that's a BAD bug in the IDE.
  Are you changing the working directory manually, by calling os.chdir? If
  so, that could be interfering with the import somehow. It shouldn't, but
  you never know...

  Are you adding absolute paths or relative paths?

 No, no and absolute paths..



  You say that you get an ImportError, but that covers a lot of things
  going wrong. Here's a story. Could it be correct? I can't tell because
  you haven't posted the traceback.

  When you set site-packages/my_paths.pth you get a sys path that looks
  like ['a', 'b', 'fe', 'fi', 'fo', 'fum']. You then call import spam
  which locates b/spam.py and everything works.

  But when you call sys.path.extend(['a', 'b']) you get a path that looks
  like ['fe', 'fi', 'fo', 'fum', 'a', 'b']. Calling import spam locates
  some left over junk file, fi/spam.py or fi/spam.pyc, which doesn't
  import, and you get an ImportError.

 And no the problem is not that I already checked inspecting at run-time..
 This is the traceback and it might be related to the fact that it runs
 from the
 .exe wrapper generated by setuptools:

 Traceback (most recent call last):
    File c:\python25\scripts\dev_main-script.py, line 8, in module
      load_entry_point('psi.devsonly==0.1', 'console_scripts', 'dev_main')()
    File h:\git_projs\psi\psi.devsonly\psi\devsonly\bin\dev_main.py,
 line 152, in main
      Develer(ns).full_run()
    File h:\git_projs\psi\psi.devsonly\psi\devsonly\bin\dev_main.py,
 line 86, in full_run
      run(project_name, test_only=self.ns.test_only)
    File h:\git_projs\psi\psi.devsonly\psi\devsonly\environment.py,
 line 277, in run
      from psi.devsonly.run import Runner
    File h:\git_projs\psi\psi.devsonly\psi\devsonly\run.py, line 7, in
 module
      from psi.workbench.api import Workbench, set_new_dev_main
 ImportError: No module named workbench.api

 Another thing which might matter is that I'm launching Envisage
 applications, which
 heavily rely on the use of entry points, so I guess that if something is
 not in the path
 the entry point is not loaded automatically (but it can be forced I
 guess somehow).

 I solved in another way now, since I also need to keep a dev_main.pth in
 site-packages
 to make Eclipse happy, just respawning the same process on ImportError works
 already perfectly..



There is something strange here. I can not figure
out how correct code will fail with the sys.path.
It seems to me, the lib you are using is somehow not
able to recognize its own structure (his own sys.path).

Idea. Are you sure you are modifying the sys.path at
the right place, understand at the right time
when Python processes?

I'm using this sys.path tweaking at run time very often;
eg to test or to run different versions of the same lib
residing in different dirs, and this, in *any* dir and
independently of *any* .pth file.

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


Re: copy on write

2012-02-02 Thread John O'Hagan
On 02 Feb 2012 09:16:40 GMT
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

 On Thu, 02 Feb 2012 19:11:53 +1100, John O'Hagan wrote:
 
  You're right, in fact, for me the surprise is that t[1] += is
  interpreted as an assignment at all, given that for lists (and other
  mutable objects which use +=) it is a mutation. Although as Steven
  says elsewhere, it actually is an assignment, but one which ends up
  reassigning to the same object.
   
  But it shouldn't be both.
 
 Do you expect that x += 1 should succeed? After all, increment and 
 decrement numbers is practically THE use-case for the augmented 
 assignment operators.
 
 How can you expect x += 1 to succeed without an assignment? 

I don't; obviously, for immutable objects assignment is the only possibility.

[...]
 
 Perhaps you are thinking that Python could determine ahead of time 
 whether x[1] += y involved a list or a tuple, and not perform the
 finally assignment if x was a tuple. Well, maybe, but such an
 approach (if possible!) is fraught with danger and mysterious errors
 even harder to debug than the current situation. And besides, what
 should Python do about non-built-in types? There is no way in general
 to predict whether x[1] = something will succeed except to actually
 try it.

It's not so much about the type of x but that of x[1]. Wouldn't it be possible 
to omit the assignment simply if the object referred to by x[1] uses += 
without creating a new object? That way, some_tuple[i] += y will succeed if 
some_tuple[i] is a list but not with, say, an int. That seems reasonable to me.

[...]

  
  In the case above, the failure of the assignment is of no
  consequence. I think it would make more sense if applying += to a
  tuple element were treated (by the interpreter I suppose) only on
  the merits of the element, and not as an assignment to the tuple.
 
 How should the interpreter deal with other objects which happen to
 raise TypeError? By always ignoring it?
 
 x = [1, None, 3]
 x[1] += 2  # apparently succeeds
 
 Or perhaps by hard-coding tuples and only ignoring errors for tuples?
 So now you disguise one error but not others?

I'm not suggesting either of those. None can't be modified in place. But for 
objects which can, wouldn't omitting the final assignment prevent the TypeError 
in the first place?

John

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


EXAMPLES OF PROPHET’S MERCY UPON NON MUSLIMS !!!!!!!!!!!!!!!

2012-02-02 Thread BV
EXAMPLES OF PROPHET’S MERCY UPON NON MUSLIMS

Ex. No. (1)

It was narrated that ‘Aisha, May Allah be pleased with her, said to
the Prophet, Peace be upon him: Have you ever come across a day
harder than the day ofUhod (one of the battles with the polytheists,
in which Muslims were defeated failing to comply with the Prophet's
instructions)? He replied: I have suffered from your people a lot.
The hardest I suffered was on the day of Akaba (a place name). I
brought out my message to Abd Yaleil bin Abd Kalal. He did not respond
positively to what I called him for. I left there with a grief-
stricken face. I did not wake up from that feeling, until I was near
Karn-Ath-Tha-aleb (a place name). I raised my head, where I found a
cloud casting its shadow over me. Upon looking, I saw Jibril (the
angel) into it. He called upon me: Allah (the Almighty) has heard the
saying of your people, and what kind of reply they gave to you. Allah
has sent the angel of the mountains for you ready to do with them
whatever you ask. The angel of the mountains called, and saluted me
saying: Oh Muhammad, what I do will be as you request. If you want, I
close the two mountains on them?  The Prophet, Peace be upon him,
replied: Instead of that, I am hoping that Allah (the Al mighty) will
create from their offspring people who worship Allah alone, without
ascribing partners unto Him narrated by Al Bukhari.

Ex. No. (2):

It was narrated that Ibn-Omar (the son of Omar), May Allah be pleased
with both of them, said that after one of the battles of the Prophet
PBUH, a woman was found killed. In response, the Prophet PBUH
prohibited the killing of women and children. Narrated by Al Bukhari.

Ex. No. (3):

Anas-bin-Malek, May Allah be pleased with him, said:
A Jewish youth who served the Prophet, Peace be upon him, became ill,
and the Prophet paid him a visit. The Prophet, peace be upon him, sat
near the youth's head, and he spoke to him saying: Embrace Islam.
The youth averted his eyes towards his father, who was also beside
him. The father told his son: ObeyAbal-Kassem (one of the common
names of the Prophet PBUH). The youth embraced Islam (before dying),
and the Prophet, peace be upon him, went out saying: Thanks to Allah
(the Almighty) Who rescued him from hellfire. narrated by Al Bukhari.

Ex. No. (4):

Abdullah Ibn-Amr, May Allah be pleased with both, reported that the
Prophet, peace be upon him, said:
He who kills a promisor (a non-Muslim living among Muslims where he
is promised to have protection, and he promises not to help enemies
against Muslims, hence, he is called 'a promisor'), will not smell the
fragrance of paradise, though its fragrance is recognizable from a
distance of forty years. narrated by Al Bukhari.

Ex. No. (5):

Boraida-bin-Al-Hosaib reported that when the Prophet, peace be upon
him, delegated a prince to lead an army or a small army, he advised
him, and Muslims with him, to be devoted to Allah, and to act to the
common good. Then, he said: Your battle should be in the name of
Allah, and for His sake. Fight disbelievers. Fight, but don't
exaggerate, don't cheat, don't mutilate, don't kill a new-born child.
If you meet your enemies of polytheists call them for one of three
options. Whatever they take, you must accept, and stop fighting them.
Call them to Islam. If they take it, accept, and stop fighting them.
Then call them to transfer from their home to the home of immigrants
(Al Madina, or Hijra house, where all Muslims, at the start of Islam
gathered). Tell them if they do so, they will have the same rights and
duties of the immigrants. If, however, their choice was not to
transfer from home, their status will be the same as the Muslim
Bedouins (away in the desert), by the command of Allah not having the
right for spoils or almsgiving unless they join holy war (Jihad)
beside other Muslims. If they refused (Islam) ask them to pay the
tribute (tax taken from non-Muslims for protection). If they gave a
positive reply, accept that, and stop fighting them. If they refused,
seek the help of Allah, and fight them. If you lay a siege around a
fortress, and they ask to have the warranty of Allah and the warranty
of his Messenger, do not give them the warranty of Allah and the
warranty of his Messenger. But give them your warranty and the
warranty of your companions. Observing your warranty and the warranty
of your companions will be easier than observing the warranty of Allah
and the warranty of his Messenger.  If you lay a siege around a
fortress, and its people ask to be brought down to thejudgement of
Allah, don't bring them down to the judgement of Allah. But, bring
them down to your own judgement, since; you never know whether
yourjudgement will be the same as the right judgement of Allah about
them or not. narrated by Muslim.


Ex. No. (6):

Abu Huraira, May Allah be pleased with him, reported that the Prophet,
Peace be upon him, delegated some horsemen to a place called  Najd .
The horsemen captured a man from the 

Re: Startup Chile Company Looking For Founding Developer/CTO

2012-02-02 Thread Chris Withers

On 01/02/2012 18:38, Jennifer Turliuk wrote:

My name is Jennifer Turliuk. I'm currently in Santiago, Chile for the
next 6 months as part of the Startup Chile program. I think you may be
able to help me out. We are looking to bring on a developer ASAP (see
description below).


Please don't spam the list with job adverts, please use the job board 
instead:


http://www.python.org/community/jobs/howto/

cheers,

Chris

--
Simplistix - Content Management, Batch Processing  Python Consulting
- http://www.simplistix.co.uk
--
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread MRAB

On 02/02/2012 10:53, Hrvoje Niksic wrote:

Steven D'Apranosteve+comp.lang.pyt...@pearwood.info  writes:


 Perhaps you are thinking that Python could determine ahead of time
 whether x[1] += y involved a list or a tuple, and not perform the
 finally assignment if x was a tuple. Well, maybe, but such an approach
 (if possible!) is fraught with danger and mysterious errors even
 harder to debug than the current situation. And besides, what should
 Python do about non-built-in types? There is no way in general to
 predict whether x[1] = something will succeed except to actually try
 it.


An alternative approach is to simply not perform the final assignment if
the in-place method is available on the contained object.  No prediction
is needed to do it, because the contained object has to be examined
anyway.  No prediction is needed, just don't.  Currently,
lhs[ind] += rhs is implemented like this:

item = lhs[ind]
if hasattr(item, '__iadd__'):
 lhs.__setitem__(ind, item.__iadd__(rhs))
else:
 lhs.__setitem__(ind, item + rhs)
# (Note item assignment in both if branches.)

It could, however, be implemented like this:

item = lhs[ind]
if hasattr(item, '__iadd__'):
 item += rhs  # no assignment, item supports in-place change
else:
 lhs.__setitem__(ind, lhs[ind] + rhs)

This would raise the exact same exception in the tuple case, but without
executing the in-place assignment.  On the other hand, some_list[ind] += 1
would continue working exactly the same as it does now.

In the same vein, in-place methods should not have a return value
(i.e. they should return None), as per Python convention that functions
called for side effect don't return values.

The alternative behavior is unfortunately not backward-compatible (it
ignores the return value of augmented methods), so I'm not seriously
proposing it, but I believe it would have been a better implementation
of augmented assignments than the current one.


[snip]
Could it not perform the assignment if the reference returned by
__iadd__ is the same as the current reference?

For example:

t[0] += x

would do:

r = t[0].__iadd__(x)
if t[0] is not r:
t[0] = r

Should failed assignment be raising TypeError? Is it really a type
error?
--
http://mail.python.org/mailman/listinfo/python-list


Windows: How do I copy a custom build of Python into a directory structure matching an MSI install?

2012-02-02 Thread Paul Moore
I've got a build of Python (3.3) on my Windows PC. Everything is
built, I believe (core, all modules, HTML help, etc). I want to
install it on my PC (because tools like virtualenv expect a standard
install layout, and the checkout basically isn't).

I tried using Tools/msi/msi.py to build an installer, but it's making
lots of assumptions and it's just becoming a pain (it's started asking
me for certificates, and I need cabarc.exe). So I'm giving up on that
approach, and just want to move the files into the right places.

I can probably just copy stuff around till it works. I might even be
able to decipher msi.py and work out how the installer lays things
out. But I'm lazy, and I'm hoping that someone already knows and can
tell me, or point me to some documentation that I've missed. In
return, I'm willing to share the script I write to do the copying :-)

Can anyone help?
Thanks,
Paul.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Paul Moore
On Feb 2, 2:09 pm, Michal Hantl michal.ha...@gmail.com wrote:
  I've been looking for something similar to CoffeeScript, but for python.

 Does anyone know of such project?

Isn't CoffeeScript just a compiler to convert a cleaner syntax into
Javascript? If so, why would you need such a thing for Python, where
the syntax is already clean and simple? :-)

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


Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Devin Jeanpierre
On Thu, Feb 2, 2012 at 11:30 AM, Paul  Moore p.f.mo...@gmail.com wrote:
 Isn't CoffeeScript just a compiler to convert a cleaner syntax into
 Javascript? If so, why would you need such a thing for Python, where
 the syntax is already clean and simple? :-)

Coffeescript is a more functional syntax. On that note, Python isn't
as functional as it could be.

e.g. the Python Coffeescript could add pattern matching or TCO or something.

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


Re: copy on write

2012-02-02 Thread Devin Jeanpierre
On Thu, Feb 2, 2012 at 11:28 AM, MRAB pyt...@mrabarnett.plus.com wrote:
 Should failed assignment be raising TypeError? Is it really a type
 error?

A failed setitem should be a TypeError as much as a failed getitem
should. Should 1[0] be a TypeError?

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


Re: copy on write

2012-02-02 Thread Terry Reedy

On 2/2/2012 9:17 AM, John O'Hagan wrote:


It's not so much about the type of x but that of x[1]. Wouldn't it be
possible to omit the assignment simply if the object referred to by
x[1] uses += without creating a new object? That way, some_tuple[i]
+= y will succeed if some_tuple[i] is a list but not with, say, an
int. That seems reasonable to me.


There was considerable discussion of the exact semantics of augmented 
operations when they were introduced. I do not remember if that 
particular idea was suggested (and rejected) or not. You could try to 
look at the PEP, if there is one, or the dicussion ( probably on pydev 
list).


--
Terry Jan Reedy

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


Python book reviews

2012-02-02 Thread Blockheads Oi Oi
There are several at www.accu.org and select (strangely enough :) book 
reviews for anyone who may be interested.


--
Cheers.

Mark Lawrence.

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


Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Amirouche Boubekki
They are solution to write Python code that translates to javascript see
this thread
http://mail.python.org/pipermail/python-list/2011-November/1283110.html

2012/2/2 Michal Hantl michal.ha...@gmail.com

 Hello,
  I've been looking for something similar to CoffeeScript, but for python.

 Does anyone know of such project?


 So far I haven't found any attempt to do this, so I took few regular
 expressions and hacked this:
 https://plus.google.com/116702779841286800811/posts/56sBdwiZ4fT

 Any advice on what parses to use for the CoffeeScript-like syntaxe? I
 would like to use parser written in Python so I don't introduce
 dependencies.

 Any advice from Python gurus / language experimentators?

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

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


distribute and reference static content in a python package

2012-02-02 Thread Vince Forgetta
Hi,

I have developed a python program that contains multiple python modules
and static content in the form of fonts (pil,pbm and tff files),  html,
images, css and javascript.

I want to share the program with others as a python package. I have
followed the instructions at 

http://guide.python-distribute.org/creation.html

I have created an identical structure (apart from directory naming) as
specified in the link, with the exception of a static directory within
the module directory (towelstuff in the example). Within this directory
are sub-directories named css, html, images, fonts and js.

TowelStuff/
bin/
run.py
CHANGES.txt
docs/
LICENSE.txt
MANIFEST.in
README.txt
setup.py
towelstuff/
__init__.py
module1.py
module2.py
static/
images/someimage.png
css/
html/
js/
fonts/


When the user install the program using python setup.py install, the
modules (in towelstuff) are copied to the common python library path
(e.g. /usr/lib/python2.7/site-packages/), but the static content is not
(understandably).

What is common method to distribute static content, and how to I make
reference to it in my python program?

For programs in TowelStuff/bin (i.e. run.py), I currently make reference
to the static content like so:

sys.path[0] + ../towelstuff/static/images/someimage.png

I am sure there is a more pythonic way of doing this ...

Thanks in advance for the help.

Vince

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


Re: distribute and reference static content in a python package

2012-02-02 Thread Vince Forgetta
I assume this is an appropriate solution to my problem:

http://docs.python.org/distutils/setupscript.html#installing-additional-files



On Thu, 2012-02-02 at 13:42 -0500, Vince Forgetta wrote:
 Hi,
 
 I have developed a python program that contains multiple python modules
 and static content in the form of fonts (pil,pbm and tff files),  html,
 images, css and javascript.
 
 I want to share the program with others as a python package. I have
 followed the instructions at 
 
 http://guide.python-distribute.org/creation.html
 
 I have created an identical structure (apart from directory naming) as
 specified in the link, with the exception of a static directory within
 the module directory (towelstuff in the example). Within this directory
 are sub-directories named css, html, images, fonts and js.
 
 TowelStuff/
 bin/
 run.py
 CHANGES.txt
 docs/
 LICENSE.txt
 MANIFEST.in
 README.txt
 setup.py
 towelstuff/
 __init__.py
 module1.py
 module2.py
 static/
 images/someimage.png
 css/
 html/
 js/
 fonts/
 
 
 When the user install the program using python setup.py install, the
 modules (in towelstuff) are copied to the common python library path
 (e.g. /usr/lib/python2.7/site-packages/), but the static content is not
 (understandably).
 
 What is common method to distribute static content, and how to I make
 reference to it in my python program?
 
 For programs in TowelStuff/bin (i.e. run.py), I currently make reference
 to the static content like so:
 
 sys.path[0] + ../towelstuff/static/images/someimage.png
 
 I am sure there is a more pythonic way of doing this ...
 
 Thanks in advance for the help.
 
 Vince


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


Re: python reliability with EINTR handling in general modules

2012-02-02 Thread Mel Wilson
Dennis Lee Bieber wrote:

 On Wed, 1 Feb 2012 23:25:36 -0800 (PST), oleg korenevich
 void.of.t...@gmail.com wrote:
 
 
Thanks for help. In first case all vars is python integers, maybe
math.floor is redundant, but i'm afraid that same error with math
module call will occur in other places of app, where math is needed.
Strange thing here is that math library call is not a system call, and
strange exception ValueError (all values have right values) and why in
braces i have (4, Interruted system call).

 math.floor() may still be a system call of some sort if access to
 the math processor requires synchronization between processes (that is,
 the math processor/registers are maintained as a separate structure
 apart from the task status during process switches). {Yes -- that is a
 wild hypothesis}

One thing to remember about errno is that C library code will set it to a 
non-zero value when an error is encountered, but (I believe) there's no 
requirement to clear it in the absence of an error.  EINTR might just be 
left over from some long-gone I/O call, then reported just in case in 
handling an exception that didn't involve the C library at all.

As a C coder there are times when it's wise to clear errno yourself to make 
sure your code doesn't get fooled.

Mel.

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


[ANN] cdecimal-2.3 released

2012-02-02 Thread Stefan Krah
Hi,

I'm pleased to announce the release of cdecimal-2.3. cdecimal is a fast
drop-in replacement for the decimal module in Python's standard library.


Blurb
=

cdecimal is a complete implementation of IBM's General Decimal Arithmetic
Specification. With the appropriate context parameters, cdecimal will also
conform to the IEEE 754-2008 Standard for Floating-Point Arithmetic.

Typical performance gains over decimal.py are between 30x for I/O heavy
benchmarks and 80x for numerical programs. In a PostgreSQL database
benchmark, the speedup is 12x.


+-+-+--+-+
| |   decimal   |   cdecimal   |   speedup   |
+=+=+==+=+
|   pi|42.75s   |0.58s | 74x |
+-+-+--+-+
| telco   |   172.19s   |5.68s | 30x |
+-+-+--+-+
| psycopg | 3.57s   |0.29s | 12x |
+-+-+--+-+


In the pi benchmark, cdecimal often performs better than Java's BigDecimal
running on Java HotSpot(TM) 64-Bit Server VM.


What's New
==

o The underlying library - libmpdec - now has a very comprehensive
  test suite against decNumber.

o libmpdec now has full support for compilers without uint64_t.

o Code coverage of cdecimal has been increased to 100%. Now both
  libmpdec and cdecimal have 100% coverage.

o Improved code for conversion of small Python integers to Decimals
  leads to a performance gain of around 15%.

o Added real(), imag(), conjugate(), __complex__() methods.

o Add Fraction and complex comparisons (enabled for Python 3.2).

o Support for DecimalTuple output.


Stability
=

Both cdecimal and libmpdec have an extremely conservative release policy.
When new features are added, the complete test suite is run both with and
without Valgrind on many different platforms. With the added tests against
decNumber, this takes around 8 months on four cores.


Install
===

Since cdecimal is listed on PyPI, it can be installed using pip:

pip install cdecimal


Windows installers are available at:

http://www.bytereef.org/mpdecimal/download.html


Links
=

http://www.bytereef.org/mpdecimal/index.html
http://www.bytereef.org/mpdecimal/changelog.html
http://www.bytereef.org/mpdecimal/download.html

Checksums of the released packages
==

03f76f4acbb6e7f648c6efc6e424bbc1b4afb5632dac5196f840e71f603a2b4a  
mpdecimal-2.3.tar.gz
b0fd5bec2cc6a6035bc406339d020d2f4200a7dce8e8136a2850612a06508ed1  
mpdecimal-2.3.zip
d737cbe43ed1f6ad9874fb86c3db1e9bbe20c0c750868fde5be3f379ade83d8b  
cdecimal-2.3.tar.gz

84afd94126549a3c67c3bab7437d085347f9d05c  cdecimal-2.3.win-amd64-py2.6.msi
ba0fbb1f9314dcef29481414a5c3496ec159df2e  cdecimal-2.3.win-amd64-py2.7.msi
d11bbd560e9cb9d34b0e7a068ac1c1eac5371428  cdecimal-2.3.win-amd64-py3.1.msi
d024148ea603dc8e82f8371ebdfaa0e65f5a9945  cdecimal-2.3.win-amd64-py3.2.msi
d196a9e0b44dcb75bbf4eda44078b766e6113f72  cdecimal-2.3.win32-py2.6.msi
e2b044da6c241df0911059216821c9865cb9e4f0  cdecimal-2.3.win32-py2.7.msi
7e8b47eb3a2f50191e76f981fbe55050f13495e8  cdecimal-2.3.win32-py3.1.msi
61be767b91aab0ba0d602fb2b23f6d882cafec05  cdecimal-2.3.win32-py3.2.msi

a2278910a5b447af963e1d427dbeb48f49e377be  
cdecimal-2.3-no-thread.win-amd64-py2.6.msi
8da96d2f1ab1a98062cd43cb4f381b47309d8c22  
cdecimal-2.3-no-thread.win-amd64-py2.7.msi
85cd3ff4496aa7e0d0979d1695eef27cc7735c28  
cdecimal-2.3-no-thread.win-amd64-py3.1.msi
6c179a1284aceb3a7bfc481daae1d7d60359d487  
cdecimal-2.3-no-thread.win-amd64-py3.2.msi
40f245e907512c5d3602ba5993755a0b4b67ca80  cdecimal-2.3-no-thread.win32-py2.6.msi
960eb9bfd9fcf0faee6493506c1917d46536193a  cdecimal-2.3-no-thread.win32-py2.7.msi
42b651ee1bf4c94611c43522d69f1965515949b8  cdecimal-2.3-no-thread.win32-py3.1.msi
ec26f14c35502d1d5488d440d7bc22ad41e9ac65  cdecimal-2.3-no-thread.win32-py3.2.msi



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


Re: simple system for building packages for multiple platforms?

2012-02-02 Thread Miki Tebeka
IMO you can have different versions of Python on the same machine. So it's two 
windows machines. (Assuming you're going with *one* OS version :)

Also note there is some legal mambo jumbo around distributing MSVC DLLs (unless 
you plan to use mingw).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread Evan Driscoll

On 01/-10/-28163 01:59 PM, 8 Dihedral wrote:

If you're working in C++ and overload your operators so that 'a +='
and 'a = + b' have different observable behaviors (besides perhaps
time), then either your implementation is buggy or your design is very
bad-mannered.

Evan


Do you mean the result instances after 'a+= and 'a=a+b' or
the actions of behaviors of instances involved  in performing 'a+= and 'a=a+b'?



I mean if which operation you called is distinguishable in any way 
besides the time it takes to run or by tracing it through in a debugger


That means:

1. The value of 'a' should be the same after executing 'a+=b' and
   'a=a+b'
2. The actual result of the expression should be the same in both cases
   (in both cases it should be a reference to a)
3. Any additional side effects performed (ew!) should be the same in
   both cases

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


Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread andrea crotti
2012/2/2 Amirouche Boubekki amirouche.boube...@gmail.com:
 They are solution to write Python code that translates to javascript see
 this thread
 http://mail.python.org/pipermail/python-list/2011-November/1283110.html


Mm I don't think it's what the OP is asking (unless I misunderstood...).
I think he wants to compile some syntax TO Python.
But I don't really see why you would something like this (if not for fun).

Then how are you going to maintain the code? Maintain the compiled
code or the source? And proving that your translator is always correct
I think it's quite a hard task too...
-- 
http://mail.python.org/mailman/listinfo/python-list


Python embeded in c++ application. Can't load python module if application is placed in folder with unicode chars.

2012-02-02 Thread Сергей Владимирович
Hello. Please help me to import python module in my application that
has python 2.7.2 embeded.
I tried example from this link
http://docs.python.org/extending/embedding.html#embedding-python-in-c
paragraph 5.3.
If i place program in folder D:\temp\test_python\test_pythonævnes
på\Debug I will get error - Failed to load multiply.
My localization settings (system language) don't correspond the chars'
language used in path.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python embeded in c++ application. Can't load python module if application is placed in folder with unicode chars.

2012-02-02 Thread Terry Reedy

On 2/2/2012 6:37 PM, Сергей Владимирович wrote:

Hello. Please help me to import python module in my application that
has python 2.7.2 embeded.
I tried example from this link
http://docs.python.org/extending/embedding.html#embedding-python-in-c
paragraph 5.3.
If i place program in folder D:\temp\test_python\test_pythonævnes
på\Debug I will get error - Failed to load multiply.
My localization settings (system language) don't correspond the chars'
language used in path.


Easiest is to change your folder name to all ascii. This sort of thing 
will work better in future 3.x, but even then, a mismatch between 
encodings is a problem.


--
Terry Jan Reedy


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


Use logging level across application and modules

2012-02-02 Thread Jason Friedman
Base module:  http://pastebin.com/nQCG5CRC
Another module:  http://pastebin.com/FFzCCjwG
Application:  http://pastebin.com/370cWJtT

I have a module that will provide base functionality, such as logging
and authentication.
I have other specialized modules that provide additional
functionality.  One module will provide database connections, another
information about users and groups, etc.
I have an application script that uses the base module and one or more
specialized modules.

I want to allow the user to select a preferred logging level.  That is
easy to do by passing that level as an argument to base.get_logger().
However, the application also uses the other module; how do I set the
logging level there to match the user's preference?
-- 
http://mail.python.org/mailman/listinfo/python-list


multiple constructor __init__

2012-02-02 Thread Emmanuel Mayssat
Hello all,

I would like to instantiate my class as follow


QObject(param1, parent)
QObject(parent)

an example would be
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmenu.html

How can I do this without have to specify parent=parent in the second
version
(I always need to supply the parent parameter, but I would like to supply
it last)

I have read this
http://stackoverflow.com/questions/356718/how-to-handle-constructors-or-methods-with-a-different-set-or-type-of-argument
but all the suggested methods do not work as I want

Any idea?
--
Emmanuel
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: unzip function?

2012-02-02 Thread Prasad, Ramit
 If you understand what zip does, it should be obvious.
 
 Nobody likes to be told the thing they're confused about is trivial.

Nobody likes to be told to brush their teeth, eat their vegetables or clean 
their room. Then they grow up and learn that life is full of things that you 
do because you have to, not because you want to.
Learning that some things that they are confused about are trivial is one of 
those things.

Normally, I agree with you, but I think it's less about the truth and how it is 
stated.

You are wrong, it is like... VS. You are a grade-A moron, it is like...

They both teach; one just does it less offensively. What is obvious
to one person is not always obvious to everyone. :)

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


Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Ian Kelly
On Thu, Feb 2, 2012 at 3:53 PM, andrea crotti andrea.crott...@gmail.com wrote:
 2012/2/2 Amirouche Boubekki amirouche.boube...@gmail.com:
 They are solution to write Python code that translates to javascript see
 this thread
 http://mail.python.org/pipermail/python-list/2011-November/1283110.html


 Mm I don't think it's what the OP is asking (unless I misunderstood...).
 I think he wants to compile some syntax TO Python.
 But I don't really see why you would something like this (if not for fun).

Maybe because you think that Python syntax could be improved upon --
for instance, Python with pattern-matching would be freaking awesome
-- but at the same time you want to leverage Python's extensive
ecosystem of libraries.  So instead of creating your own brand-new
language with no third party libraries whatsoever, you create one that
just compiles down to regular Python.

 Then how are you going to maintain the code? Maintain the compiled
 code or the source?

As with all compiled software, you maintain the input, not the output.

 And proving that your translator is always correct

That's what unit tests are for.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple constructor __init__

2012-02-02 Thread Chris Rebert
On Thu, Feb 2, 2012 at 5:09 PM, Emmanuel Mayssat emays...@gmail.com wrote:
 Hello all,

 I would like to instantiate my class as follow

 QObject(param1, parent)
 QObject(parent)

 an example would be
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmenu.html

 How can I do this without have to specify parent=parent in the second
 version
 (I always need to supply the parent parameter, but I would like to supply it
 last)

 I have read this
 http://stackoverflow.com/questions/356718/how-to-handle-constructors-or-methods-with-a-different-set-or-type-of-argument
 but all the suggested methods do not work as I want

 Any idea?

I believe you can approximate that using a keyword-only argument
without a default value:

# Untested!
# Requires Python 3.x
class QObject(object):
def __init__(self, param1=some_default, *, parent):
# …

obj1 = QObject(parent=daddy)
obj2 = QObject(arg1, parent=daddy)

obj3 = QObject(daddy) # ERROR
obj4 = QObject(arg1, daddy) # ERROR
obj5 = QObject() # ERROR

Cheers,
Chris
--
Using names instead of some arbitrary ordering makes much more sense.
http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SnakeScript? (CoffeeScript for Python)

2012-02-02 Thread Chris Angelico
On Fri, Feb 3, 2012 at 9:53 AM, andrea crotti andrea.crott...@gmail.com wrote:
 Mm I don't think it's what the OP is asking (unless I misunderstood...).
 I think he wants to compile some syntax TO Python.
 But I don't really see why you would something like this (if not for fun).

 Then how are you going to maintain the code? Maintain the compiled
 code or the source? And proving that your translator is always correct
 I think it's quite a hard task too...

There's two similar concepts here.

1) Skeleton codegens. You do up some kind of template, run it through
a program, and get a ready-to-fill-in code structure. In this case,
you don't care so much about the translator's quality (if there's
bugs/limitations, you fix 'em after codegenning), and will maintain
the compiled code.

2) Compilation to Python. You write your program in some other
language, run it through a program, and get executable code out of it.
You want the translator to be perfect (so that you don't have to edit
the resulting code), and will maintain the original source.

I think the OP is looking for #2. I've used that sort of technique a
number of times (not with Python specifically, but with other
languages that lack certain handy features); usually the source is
trivially translateable into the output, with 99% of syntax identical
(for instance, one oft-wanted feature is a C-like #include - I've
written .php.m4 files that  get processed through M4 to become PHP
files).

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


Re: copy on write

2012-02-02 Thread John O'Hagan
On Thu, 02 Feb 2012 12:25:00 -0500
Terry Reedy tjre...@udel.edu wrote:

 On 2/2/2012 9:17 AM, John O'Hagan wrote:
 
  It's not so much about the type of x but that of x[1]. Wouldn't it
  be possible to omit the assignment simply if the object referred to
  by x[1] uses += without creating a new object? That way,
  some_tuple[i] += y will succeed if some_tuple[i] is a list but not
  with, say, an int. That seems reasonable to me.
 
 There was considerable discussion of the exact semantics of augmented 
 operations when they were introduced. I do not remember if that 
 particular idea was suggested (and rejected) or not. You could try to 
 look at the PEP, if there is one, or the dicussion ( probably on
 pydev list).
 

I think we're 12 years late on this one. It's PEP 203 from 2000 and the key 
phrase was:

The in-place function should always return a new reference, either
to the old `x' object if the operation was indeed performed
in-place, or to a new object.

If this had read:

The in-place function should return a reference to a new object
if the operation was not performed in-place.

or something like that, we wouldn't be discussing this.

The discussion on py-dev at the time was quite limited but there was some 
lively debate on this list the following year (in the context of widespread 
controversy over new-fangled features which also included list comprehensions 
and generators), to which the BDFL's response was:

You shouldn't think += is confusing because sometimes it modifies an
object and sometimes it does.  Gee, there are lots of places where
something that's *spelled* the same has a different effect depending
on the object types involved.


That's true, but I don't think there should be a different effect depending on 
what _name_ we use for an operand:

 t=([],)
 l=t[0]
 l is t[0]
True
 l+=[1]
 t
([1],)
 t[0]+=[1]
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'tuple' object does not support item assignment
 t
([1, 1],)
 l is t[0]
True

Same object, same operator, different name, different outcome. Maybe that was 
obvious from the foregoing discussion, but it shocked me when put that way.

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


Re: multiple constructor __init__

2012-02-02 Thread Terry Reedy

On 2/2/2012 8:09 PM, Emmanuel Mayssat wrote:

Hello all,

I would like to instantiate my class as follow


QObject(param1, parent)
QObject(parent)

an example would be
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmenu.html

How can I do this without have to specify parent=parent in the second
version
(I always need to supply the parent parameter, but I would like to
supply it last)


The same way range(stop) versus range(start,stop) works.
But I really recommend against that api.
It makes both doc and code messy.
You need a really good reason to not use the obvious
def __init__(self, parent, param=default):...

--
Terry Jan Reedy

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


python CPU usage 99% on ubuntu aws instance using eventlet

2012-02-02 Thread Teddy Toyama
Okay, I am crossposting this from the eventlet dev mailing list since I am
in urgent need of some help.

I am running eventlet 0.9.16 on a Small (not micro) reserved ubuntu
11.10 aws instance.

I have a socketserver that is similar to the echo server from the examples
in the eventlet documentation. When I first start running the code,
everything seems fine, but I have been noticing that after 10 or 15 hours
the cpu usage goes from about 1% to 99+%. At that point I am unable to make
further connections to the socketserver.

This is the important (hopefully) parts of the code that I'm running:

code
   # the part of the code that listens for incoming connections
def socket_listener(self, port, socket_type):
L.LOGG(self._CONN, 0, H.func(), 'Action:Starting|SocketType:%s' %
socket_type)
listener = eventlet.listen((self._host, port))
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
pool = eventlet.GreenPool(2)
while True:
connection, address = listener.accept()
connection.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 I want this loop to run as fast as possible.

I previously grabbed the first message that a plug/device
sent here
and used that information to add a new object to the
socket_hash.
Instead of doing that here I've relocated that logic to the
spawned
object so that this loop is doing as little work as
possible.

L.LOGG(self._CONN, 0, H.func(),
'IPAddress:%s|GreenthreadsFree:%s|GreenthreadsRunning:%s' %
(str(address[0]), str(pool.free()),str(pool.running(
pool.spawn_n(self.spawn_socketobject, connection, address,
socket_type)
listener.shutdown(socket.SHUT_RDWR)
listener.close()
/code
The L.LOGG method simply logs the supplied parameters to a mysql table.

I am running the socket_listener in a thread like so:

code
def listen_phones(self):
self.socket_listener(self._port_phone, 'phone')

t_phones = Thread(target = self.listen_phones)
t_phones.start()
/code

From my initial google searches I thought the issue might be similar to the
bug reported at
https://lists.secondlife.com/pipermail/eventletdev/2008-October/000140.html but
I am using a new version of eventlet so surely that cannot be it?

Is there any additional information I can provide to help further
troubleshoot the issue?

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


Re: Use logging level across application and modules

2012-02-02 Thread Jason Friedman
 Base module:  http://pastebin.com/nQCG5CRC
 Another module:  http://pastebin.com/FFzCCjwG
 Application:  http://pastebin.com/370cWJtT

 I have a module that will provide base functionality, such as logging
 and authentication.
 I have other specialized modules that provide additional
 functionality.  One module will provide database connections, another
 information about users and groups, etc.
 I have an application script that uses the base module and one or more
 specialized modules.

 I want to allow the user to select a preferred logging level.  That is
 easy to do by passing that level as an argument to base.get_logger().
 However, the application also uses the other module; how do I set the
 logging level there to match the user's preference?

I figured a way to do this.
In the base module I created a global variable loglevel.
I set the logging level according to that value.
I set the variable from my application script.
Because of the memoization of the get_logger() call, the other modules
get that same loglevel value.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread Steven D'Aprano
On Fri, 03 Feb 2012 14:08:06 +1100, John O'Hagan wrote:

 I think we're 12 years late on this one. It's PEP 203 from 2000 and the
 key phrase was:
 
 The in-place function should always return a new reference, either to
 the old `x' object if the operation was indeed performed in-place, or to
 a new object.
 
 If this had read:
 
 The in-place function should return a reference to a new object if the
 operation was not performed in-place.
 
 or something like that, we wouldn't be discussing this.

And what should it return if the operation *is* performed in-place? 
Don't return anything is not an option, Python doesn't have procedures. 
That implies that __iadd__ etc. should return None. But two problems come 
to mind:

1) Using None as an out-of-band signal to the interpreter to say don't 
perform the assignment makes it impossible for the augmented assignment 
method to return None as the result. If we only think about numeric 
operations like x += 1 then we might not care, but once you consider the 
situation more widely the problem is clear:

x = Fact(foo)
y = Fact(bar)
x  y  # Returns a composite Fact, or None if they are contradictory

With your suggestion, x = y fails to work, but only sometimes. And when 
it fails, it doesn't fail with an explicit exception, but silently fails 
and then does the wrong thing. This makes debugging a horror.

2) And speaking of debugging, sometimes people forget to include the 
return statement in methods. Normally, the left hand side of the 
assignment then gets set to None, and the error is pretty obvious as soon 
as you try to do something with it. But with your suggestion, instead of 
getting an exception, it silently fails, and your code does the wrong 
thing.

I suppose that they could have invented a new sentinel, or a special 
exception to be raised as a signal, but that's piling complication on top 
of complication, and it isn't clear to me that it's worth it for an 
obscure corner case.

Yes, the current behaviour is a Gotcha, but it's a Gotcha that makes good 
sense compared to the alternatives.

Ultimately, augmented assignment is *assignment*, just like it says on 
the tin. t[1] += x is syntactic sugar for t[1] = t[1].__iadd__(x). It 
can't and shouldn't fail to raise an exception if t is a tuple, because 
tuple item assignment *must* fail.

The problem is that lists treat __iadd__ as an in-place optimization, and 
this clashes with tuple immutability. But if lists *didn't* treat 
__iadd__ as in-place, people would complain when they used it directly 
without a tuple wrapper. 

Perhaps lists shouldn't define += at all, but then people will complain 
that mylist += another_list is slow. Telling them to use mylist.extend 
instead just makes them cranky. After all, mylist + another_list works, 
so why shouldn't += work?

Ultimately, there is no right answer, because the multitude of 
requirements are contradictory. No matter what Python did, somebody would 
complain.



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


Re: changing sys.path

2012-02-02 Thread Tim Roberts
Andrea Crotti andrea.crott...@gmail.com wrote:

So suppose I want to modify the sys.path on the fly before running some code
which imports from one of the modules added.

at run time I do
sys.path.extend(paths_to_add)

but it still doesn't work and I get an import error.

Are you actually adding multiple paths?  One possible cause for error would
be this:
sys.path.extend( '/usr/local/lib' )

That succeeds, but it doesn't do what you meant.  It adds / as a path,
then u, then s, then r, and so on.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem sending an email in html with mime image

2012-02-02 Thread Tim Roberts
Ariel isaacr...@gmail.com wrote:

Hi everybody I have a question, here is my problem I want to send an
email with content in html with an image embed so I converted the
image binary in mime text and then I put the mime code inside the src
attribute of the html like this:

img class=logoe src=data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkq ...  
/

Do email readers actually implement the data: scheme in img tags?

The problem is that if I don't put the image mime code inside the src
the email is sent but when I put the code then the email is not send
and I don't get any error message.

There must be something else going on.  The content of the message is
irrelevant to the sending process, unless it makes your message way too
big.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: copy on write

2012-02-02 Thread Chris Angelico
On Fri, Feb 3, 2012 at 4:04 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 No matter what Python did, somebody would complain.

+1

This is, I think, the ultimate truth of the matter.

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


Re: [ANN] cdecimal-2.3 released

2012-02-02 Thread Paul Rubin
Stefan Krah ste...@bytereef.org writes:
 cdecimal is a complete implementation of IBM's General Decimal Arithmetic
 Specification. With the appropriate context parameters, cdecimal will also
 conform to the IEEE 754-2008 Standard for Floating-Point Arithmetic.

Cool.  I wonder when we'll start seeing this in non-IBM hardware CPU's.

 Both cdecimal and libmpdec have an extremely conservative release policy.
 When new features are added, the complete test suite is run both with and
 without Valgrind on many different platforms. With the added tests against
 decNumber, this takes around 8 months on four cores.

Wow.  I wonder whether it's worth looking into some formal verification
if the required level of confidence is that high.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue13756] Python3.2.2 make fail on cygwin

2012-02-02 Thread Luis Marsano

Luis Marsano luis.mars...@gmail.com added the comment:

Got it to build. Unpack the Python (3.2.2) source package and apply this patch 
to get a package that builds on Cygwin (1.7.9), eg:
xz -d patch.xz  tar -xJf Python-3.2.2.tar.xz  patch -p0 -i patch

Changes:
(1) The Makefile, makesetup, and distutils.UnixCCompiler and 
distutils.command.build_ext modules set values for locating cygwin's python 
library that didn't agree or make sense during buildtime, so I revised them to 
agree and use build options that work.
(2) configuration and setup.py couldn't locate cygwin's ncurses headers, so I 
revised them to do that. I don't think I made that change as portable friendly 
as possible, so someone please check that and find a better way.

Your input is welcome.

--
Added file: http://bugs.python.org/file24395/patch.xz

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



[issue13922] argparse handling multiple -- in args improperly

2012-02-02 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +bethard, eric.smith

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



[issue13882] Add format argument for time.time(), time.clock(), ... to get a timestamp as a Decimal object

2012-02-02 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Patch version 7:
 - Drop datetime.datetime and datetime.timedelta types
 - Conversion to decimal now uses a context with 1 digit to compute
exponent=1/denominator to avoid issue on t.quantize(exponent)
 - Rename the format argument to timestamp in the time module
 - Rename _PyTime_AsFormat() to _PyTime_Convert()
 - Update the doc

--
Added file: http://bugs.python.org/file24396/time_decimal-7.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___diff --git a/Doc/library/os.rst b/Doc/library/os.rst
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -808,13 +808,16 @@ as internal buffering of data.
Availability: Unix.
 
 
-.. function:: fstat(fd)
+.. function:: fstat(fd, timestamp=None)
 
Return status for file descriptor *fd*, like :func:`~os.stat`.
 
Availability: Unix, Windows.
 
-.. function:: fstatat(dirfd, path, flags=0)
+   .. versionchanged:: 3.3
+  Added the *timestamp* argument.
+
+.. function:: fstatat(dirfd, path, flags=0, timestamp=float)
 
Like :func:`stat` but if *path* is relative, it is taken as relative to 
*dirfd*.
*flags* is optional and may be 0 or :data:`AT_SYMLINK_NOFOLLOW`.
@@ -1696,7 +1699,7 @@ Files and Directories
.. versionadded:: 3.3
 
 
-.. function:: lstat(path)
+.. function:: lstat(path, timestamp=None)
 
Perform the equivalent of an :c:func:`lstat` system call on the given path.
Similar to :func:`~os.stat`, but does not follow symbolic links.  On
@@ -1706,6 +1709,9 @@ Files and Directories
.. versionchanged:: 3.2
   Added support for Windows 6.0 (Vista) symbolic links.
 
+   .. versionchanged:: 3.3
+  The *timestamp* argument was added.
+
 
 .. function:: lutimes(path[, times])
 
@@ -1955,7 +1961,7 @@ Files and Directories
.. versionadded:: 3.3
 
 
-.. function:: stat(path)
+.. function:: stat(path, timestamp=None)
 
Perform the equivalent of a :c:func:`stat` system call on the given path.
(This function follows symlinks; to stat a symlink use :func:`lstat`.)
@@ -1975,6 +1981,11 @@ Files and Directories
* :attr:`st_ctime` - platform dependent; time of most recent metadata 
change on
  Unix, or the time of creation on Windows)
 
+   :attr:`st_atime`, :attr:`st_mtime` and :attr:`st_ctime` are :class:`float`
+   by default, or :class:`int` if :func:`os.stat_float_times` is ``False``. Set
+   the *timestamp* argument to get another :ref:`timestamp type
+   timestamp-types`.
+
On some Unix systems (such as Linux), the following attributes may also be
available:
 
@@ -2030,6 +2041,9 @@ Files and Directories
 
Availability: Unix, Windows.
 
+   .. versionchanged:: 3.3
+  Added the *timestamp* argument.
+
 
 .. function:: stat_float_times([newvalue])
 
@@ -2055,6 +2069,9 @@ Files and Directories
are processed, this application should turn the feature off until the 
library
has been corrected.
 
+   .. deprecated:: 3.3
+  Use *timestamp* argument of stat functions instead.
+
 
 .. function:: statvfs(path)
 
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -95,6 +95,14 @@ An explanation of some terminology and c
   | local time  | |
 |
   
+-+-+-+
 
+.. _timestamp-types:
+
+* Python supports the following timestamp types:
+
+  * :class:`int`
+  * :class:`float`
+  * :class:`decimal.Decimal`
+
 
 The module defines the following functions and data items:
 
@@ -118,7 +126,7 @@ The module defines the following functio
   Unlike the C function of the same name, there is no trailing newline.
 
 
-.. function:: clock()
+.. function:: clock(timestamp=float)
 
.. index::
   single: CPU time
@@ -135,16 +143,27 @@ The module defines the following functio
:c:func:`QueryPerformanceCounter`. The resolution is typically better than 
one
microsecond.
 
+   Return as a floating point number by default, set the *timestamp* argument
+   to get another :ref:`timestamp type timestamp-types`.
 
-.. function:: clock_getres(clk_id)
+   .. versionchanged:: 3.3
+  Added the *timestamp* argument.
+
+
+.. function:: clock_getres(clk_id, timestamp=float)
 
Return the resolution (precision) of the specified clock *clk_id*.
+   Return a floating point number by default, set the *timestamp* argument to
+   get another :ref:`timestamp type timestamp-types`.
+
 
.. versionadded:: 3.3
 
-.. function:: clock_gettime(clk_id)
+.. function:: clock_gettime(clk_id, timestamp=float)
 
Return the time of the specified clock *clk_id*.
+   Return a floating point number by default, set the *timestamp* argument to
+   get another :ref:`timestamp type timestamp-types`.
 
.. versionadded:: 3.3
 
@@ -213,12 +232,15 @@ The module 

[issue13924] Mercurial robots.txt should let robots crawl landing pages.

2012-02-02 Thread Antoine Pitrou

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

Can you propose a robots.txt file?

--
nosy: +georg.brandl, pitrou

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



[issue13926] IDLE closes when requesting a list of available modules in the online help utility

2012-02-02 Thread Jeroen

Changes by Jeroen dario...@gmail.com:


--
components: IDLE
nosy: Jeroen
priority: normal
severity: normal
status: open
title: IDLE closes when requesting a list of available modules in the online 
help utility
type: behavior
versions: Python 2.7

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



[issue13889] str(float) and round(float) issues with FPU precision

2012-02-02 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 Hi Marc, the changes to the pythoncore.vcproj Visual-Studio file define  the 
 HAVE_VC_FUNC_FOR_X87 symbol.

Okay, makes sense.  I was distracted by the spurious reordering of in the diff 
for pythoncore.vcproj.

Just to be clear, the intent of the patch is that the FPU state is *always* 
switched on Windows prior to calling the dtoa.c functions;  is that right?

Things to think about:

 - can we avoid *writing* to the x87 / SSE control word if no change is 
necessary (as is currently done with the gcc code)?  We want to avoid 
unnecessary FPU pipeline flushes.

 - we need to make sure that the patch works on 64-bit.  There's a bit of text 
at:

http://msdn.microsoft.com/en-us/library/c9676k6h.aspx

   that suggests that in x64 mode, setting the precision is an error.

 - what happens if the x87 and SSE2 control words have different precisions?  
Does the patch restore both those precisions correctly?

 - in the patch, isn't new387controlword unused?

I'm not sure that this part of the patch can go into the maintenance branches 
(2.7, 3.2);  if this is a new feature (and I think it is, but I'm willing to be 
persuaded otherwise), it can only target 3.3.

--

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



[issue13924] Mercurial robots.txt should let robots crawl landing pages.

2012-02-02 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue13926] IDLE closes when requesting a list of available modules in the online help utility

2012-02-02 Thread Jeroen

New submission from Jeroen dario...@gmail.com:

When using IDLE (2.7.2) in Ubuntu 11.10 the following error occurs:

When the online help utility in IDLE is started (by entering the help()
commando), it should be possible to get a list of all available modules by
typing modules. When I do so a message is shown that the list will be
created, but after a few seconds the list isn't shown but IDLE is closed
instead.

Python version: Python 2.7.2+ (default, Oct  4 2011, 20:06:09) [GCC 4.6.1]
on linux2
Tk version: 8.5
IDLE version: 2.7.2

2012/2/2 Jeroen rep...@bugs.python.org


 Changes by Jeroen dario...@gmail.com:


 --
 components: IDLE
 nosy: Jeroen
 priority: normal
 severity: normal
 status: open
 title: IDLE closes when requesting a list of available modules in the
 online help utility
 type: behavior
 versions: Python 2.7

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue13926
 ___


--

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



[issue13856] xmlrpc / httplib changes to allow for certificate verification

2012-02-02 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

I am sorry. I see that with context object in 3.x, verification is being done. 
The CA certs can be pointed to using load_verify_locations. 

As the author had in this patc tothe pass on addition ca_certs and ca_reqs to 
wrap_socket in ssl from httplib2. I thought, it was a new requirement. In 2.7, 
those args are not present. 

For this issue, modifying the xmlrpc.client to support ssl context and making a 
HTTPConnection with context object is present may be way to go.

--

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



[issue1813] Codec lookup failing under turkish locale

2012-02-02 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset a55ffb6c1993 by Stefan Krah in branch '3.2':
Issue #1813: Revert workaround for a glibc bug on the Fedora buildbot.
http://hg.python.org/cpython/rev/a55ffb6c1993

New changeset 4244e4348362 by Stefan Krah in branch 'default':
Issue #1813: merge changeset that reverts a glibc workaround for the
http://hg.python.org/cpython/rev/4244e4348362

New changeset 0b8917fc6db5 by Stefan Krah in branch '2.7':
Issue #1813: backport changeset that reverts a glibc workaround for the
http://hg.python.org/cpython/rev/0b8917fc6db5

--

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



[issue1813] Codec lookup failing under turkish locale

2012-02-02 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

I've upgraded the Fedora buildbot to Fedora-16. The specific glibc
workaround should not be necessary any more.


So the test will now fail again on all systems that a) have the bug
and b) the tr_Tr locale.

--

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



[issue13856] xmlrpc / httplib changes to allow for certificate verification

2012-02-02 Thread Antoine Pitrou

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

 For this issue, modifying the xmlrpc.client to support ssl context and
 making a HTTPConnection with context object is present may be way to
 go.

xmlrpc is higher level than http.client, so you might also adopt the
urllib approach of passing ca_file and ca_path. As you (or Martin)
prefer :-)

--

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



[issue13921] sqlite3: OptimizedUnicode doesn't work in Py3k

2012-02-02 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Attached a patch. It changes OptimizedUnicode to be an alias for PyUnicode_Type 
and adds a note to the documentation for porters from 2.x that it has no effect 
on py3k.

The patch removes/refactors all OptimizedUnicode and allow_8bit_chars related 
obsolete code that had been left over from py3k transition. These 
removals/refactorizations have no operational effect, so the module still works 
the same way it has always worked in Py3k.

Should OptimizedUnicode be deprecated, too? In this case, it cannot be aliased 
to str, and _pysqlite_fetch_one_row() needs to raise a DeprecationWarning if 
OptimizedUnicode is used.

--

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



[issue13921] sqlite3: OptimizedUnicode doesn't work in Py3k

2012-02-02 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
keywords: +patch
Added file: http://bugs.python.org/file24397/issue13921.patch

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



[issue13921] sqlite3: OptimizedUnicode doesn't work in Py3k

2012-02-02 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
keywords: +needs review
stage:  - patch review

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



[issue13817] deadlock in subprocess while running several threads using Popen

2012-02-02 Thread Stephen White

Changes by Stephen White stephen-python@randomstuff.org.uk:


--
nosy: +Stephen.White

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



[issue13921] sqlite3: OptimizedUnicode doesn't work in Py3k

2012-02-02 Thread Antoine Pitrou

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

 Should OptimizedUnicode be deprecated, too?

I'd say just undocument it.

--

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



[issue13921] sqlite3: OptimizedUnicode doesn't work in Py3k

2012-02-02 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

  Should OptimizedUnicode be deprecated, too?
 
 I'd say just undocument it.

Even remove the note from the patch?

--

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



[issue13124] Add Running a Build Slave page to the devguide

2012-02-02 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Here's a terse shell script that IMO even moderately experienced admins
will prefer to the current version.

I'm not sure if the devguide is the right place for this, since
non-devs are very welcome to set up buildbots.

--
nosy: +pitrou
Added file: http://bugs.python.org/file24398/buildslave_install.sh

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



[issue13921] sqlite3: OptimizedUnicode doesn't work in Py3k

2012-02-02 Thread Antoine Pitrou

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

Le jeudi 02 février 2012 à 16:43 +, Petri Lehtinen a écrit :
 Petri Lehtinen pe...@digip.org added the comment:
 
   Should OptimizedUnicode be deprecated, too?
  
  I'd say just undocument it.
 
 Even remove the note from the patch?

Well, I guess keeping the note is fine.

--

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



[issue13124] Add Running a Build Slave page to the devguide

2012-02-02 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


Added file: http://bugs.python.org/file24399/buildslave_install.txt

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



[issue13124] Add Running a Build Slave page to the devguide

2012-02-02 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


Removed file: http://bugs.python.org/file24398/buildslave_install.txt

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



[issue13124] Add Running a Build Slave page to the devguide

2012-02-02 Thread Antoine Pitrou

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

 Here's a terse shell script that IMO even moderately experienced admins
 will prefer to the current version.

I'm sure some admins will prefer using their system's packages (I think
buildbot is packaged for Debian/Ubuntu, I see it in Mageia's packages,
not sure about Fedora).

Anyway, the current instructions are on the wiki:
http://wiki.python.org/moin/BuildBot
You could add your script or link to it there.

--

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



[issue13926] pydoc - stall when requesting a list of available modules in the online help utility

2012-02-02 Thread Roger Serwy

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

I tried this and while IDLE didn't crash, it stalled when running with and 
without a subprocess. I then tried running this from the regular python 
interpreter and it stalled there as well. This is not a problem with IDLE, but 
a problem with pydoc itself.

Steps to reproduce:

 help()

help modules

-- stall --

A blank Tk window suddenly appeared, which suggested that something loaded 
Tkinter. Digging deeper, the help utility in Lib/pydoc.py loads every single 
module found on in sys.path in order to get its __doc__ string. This is doing 
too much work as the purpose of modules is to give a list of available 
modules.

I modified ModuleScanner in pydoc.py so that loader.load_module doesn't get 
called. I set desc and path do hard-coded strings and now modules returns 
a list very quickly. A blank tkinter window still pops up, however.

--
components: +Library (Lib) -IDLE
nosy: +pje, serwy, terry.reedy
title: IDLE closes when requesting a list of available modules in the online 
help utility - pydoc - stall when requesting a list of available modules in 
the online help utility

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



[issue13405] Add DTrace probes

2012-02-02 Thread Stan Cox

Stan Cox s...@redhat.com added the comment:

This is a subset of the dtrace patch and consists of the minimal functionality
needed by systemtap.  The only files that are changed from upstream sources are
as follows.

* configure/configure.in
* Makefile.pre.in
* pyconfig.h.in
  Same changes as the dtrace patch except there is no phelper.

* pydtrace.d
  Same change as the dtrace patch except added PyFrameObject to probes.
  Instead of passing in fields like filename and function name, the systemtap
  scripts (not shown) use PyFrameObject and access the python data structures.
  The overhead for a systemtap probe is a single nop and PyFrameObject is
  possibly live at the probe point so the overhead will be minimal.  pydtrace.h
  is always generated since this file is different for dtrace and stap.

* ceval.c
  The only changes to ceval.c from the upstream version are the addition of the
  PYTHON_FUNCTION_ENTRY and PYTHON_FUNCTION_RETURN probes.
  PYTHON_FUNCTION_ENTRY is invoked directly since the overhead of the probe is
  less than the overhead of a conditional check.  The probe passes the
  PyFrameObject, as mentioned above, but nothing else.  Likewise for
  PYTHON_FUNCTION_RETURN.

systemtap tapset, not included in patch, will provide backtrace results such as:
 #0 main  at /.../python/celsius.py:19
 #1 module  at /.../python/celsius.py:3
 #2 celsius_to_farenheit (celsius:int ) at /.../python/celsius.py:7
and variable trace results such as:
 tuple atuple in celsius_to_farenheit at /.../python/celsius.py =  a, b, 
c,
 list alist in celsius_to_farenheit at /.../python/celsius.py = [ 1, 2, 3,]
 set aset in celsius_to_farenheit at /.../python/celsius.py = { 1, 2, 3,}
...

--
Added file: http://bugs.python.org/file24400/python-stap.patch

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



[issue13926] pydoc - stall when requesting a list of available modules in the online help utility

2012-02-02 Thread Phillip J. Eby

Phillip J. Eby p...@telecommunity.com added the comment:

The problem might be that you're iterating over more than just the top
level; if you look for submodules then the parent package has to be
imported... and that might make that window load, if there's module-level
code in the package __init__ that does that.

--

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



[issue13402] Document absoluteness of sys.executable

2012-02-02 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset fdcda5b74317 by Petri Lehtinen in branch '3.2':
Document absoluteness of sys.executable
http://hg.python.org/cpython/rev/fdcda5b74317

New changeset 8b591a86fc91 by Petri Lehtinen in branch 'default':
Merge branch 3.2
http://hg.python.org/cpython/rev/8b591a86fc91

New changeset c351536e804a by Petri Lehtinen in branch '2.7':
Document absoluteness of sys.executable
http://hg.python.org/cpython/rev/c351536e804a

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue13817] deadlock in subprocess while running several threads using Popen

2012-02-02 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset c3649173d093 by Charles-François Natali in branch '2.7':
Issue #13817: After fork(), reinit the ad-hoc TLS implementation earlier to fix
http://hg.python.org/cpython/rev/c3649173d093

New changeset 7b24dd587a7b by Charles-François Natali in branch '3.2':
Issue #13817: After fork(), reinit the ad-hoc TLS implementation earlier to fix
http://hg.python.org/cpython/rev/7b24dd587a7b

New changeset a0100852b6fe by Charles-François Natali in branch 'default':
Issue #13817: After fork(), reinit the ad-hoc TLS implementation earlier to fix
http://hg.python.org/cpython/rev/a0100852b6fe

--
nosy: +python-dev

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



[issue13927] Extra spaces in the output of time.ctime

2012-02-02 Thread Roger Caldwell

New submission from Roger Caldwell ro...@monkey.net:

Hi.  I found this today and thought I would report.  I could not find anywhere 
that it was expected behavior.  When using time.ctime() to convert a date which 
only has 1 digit in the day position it returs a string with 2 spaces after the 
month vs one.

example
In [2]: import os,time

In [3]: time.ctime(os.path.getmtime('file.cfg'))
Out[3]: 'Tue Dec 13 18:52:58 2011'

In [4]: time.ctime(os.path.getmtime('14d-1.log'))
Out[4]: 'Tue Feb  1 19:53:11 2011'

Is this expected behavior?

--
components: None
messages: 152475
nosy: Roger.Caldwell
priority: normal
severity: normal
status: open
title: Extra spaces in the output of time.ctime
type: behavior
versions: Python 2.7

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



[issue13901] test_get_outputs (test_distutils) failure with --enable-shared on Mac OS X

2012-02-02 Thread toggtc

toggtc tog...@gmail.com added the comment:

Thank you for analysis and explanations, Ned. 
In addition, the -L(whitespace) is not allowed in Apple's GCC. GNU's GCC is OK. 
(I checked it using both GCC 4.2)
So, your solution is right.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13901
___
___
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-02-02 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

IMO removing trailing newlines is not acceptable. You could use 
splitlines(keepends=True) to keep final newlines (but then the default function 
that determines lines to indent needs to ignore these newlines).

--

___
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



[issue13918] locale.atof documentation is missing func argument

2012-02-02 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

I don't think that argument needs to be documented.  It's just there because 
somebody thought that copying 3 lines from atof into atoi was a bad idea.

--
nosy: +georg.brandl
resolution:  - wont fix
status: open - pending

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



[issue13918] locale.atof documentation is missing func argument

2012-02-02 Thread Cédric Krier

Cédric Krier cedric.kr...@b2ck.com added the comment:

Indeed I find it useful to use to get a Decimal instead of a float.
So I was wondering if I can rely on it or not in my application?

--
status: pending - open

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



[issue13817] deadlock in subprocess while running several threads using Popen

2012-02-02 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Committed.

Christoph, thanks for the report.

--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

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



[issue6210] Exception Chaining missing method for suppressing context

2012-02-02 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

Latest version of PEP is on python-dev; here is the latest patch.

Summary:

For __cause__ we are replacing the old special value of None with Ellipsis:  
Ellipsis means check __context__ for an exception to display; None means ignore 
__context__ and stop following exception chain; an exception means display this 
exception and stop following the exception chain.

--
Added file: http://bugs.python.org/file24401/raise_from_none_v6.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6210
___
___
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-02-02 Thread Ezra Berch

Ezra Berch ezrabe...@mac.com added the comment:

Sorry, I guess I wasn't clear. The trailing-newlines issue was an issue with 
the conditional expression ncoghlan suggested. It's fixed in the patch I 
submitted (and covered by the tests).

--

___
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



[issue13927] Extra spaces in the output of time.ctime

2012-02-02 Thread Eric V. Smith

Eric V. Smith e...@trueblade.com added the comment:

That's definitely the expected behavior. It's the same as the C library version 
of ctime().

But I couldn't find it documented in the Python docs, so I'm changing this to a 
documentation issue.

Thanks for the report.

--
assignee:  - docs@python
components: +Documentation -None
nosy: +docs@python, eric.smith
versions: +Python 3.2, Python 3.3

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



[issue13926] pydoc - stall when requesting a list of available modules in the online help utility

2012-02-02 Thread Roger Serwy

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

Should calling modules automatically iterate over all submodules or should it 
return just a list of top level modules?

--

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



[issue13926] pydoc - stall when requesting a list of available modules in the online help utility

2012-02-02 Thread Phillip J. Eby

Phillip J. Eby p...@telecommunity.com added the comment:

I don't have the code you're talking about in front of me; just wanted to
give you a lead on the likely cause.

--

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



[issue13926] pydoc - stall when requesting a list of available modules in the online help utility

2012-02-02 Thread Roger Serwy

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

You're right. The pkgutil.walk_packages method called from ModuleScanner seems 
to be importing the submodules. I should have said that in the last message.

I'll try to be clearer. What should the correct behavior be when entering 
modules in the interactive help system? This is an open question to anyone.

--

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



[issue12902] help(modules) executes module code

2012-02-02 Thread Terry J. Reedy

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

#13902 is essentially a duplicate of this and I may close it.
I am thinking now that executing unknown amounts of unknown code from unknown 
modules is a really bad idea. If a module just crashes the system, as happened 
with the OP of the above, there is no way to tell what the culprit is. So if we 
do not disable 'modules', I thing it should just read directory names and 
forget about docstrings. In any case, output should be flushed as available if 
not now.

--

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



[issue13926] pydoc - stall when requesting a list of available modules in the online help utility

2012-02-02 Thread Terry J. Reedy

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

This issue is essentially a duplicate of #12092. For the OP there, the stall 
happens because something on Gnome pops up a configuration GUI and, I presume, 
waits for response. I am thinking now that 'modules' is simply a bad idea and 
should be removed or severely changed to only list and not execute. There is no 
telling *what* might be on the search path.

I noted there that there are two issues: documenting help() better, and 
changing the behavior of help('modules') and that there is least a behavior 
bug. I am only leaving this issue open because of the report of IDLE crashing - 
which does not happen on Win7, 3.2. I know nothing of how IDLE executes on *nix 
and whether there is anything that might be done to at least exit more 
gracefully.

We might make this the 'change code' issue, though if code is change, some of 
the proposed doc change will become obsolete.

--
superseder:  - Clarify sentence in tutorial

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

As expected, size_t is too small on Windows 32 bits.

Patch version 8: _PyTime_t uses Py_LONG_LONG if available, instead of size_t, 
for numerator and denominator.

--
title: Add format argument for time.time(), time.clock(), ... to get a 
timestamp as a Decimal object - PEP 410: Use decimal.Decimal type for 
timestamps
Added file: http://bugs.python.org/file24402/time_decimal-8.patch

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file24372/time_decimal-5.patch

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file24396/time_decimal-7.patch

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file24378/time_decimal-6.patch

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

(Resend patch version 8 without the git diff format to support review on 
Rietveld.)

--
Added file: http://bugs.python.org/file24403/time_decimal-8.patch

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file24403/time_decimal-8.patch

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



[issue13882] PEP 410: Use decimal.Decimal type for timestamps

2012-02-02 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


Removed file: http://bugs.python.org/file24402/time_decimal-8.patch

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



  1   2   >