DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Noam Yorav-Raphael
I'm pleased to announce DreamPie 1.0 - a new graphical interactive Python shell!

Some highlights:

* Has whatever you would expect from a graphical Python shell -
attribute completion, tooltips which show how to call functions,
highlighting of matching parentheses, etc.
* Fixes a lot of IDLE nuisances - in DreamPie interrupt always works,
history recall and completion works as expected, etc.
* Results are saved in the Result History.
* Long output is automatically folded so you can focus on what's important.
* Jython and IronPython support makes DreamPie a great tool for
exploring Java and .NET classes.
* You can copy any amount of code and immediately execute it, and you
can also copy code you typed interactively into a new file, with the
Copy Code Only command. No tabs are used!
* Free software licensed under GPL version 3.

Check it out at http://dreampie.sourceforge.net/ and tell me what you think!

Have fun,
Noam
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Pure virtual functions in Python?

2010-02-21 Thread lallous
On Feb 20, 6:08 pm, Martin v. Loewis mar...@v.loewis.de wrote:
  class C1:

       # Pure virtual
       def cb(self, param1, param2):
           
           This is a callback

          �...@param param1: ...
          �...@param param2: ...
           
           raise NotImplementedError, Implement me

  # Dispatcher function that calls 'cb' only if 'cb' is implemented in
  child classes
  def dispatcher(c):
       if hasattr(c, 'cb'):
           c.cb(Hello, World)

  dispatcher(C2())
  dispatcher(C3())

  What I want is the ability to have the dispatcher() not to call 'cb'
  if it was not implemented in one of the child classes.

  Please advise.

  There is nothing more beyond that what you already did. You can raise a
  NotImplementedError for classes that don't implement the method. That's it.

 That's not true. Currently, the hasattr() call would report that cb is
 available, when it is actually not implemented. It would be possible to
 do something like

   if hasattr(c, 'cb') and not is_pure(c.cb):
       c.cb(Hello, World)

 is_pure could, for example, look at a function attribute of the
 callback. You'd write something like

   @pure_virtual
   def cb(self, param1, param2):
       not_implemented

 Regards,
 Martin

Hello Martine,

Can you elaborate more on how to use the mechanism you described?

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


Re: Pure virtual functions in Python?

2010-02-21 Thread lallous
Thanks everyone for the answers.

The dispatcher() is actually sits in C++ code.

So my code receives an object that is an instance of the base class,
it PyObject_GetAttrString(py_obj, 'funcname'). If the attribute exists
I will call PyObject_CallMethod on it.

If the base defines the method and it was empty, then my C++ code
would still call the function. This is not optimal because I don't
want to go from C++ to Python if the _derived_ class does not
implement the cb. Now the base class should define it so that doc
parsers properly describe the base class.

The recipe suggested is not worth the trouble.
Unfortunately I cannot use abc module since I use Python 2.5
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: datelib pythonification

2010-02-21 Thread John Machin
On Feb 21, 12:37 pm, alex goretoy agore...@gmail.com wrote:
 hello all,
     since I posted this last time, I've added a new function dates_diff and

[SNIP]

I'm rather unsure of the context of this posting ... I'm assuming that
the subject datelib pythonification refers to trying to make
datelib more pythonic, with which you appear to need help.

Looking just at the new function (looks like a method to me)
dates_diff, problems include:

1. Mostly ignores PEP-8 about spaces after commas, around operators
2. Checks types
3. Checks types using type(x) == type(y)
4. Inconsistent type checking: checks types in case of
dates_diff(date1, date2) but not in case of dates_diff([date1, date2])
5. Doesn't check for 3 or more args.
6. The 0-arg case is for what purpose?
7. The one-arg case is overkill -- if the caller has the two values in
alist, all you are saving them from is the * in dates_diff(*alist)
8. Calling type(date.today()) once per 2-arg call would be a gross
extravagance; calling it twice per 2-arg call is mind-boggling.
9. start,end=(targs[0][0],targs[0][1]) ... multiple constant
subscripts is a code smell; this one is pongier than usual because it
could easily be replaced by start, end = targs[0]

Untested fix of problems 1, 3, 4, 5, 8, 9:

DATE_TYPE = type(date.today())

def dates_diff(self, *targs):
nargs = len(targs)
if nargs == 0:
return self.enddate - self.startdate
if nargs == 1:
arg = targs[0]
if not isinstance(arg, (list, tuple)) or len(arg) != 2:
raise Exception(
single arg must be list or tuple of length 2)
start, end = arg
elif nargs == 2:
start, end = targs
else:
raise Exception(expected 0,1, or 2 args; found %d % nargs)
if isinstance(start, DATE_TYPE) and isinstance(end, DATE_TYPE):
return end - start
raise Exception(both values must be of type DATE_TYPE)

HTH,

John

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


Re: Pure virtual functions in Python?

2010-02-21 Thread Martin v. Loewis
 That's not true. Currently, the hasattr() call would report that cb is
 available, when it is actually not implemented. It would be possible to
 do something like

   if hasattr(c, 'cb') and not is_pure(c.cb):
   c.cb(Hello, World)

 is_pure could, for example, look at a function attribute of the
 callback. You'd write something like

   @pure_virtual
   def cb(self, param1, param2):
   not_implemented

 Regards,
 Martin
 
 Hello Martine,
 
 Can you elaborate more on how to use the mechanism you described?

There are various ways to do it; the one I had in mind uses function
attributes:

def pure_virtual(func):
  func.pure_virtual = True # only presence of attribute matters,
   # not value
  return func

def is_pure(method): # method might be either a method or a function
  try:
func = method.im_func
  except AttributeError:
func = method
  return hasattr(func, 'pure_virtual')

not_implemented = object() # could also write pass instead, or raise

HTH,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: /usr/bin/ld: cannot find -lz on Cent OS - Python 2.4

2010-02-21 Thread Anssi Saari
V8 NUT olaye1...@googlemail.com writes:

 /usr/bin/ld: cannot find -lz
 collect2: ld returned 1 exit status
 error: command 'gcc' failed with exit status 1

Could it be you're missing zlib-devel? What does yum info zlib-devel
say? Or locate libz?
-- 
http://mail.python.org/mailman/listinfo/python-list


DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Noam Yorav-Raphael
I'm pleased to announce DreamPie 1.0 - a new graphical interactive
Python shell!

Some highlights:

* Has whatever you would expect from a graphical Python shell -
attribute completion, tooltips which show how to call functions,
highlighting of matching parentheses, etc.
* Fixes a lot of IDLE nuisances - in DreamPie interrupt always works,
history recall and completion works as expected, etc.
* Results are saved in the Result History.
* Long output is automatically folded so you can focus on what's
important.
* Jython and IronPython support makes DreamPie a great tool for
exploring Java and .NET classes.
* You can copy any amount of code and immediately execute it, and you
can also copy code you typed interactively into a new file, with the
Copy Code Only command. No tabs are used!
* Free software licensed under GPL version 3.

Check it out at http://dreampie.sourceforge.net/ and tell me what you
think!

Have fun,
Noam
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pure virtual functions in Python?

2010-02-21 Thread Lie Ryan
On 02/21/10 19:27, lallous wrote:
snip
 If the base defines the method and it was empty, then my C++ code
 would still call the function. This is not optimal because I don't
 want to go from C++ to Python if the _derived_ class does not
 implement the cb. 

That sounds like a microoptimization; have you profiled your code and
determined that calling empty function causes a bottleneck? I doubt it.

 Now the base class should define it so that doc
 parsers properly describe the base class.

 The recipe suggested is not worth the trouble.
 Unfortunately I cannot use abc module since I use Python 2.5

Because nobody here could have guessed that your dispatcher was written
in C++; your problem is near trivial if your dispatcher is a pure-python
code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lists of variables

2010-02-21 Thread Lie Ryan
On 02/21/10 15:21, Steven D'Aprano wrote:
  So it looks like variables in a list are stored as object references.
 Python doesn't store variables in lists, it stores objects, always.
 
 Even Python variables aren't variables *grin*, although it's really 
 difficult to avoid using the term. Python variables are mappings between 
 names (strings) and objects, not memory locations.

Actually, no programming languages have used the term variable
correctly, as per its original mathematical definition.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lists of variables

2010-02-21 Thread Steven D'Aprano
On Sat, 20 Feb 2010 23:44:29 -0800, Carl Banks wrote:

 On Feb 20, 10:50 pm, Steven D'Aprano st...@remove-this-
 cybersource.com.au wrote:

 What makes you say that?
[...]
 I don't even understand this.
[...]
 I'm just confused why you think that
 lexical scoping is equivalent to references that can't be put in lists,
 or why you think this behaviour is any different from lexical scoping
 everywhere else?

 http://tinyurl.com/8e7tm

Ha ha ha, very amusing. But I was genuinely confused, because I know 
you're an experienced Python coder and not some n00b, so I thought maybe 
you were referring to something that escaped me. Your response, apt 
though it may be, does nothing to clear up my confusion.

Presumably if you had a serious response you would have made it, so I'll 
chalk it up to a generalised confusion field.

*wink*


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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Aage Andersen
I tried to edit the awfully colors, here are the results:

Traceback (most recent call last):
  File dreampie.py, line 4, module()
  File dreampielib\gui\__init__.pyc, line 972, main()
  File dreampielib\gui\__init__.pyc, line 153, 
__init__(self=DreamPie(path...window_main), 
pyexec='C:\\Python26\\python.exe')
  File dreampielib\gui\__init__.pyc, line 829, 
configure(self=DreamPie(path...window_main))
  File dreampielib\gui\tags.pyc, line 224, 
apply_theme_text(textview=gtk.Tex...xd82038), 
textbuffer=gtk.Tex...xd816d0), theme={('bracket-match', 'bg', 'color'): 
'darkblue', ('bracket-match', 'bg', 'isset'): True, ('bracket-match', 'fg', 
'color'): 'white', ('bracket-match', 'fg', 'isset'): False, ...})
ValueError: unable to parse colour specification

Now the program don't run.

Aage


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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Aage Andersen
I reinstalled and got this message:

Traceback (most recent call last):
  File dreampie.py, line 4, module()
  File dreampielib\gui\__init__.pyc, line 972, main()
  File dreampielib\gui\__init__.pyc, line 153, 
__init__(self=DreamPie(path...window_main), 
pyexec='C:\\Python26\\python.exe')
  File dreampielib\gui\__init__.pyc, line 829, 
configure(self=DreamPie(path...window_main))
  File dreampielib\gui\tags.pyc, line 224, 
apply_theme_text(textview=gtk.Tex...xd82038), 
textbuffer=gtk.Tex...xd816d0), theme={('bracket-match', 'bg', 'color'): 
'darkblue', ('bracket-match', 'bg', 'isset'): True, ('bracket-match', 'fg', 
'color'): 'white', ('bracket-match', 'fg', 'isset'): False, ...})
ValueError: unable to parse colour specification

Aage


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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Noam Yorav-Raphael
Delete \Documents and Settings\username\DreamPie and it should now
work.
Did you edit the colors using the configuration window or manually?
If you edited them using the configuration window, can you give
instructions on how to reproduce the bug?

Noam

On Feb 21, 3:06 pm, Aage Andersen aaan(REMOVE)@email.dk wrote:
 I reinstalled and got this message:

 Traceback (most recent call last):
   File dreampie.py, line 4, module()
   File dreampielib\gui\__init__.pyc, line 972, main()
   File dreampielib\gui\__init__.pyc, line 153,
 __init__(self=DreamPie(path...window_main),
 pyexec='C:\\Python26\\python.exe')
   File dreampielib\gui\__init__.pyc, line 829,
 configure(self=DreamPie(path...window_main))
   File dreampielib\gui\tags.pyc, line 224,
 apply_theme_text(textview=gtk.Tex...xd82038),
 textbuffer=gtk.Tex...xd816d0), theme={('bracket-match', 'bg', 'color'):
 'darkblue', ('bracket-match', 'bg', 'isset'): True, ('bracket-match', 'fg',
 'color'): 'white', ('bracket-match', 'fg', 'isset'): False, ...})
 ValueError: unable to parse colour specification

 Aage

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


Re: Which mock library do you prefer?

2010-02-21 Thread Lacrima
On Feb 18, 3:20 am, Ben Finney ben+pyt...@benfinney.id.au wrote:
 Lacrima lacrima.ma...@gmail.com writes:
  Right, isolation [of test cases] is essential. But I can't decide to
  which extent I should propagate isolation.

 You used “propagate” in a sense I don't understand there.

  For example, in Python Testing: Beginner's Guide by Daniel Arbuckle,
  author suggests that if you do unittesting you should isolate the
  smallest units of code from each other.

 I'm not sure what the author means, but I would say that as it stands
 that advice is independent of what testing is being done. In all cases:

 * Make your code units small, so each one is not doing much and is easy
   to understand.

 * Make the interface of units at each level as narrow as feasible, so
   they're not brittle in the face of changes to the implementation.

  For example, if you have a
  class:
  Class SomeClass(object):
      def method1(self):
          return 5
      def method2(self):
          return self.method1 + 10

  According to the book, if you want to test method2, you should isolate
  it from method1 and class instance('self').

 I don't really know what that means.

 Remember that each test case should not be “test method1”. That is far
 too broad, and in some cases too narrow. There is no one-to-one mapping
 between methods and unit test cases.

 Instead, each test case should test one true-or-false assertion about
 the behaviour of the code. “When we start with this initial state (the
 test fixture), and perform this operation, the resulting state is that”.

 It makes a lot of sense to name the test case so the assertion being
 made *is* its name: not ‘test frobnicate’ with dozens of assertions, but
 one ‘test_frobnicate_with_valid_spangulator_returns_true’ which makes
 that assertion, and extra ones for each distinct assertion.

 The failure of a unit test case should indicate *exactly* what has gone
 wrong. If you want to make multiple assertions about a code unit, write
 multiple test cases for that unit and name the tests accordingly.

 This incidentally requires that you test something small enough that
 such a true-or-false assertion is meaningful, which leads to
 well-designed code with small easily-tested code units. But that's an
 emergent property, not a natural law.

  Currently, I don't create mocks of units if they are within the same
  class with the unit under test. If that is not right approach, please,
  explain what are best practices... I am just learning TDD..

 In the fixture of the unit test case, create whatever test doubles are
 necessary to put your code into the initial state you need for the test
 case; then tear all those down whatever the result of the test case.

 If you need to create great honking wads of fixtures for any test case,
 that is a code smell: your code units are too tightly coupled to
 persistent state, and need to be decoupled with narrow interfaces.

 The Python ‘unittest’ module makes this easier by letting you define
 fixtures common to many test cases (the ‘setUp’ and ‘tearDown’
 interface). My rule of thumb is: if I need to make different fixtures
 for some set of test cases, I write a new test case class for those
 cases.

 --
  \       “Following fashion and the status quo is easy. Thinking about |
   `\        your users' lives and creating something practical is much |
 _o__)                                harder.” —Ryan Singer, 2008-07-09 |
 Ben Finney

Hi, Ben!!!

Sorry for too late reply!!!
Thank you very much for sharing your experience! I still have to grasp
a lot in TDD.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Mensanator
On Feb 21, 3:42�am, Noam Yorav-Raphael noamr...@gmail.com wrote:
 I'm pleased to announce DreamPie 1.0 - a new graphical interactive
 Python shell!

What versions of Python does it suuport?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Mensanator
On Feb 21, 10:30�am, Mensanator mensana...@aol.com wrote:
 On Feb 21, 3:42 am, Noam Yorav-Raphael noamr...@gmail.com wrote: I'm 
 pleased to announce DreamPie 1.0 - a new graphical interactive
  Python shell!

 What versions of Python does it suuport?

What OS are supported?
-- 
http://mail.python.org/mailman/listinfo/python-list


Free chat for u.....hot.hot.....hot..............

2010-02-21 Thread sk raj
http://chattingfree.blogspot.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Chris Colbert
http://dreampie.sourceforge.net/download.html

reading is a wonderful thing.

On Sun, Feb 21, 2010 at 11:32 AM, Mensanator mensana...@aol.com wrote:

 On Feb 21, 10:30�am, Mensanator mensana...@aol.com wrote:
  On Feb 21, 3:42 am, Noam Yorav-Raphael noamr...@gmail.com wrote: I'm
 pleased to announce DreamPie 1.0 - a new graphical interactive
   Python shell!
 
  What versions of Python does it suuport?

 What OS are supported?
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Chris Colbert
This is bloody fantastic! I must say, this fixes everything I hate about
Ipython and gives me the feature I wished it had (with a few minor
exceptions).

I confirm this working on Kubuntu 9.10 using the ppa listed on the sites
download page.

I also confirm that it works interactively with PyQt4 and PyGtk (as to be
expected since these toolkits use the PyOS_inputhook for the mainloop).
However, it does not work interactively with wx (again, this is as expected
since wx doesn't use the PyOS_inputhook). In short, the gui toolkit support
is the same as in Ipython if you dont use any of the magic threading
switches, which are now deprecated anyway.

Matplotlib does not work interactively for me. Is there a special switch
that needs to be used? or should a pick a non-wx backend? (i'm thinking the
latter is more likely)

A couple of things I would like to see (and will help implement if I can
find the time):
1) A shortcut to show the docstring of an object. Something like Ipython's
`?`. i.e.  `object.foo?` translates to `help(object.foo)`
2) How do I change the color of the blinking cursor at the bottom? I can't
see the damn thing!
3) line numbers instead of the `` prompt
4) a plugin facility where we can define our own `magic` commands. I use
Ipython's %timeit ALL the time.
5) Double-click to re-fold the output section as well.

Thanks for making this

Cheers,

Chris


On Sun, Feb 21, 2010 at 4:42 AM, Noam Yorav-Raphael noamr...@gmail.comwrote:

 I'm pleased to announce DreamPie 1.0 - a new graphical interactive
 Python shell!

 Some highlights:

 * Has whatever you would expect from a graphical Python shell -
 attribute completion, tooltips which show how to call functions,
 highlighting of matching parentheses, etc.
 * Fixes a lot of IDLE nuisances - in DreamPie interrupt always works,
 history recall and completion works as expected, etc.
 * Results are saved in the Result History.
 * Long output is automatically folded so you can focus on what's
 important.
 * Jython and IronPython support makes DreamPie a great tool for
 exploring Java and .NET classes.
 * You can copy any amount of code and immediately execute it, and you
 can also copy code you typed interactively into a new file, with the
 Copy Code Only command. No tabs are used!
 * Free software licensed under GPL version 3.

 Check it out at http://dreampie.sourceforge.net/ and tell me what you
 think!

 Have fun,
 Noam
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Saving the Interactive Window with PythonWin

2010-02-21 Thread vsoler
Hi everyone,

When I run a python script, I know that I can print the results of my
calculations on the Interactive Window. Once the scripts ends, I can
copy/pate these results on an OpenOffice Writer document.

However, I would like to know if I can somehow add some lines to my
script, so that it saves the Interactive Window to a text file. How
could it be done?

And, is there a way to programatically clear out the Interactive
Window so that it only shows the last run?

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Iuri
I tested it in Windows Vista.

When I type single or double quotes, I get a unicode character, different of
python's quotes, and it break my code.

But i liked this tool! Thanks!

[]s
iuri



On Sun, Feb 21, 2010 at 3:13 PM, Chris Colbert sccolb...@gmail.com wrote:

 This is bloody fantastic! I must say, this fixes everything I hate about
 Ipython and gives me the feature I wished it had (with a few minor
 exceptions).

 I confirm this working on Kubuntu 9.10 using the ppa listed on the sites
 download page.

 I also confirm that it works interactively with PyQt4 and PyGtk (as to be
 expected since these toolkits use the PyOS_inputhook for the mainloop).
 However, it does not work interactively with wx (again, this is as expected
 since wx doesn't use the PyOS_inputhook). In short, the gui toolkit support
 is the same as in Ipython if you dont use any of the magic threading
 switches, which are now deprecated anyway.

 Matplotlib does not work interactively for me. Is there a special switch
 that needs to be used? or should a pick a non-wx backend? (i'm thinking the
 latter is more likely)

 A couple of things I would like to see (and will help implement if I can
 find the time):
 1) A shortcut to show the docstring of an object. Something like Ipython's
 `?`. i.e.  `object.foo?` translates to `help(object.foo)`
 2) How do I change the color of the blinking cursor at the bottom? I can't
 see the damn thing!
 3) line numbers instead of the `` prompt
 4) a plugin facility where we can define our own `magic` commands. I use
 Ipython's %timeit ALL the time.
 5) Double-click to re-fold the output section as well.

 Thanks for making this

 Cheers,

 Chris


 On Sun, Feb 21, 2010 at 4:42 AM, Noam Yorav-Raphael noamr...@gmail.comwrote:

 I'm pleased to announce DreamPie 1.0 - a new graphical interactive
 Python shell!

 Some highlights:

 * Has whatever you would expect from a graphical Python shell -
 attribute completion, tooltips which show how to call functions,
 highlighting of matching parentheses, etc.
 * Fixes a lot of IDLE nuisances - in DreamPie interrupt always works,
 history recall and completion works as expected, etc.
 * Results are saved in the Result History.
 * Long output is automatically folded so you can focus on what's
 important.
 * Jython and IronPython support makes DreamPie a great tool for
 exploring Java and .NET classes.
 * You can copy any amount of code and immediately execute it, and you
 can also copy code you typed interactively into a new file, with the
 Copy Code Only command. No tabs are used!
 * Free software licensed under GPL version 3.

 Check it out at http://dreampie.sourceforge.net/ and tell me what you
 think!

 Have fun,
 Noam
 --
 http://mail.python.org/mailman/listinfo/python-list



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


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


Re: Not sure why this is filling my sys memory

2010-02-21 Thread Vincent Davis
@sstein...@gmail.com sstein...@gmail.com
See this article for some more info about the reported sizes of things:
http://www.doughellmann.com/PyMOTW/sys/limits.html;

I posted this question on stack overflow. I now have a better appreciation
of ssteinerX suggestions of the above link and guppy, I also had pympler
suggested.

http://stackoverflow.com/questions/2306523/reading-text-files-into-list-then-storing-in-dictionay-fills-system-memory-a


Thanks again


  *Vincent Davis
720-301-3003 *
vinc...@vincentdavis.net
 my blog http://vincentdavis.net |
LinkedInhttp://www.linkedin.com/in/vincentdavis


On Sat, Feb 20, 2010 at 7:15 PM, sstein...@gmail.com sstein...@gmail.comwrote:


 On Feb 20, 2010, at 8:05 PM, Vincent Davis wrote:

 Code is below, The files are about 5mb and 230,000 rows. When I have 43
 files of them and when I get to the 35th (reading it in) my system gets so
 slow that it is nearly functionless. I am on a mac and activity monitor
 shows that python is using 2.99GB of memory (of 4GB). (python 2.6 64bit).
 The getsizeof() returns 6424 bytes for the alldata . So I am not sure what
 is happening.


 See this article for some more info about the reported sizes of things:
 http://www.doughellmann.com/PyMOTW/sys/limits.html

 S


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


formatting a number as percentage

2010-02-21 Thread vsoler
I'm trying to print .7 as 70%
I've tried:

print format(.7,'%%')
.7.format('%%')

but neither works. I don't know what the syntax is...

Can you help?

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread sstein...@gmail.com

On Feb 21, 2010, at 11:51 AM, Chris Colbert wrote:

 http://dreampie.sourceforge.net/download.html
 
 reading is a wonderful thing.

I got it running on OS X with MacPorts after about an hour of installing 
everything required for gtk and gtksourceview (including a new gcc, apparently).

Now...if I can just figure out how to set the font to something I can actually 
read both size and anti-alias-wise.

S


 
 On Sun, Feb 21, 2010 at 11:32 AM, Mensanator mensana...@aol.com wrote:
 On Feb 21, 10:30�am, Mensanator mensana...@aol.com wrote:
  On Feb 21, 3:42 am, Noam Yorav-Raphael noamr...@gmail.com wrote: I'm 
  pleased to announce DreamPie 1.0 - a new graphical interactive
   Python shell!
 
  What versions of Python does it suuport?
 
 What OS are supported?
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

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


Re: formatting a number as percentage

2010-02-21 Thread Chris Colbert
 print('%.0f%%' % (0.7*100))
70%

On Sun, Feb 21, 2010 at 12:53 PM, vsoler vicente.so...@gmail.com wrote:

 I'm trying to print .7 as 70%
 I've tried:

 print format(.7,'%%')
 .7.format('%%')

 but neither works. I don't know what the syntax is...

 Can you help?

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

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


Re: formatting a number as percentage

2010-02-21 Thread TomF

On 2010-02-21 09:53:45 -0800, vsoler vicente.so...@gmail.com said:

I'm trying to print .7 as 70%
I've tried:

print format(.7,'%%')
.7.format('%%')

but neither works. I don't know what the syntax is...



print Grade is {0:%}.format(.87)

Grade is 87.00%

or if you want to suppress those trailing zeroes:


print Grade is {0:.0%}.format(.87)

Grade is 87%

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Paul Boddie
On 21 Feb, 17:32, Mensanator mensana...@aol.com wrote:
 On Feb 21, 10:30 am, Mensanator mensana...@aol.com wrote:

  What versions of Python does it suuport?

 What OS are supported?

From the Web site referenced in the announcement (http://
dreampie.sourceforge.net/):


# Supports Python 2.5, Python 2.6, Jython 2.5, IronPython 2.6 and
Python 3.1.
# Works on Windows and Linux.


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


Re: formatting a number as percentage

2010-02-21 Thread Mark Dickinson
On Feb 21, 5:53 pm, vsoler vicente.so...@gmail.com wrote:
 I'm trying to print .7 as 70%
 I've tried:

 print format(.7,'%%')
 .7.format('%%')

 but neither works. I don't know what the syntax is...

Assuming that you're using Python 2.6 (or Python 3.x):

 format(.7, '%')
'70.00%'
 format(.7, '.2%')
'70.00%'

Or see TomF's response for how to use this with the str.format method.

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


Re: formatting a number as percentage

2010-02-21 Thread vsoler
On Feb 21, 7:11 pm, TomF tomf.sess...@gmail.com wrote:
 On 2010-02-21 09:53:45 -0800, vsoler vicente.so...@gmail.com said:

  I'm trying to print .7 as 70%
  I've tried:

  print format(.7,'%%')
  .7.format('%%')

  but neither works. I don't know what the syntax is...
  print Grade is {0:%}.format(.87)

 Grade is 87.00%

 or if you want to suppress those trailing zeroes:

  print Grade is {0:.0%}.format(.87)

 Grade is 87%

Excellent, works perfect!!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-21 Thread John Bokma
Jonathan Gardner jgard...@jonathangardner.net writes:

 On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan lie.1...@gmail.com wrote:

 Now, why don't we start a PEP to make python a fully-functional language
 then?

 Because people don't think the same way that programs are written in
 functional languages.

Heh! When I learned Miranda it felt natural to me. Prolog on the other
hand...

In short: I am afraid you're overgeneralizing here; it depends on one's
background. If not, citation needed ;-)

-- 
John Bokma   j3b

Hacking  Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl  Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The future of frozen types as the number of CPU cores increases

2010-02-21 Thread Paul Boddie
On 21 Feb, 03:00, sjdevn...@yahoo.com sjdevn...@yahoo.com wrote:
 On Feb 18, 2:58 pm, John Nagle na...@animats.com wrote:

      Multiple processes are not the answer.  That means loading multiple
  copies of the same code into different areas of memory.  The cache
  miss rate goes up accordingly.

 A decent OS will use copy-on-write with forked processes, which should
 carry through to the cache for the code.

True, but the principal issue with CPython and copy-on-write is the
reference counting. Consider a large list shared with the child
processes which is to be processed (either in part or in its entirety)
by each of them. As soon as the child processes start referencing each
of the elements, the reference count for each element object will need
to be changed and pages will start to be copied for each child
process. That's why John wants to avoid the reference counting of
shared data and why the Unladen Swallow project has apparently
considered storing reference counts in separate regions of memory.

Such shared data is really owned by the parent process, so it makes
little sense for the child processes to manage it with a view to
collecting it later. After all, such data should have no cost to each
of the child processes (except, perhaps, for the size of the address
space referenced by each process, and any resource issues arising from
managing that).

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


Re: formatting a number as percentage

2010-02-21 Thread Günther Dietrich
vsoler vicente.so...@gmail.com wrote:

I'm trying to print .7 as 70%
I've tried:

print format(.7,'%%')
.7.format('%%')

but neither works. I don't know what the syntax is...

Did you try this:

 print('%d%%' % (0.7 * 100))
70%



Best regards,

Günther
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient way to break up a list into two pieces

2010-02-21 Thread marwie
On 21 Feb., 04:40, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:

 Additionally, Python lists are over-allocated so that appends are fast. A
 list of (say) 1000 items might be over-allocated to (say) 1024 items, so
 that you can do 24 appends before the array is full and the array needs
 to be resized. This means that, on average, Python list appending is O(1)
 instead of O(N). You can't just change the length blindly, you need to
 worry about the over-allocation.

Ok, I see your point. However, other data representation might still
be able to optimize such a multi-element pop. I'm thinking of deques,
for example.

 I'm sympathetic to your concern: I've often felt offended that doing
 something like this:

 x = SomeReallyBigListOrString
 for item in x[1:]:
     process(item)

 has to copy the entire list or string (less the first item). But
 honestly, I've never found a situation where it actually mattered.

Good grief, it copies that, too? I assumed that the copying is at
least delayed until the assignment and that x[1:] is represented by
some wrapper that just shuffles the indices around (much like
the .indices method that MRAB suggested).

Maybe copying chunks of data really isn't that much of an issue as it
used to be (and maybe I'm getting old). The application I have in mind
has to do with symbolic computation, and expressions would be
represented by python lists. It's too early to do any profiling (in
fact, it's at the deciding if python is the right language to
implement it stage), but it will have to handle expressions with many
terms (i.e. long lists), and in the end taking these lists apart and
putting them back together in different order is the only thing the
code will do. That to explain my interest in performance issues
related to pyhton lists.

Anyway, thanks for your help.
Martin.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient way to break up a list into two pieces

2010-02-21 Thread marwie
On 21 Feb., 07:38, Carl Banks pavlovevide...@gmail.com wrote:
 Numpy arrays can share underlying data like that when you take
 slices.  For instance, this probably works the way you want:

 a = numpy.array([1,2,3,4,5,6])
 b = a[:3]
 c = a[3:]

 None of the actual data was copied here.

Hmm, that might be worth looking into. Thanks.

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


Re: Efficient way to break up a list into two pieces

2010-02-21 Thread MRAB

MRAB wrote:

Steven D'Aprano wrote:
[snip]
I'm sympathetic to your concern: I've often felt offended that doing 
something like this:


x = SomeReallyBigListOrString
for item in x[1:]:
process(item)

has to copy the entire list or string (less the first item). But 
honestly, I've never found a situation where it actually mattered.



[snip]
Could lists gain an .items() method with start and end positions? I was
thinking that it would be a 'view', like with dicts in Python 3. Of
course, that would only be worthwhile with very long lists:

x = SomeReallyBigListOrString
for item in x.items(1):
process(item)


Actually, my example is a bit wrong! My suggestion should have said that
the arguments of list.items would resemble those of range:

x = SomeReallyBigListOrString
for item in x.items(1, None): # [1 : None], or just [1 : ]
process(item)

Having a third 'stride' argument would also be possible.
--
http://mail.python.org/mailman/listinfo/python-list


FOREX : Foreign Exchange Market : FX : Currency Market : Earn Money Quickly.

2010-02-21 Thread MY NAME IS MY NAME
FOREX : Foreign Exchange Market : FX : Currency Market : Earn Money
Quickly.

Simple Optimized Tips and Tricks, Basics of FOREX to be a king of
FOREX in one day.

Check out these exclusive never seen tips for free at

http://forex-fx-currencymarket.blogspot.com/2010/02/forex-market-size-and-liquidity-showing.html


Contents Overview :

FOREX : Market Size and Liquidity Showing Top 10 Currency Traders
FOREX : Speculation of Currency
FOREX : Instruments Financially including Transactions
FOREX : FX Rates Determinants as per Government
FOREX : Trading Characteristics and Trading Centers
FOREX : Market Participants with Access Levels
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How would I do a continuous write over a pipe in the following code...

2010-02-21 Thread Chris Rebert
On Sun, Feb 21, 2010 at 1:09 PM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
 On Sat, 20 Feb 2010 12:46:24 -0800 (PST), chad cdal...@gmail.com
 declaimed the following in comp.lang.python:

 Given the following

 #!/usr/bin/python

 import subprocess as s

 broadcast = s.Popen(echo test | wall, shell=True,stdout=s.PIPE)

 out = broadcast.stdout
 while 1:
     out

        Does nothing... out is a name bound to the object identified by
 broadcast.stdout...

        It does nothing unless it is called as...

        out(somedata)

I'm pretty sure you meant:

out.write(somedata)

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Martin v. Loewis
John Nagle wrote:
I know there's a performance penalty for running Python on a
 multicore CPU, but how bad is it?  I've read the key paper
 (www.dabeaz.com/python/GIL.pdf), of course.  It would be adequate
 if the GIL just limited Python to running on one CPU at a time,
 but it's worse than that; there's excessive overhead due to
 a lame locking implementation.  Running CPU-bound multithreaded
 code on a dual-core CPU runs HALF AS FAST as on a single-core
 CPU, according to Beasley.

I couldn't reproduce these results on Linux. Not sure what HALF AS
FAST is; I suppose it means it runs TWICE AS LONG - this is what I
couldn't reproduce.

If I run Beazley's program on Linux 2.6.26, on a 4 processor Xeon (3GHz)
machine, I get 30s for the sequential execution, 40s for the
multi-threaded case, and 32s for the multi-threaded case when pinning
the Python process to a single CPU (using taskset(1)).

So it's 6% overhead for threading, and 25% penalty for multicore CPUs -
far from the 100% you seem to expect.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient way to break up a list into two pieces

2010-02-21 Thread Steve Howell
On Feb 20, 5:55 pm, marwie mar...@gmx.de wrote:
 On 21 Feb., 02:30, Steven D'Aprano st...@remove-this-

 cybersource.com.au wrote:
  Python lists are arrays of pointers to objects, so copying a slice is
  fast: it doesn't have to copy the objects, just pointers. Deleting from
  the end of the list is also quick, because you don't have to move memory,
  just clear some pointers and change the length field.

  Splitting such an array without copying data is, essentially, impossible.
  Python lists aren't linked lists.

 Well, to split a C array I would simply set l2 to point to l1[10] and
 then
 change the length of l1 (which I store somewhere else). No copying of
 elements
 needed. I would have assumed that python can do something like this
 with its
 internal arrays of pointers, too.


When you remove 10 elements off of a list of size 1000, none of the
objects themselves are moved, but the pointers to the objects are all
moved, so k*990 bytes get moved backward, where k is the size of a
pointer (4 or 8 typically on modern computers).

There is no mechanism to advance a pointer forward when you delete or
pop from the top.

I proposed the following patch to implement an advance-the-pointer
scheme, but it is unlikely to be accepted in the near future:

http://bugs.python.org/file16034/no_mem_penalty.diff

http://bugs.python.org/issue7784

You can find alternative data structures that might serve your needs
better, such as collections.deque.

If you are interested in how Python lists work internally, you mostly
want to look at listobject.c:

  http://svn.python.org/view/python/trunk/Objects/listobject.c?view=markup

In particular, look at list_resize(), list_slice(), and
list_ass_slice().

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Mensanator
On Feb 21, 12:14 pm, Paul Boddie p...@boddie.org.uk wrote:
 On 21 Feb, 17:32, Mensanator mensana...@aol.com wrote:

  On Feb 21, 10:30 am, Mensanator mensana...@aol.com wrote:

   What versions of Python does it suuport?

  What OS are supported?

 From the Web site referenced in the announcement (http://
 dreampie.sourceforge.net/):

 
 # Supports Python 2.5, Python 2.6, Jython 2.5, IronPython 2.6 and
 Python 3.1.
 # Works on Windows and Linux.
 

Yeah, I saw that. Funny that something important like that wasn't part
of the
announcement. I notice no mention of Mac OS, so visiting the website
was a complete
waste of time on my part, wasn't it?

 Paul

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


Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Ryan Kelly
On Sun, 2010-02-21 at 22:22 +0100, Martin v. Loewis wrote:
 John Nagle wrote:
 I know there's a performance penalty for running Python on a
  multicore CPU, but how bad is it?  I've read the key paper
  (www.dabeaz.com/python/GIL.pdf), of course.  It would be adequate
  if the GIL just limited Python to running on one CPU at a time,
  but it's worse than that; there's excessive overhead due to
  a lame locking implementation.  Running CPU-bound multithreaded
  code on a dual-core CPU runs HALF AS FAST as on a single-core
  CPU, according to Beasley.
 
 I couldn't reproduce these results on Linux. Not sure what HALF AS
 FAST is; I suppose it means it runs TWICE AS LONG - this is what I
 couldn't reproduce.
 
 If I run Beazley's program on Linux 2.6.26, on a 4 processor Xeon (3GHz)
 machine, I get 30s for the sequential execution, 40s for the
 multi-threaded case, and 32s for the multi-threaded case when pinning
 the Python process to a single CPU (using taskset(1)).
 
 So it's 6% overhead for threading, and 25% penalty for multicore CPUs -
 far from the 100% you seem to expect.

It's far from scientific, but I've seen behaviour that's close to a 100%
performance penalty on a dual-core linux system:

   http://www.rfk.id.au/blog/entry/a-gil-adventure-threading2

Short story:  a particular test suite of mine used to run in around 25
seconds, but a bit of ctypes magic to set thread affinity dropped the
running time to under 13 seconds.


  Cheers,

 Ryan

-- 
Ryan Kelly
http://www.rfk.id.au  |  This message is digitally signed. Please visit
r...@rfk.id.au|  http://www.rfk.id.au/ramblings/gpg/ for details



signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Use eval() safely?

2010-02-21 Thread W. Martin Borgert
Hi,

I know that this issue has been discussed before, but most of
the time using only one argument to eval().

Is it possible to use the following code, e.g. run as part of a
web application, to break in and if so, how?

import math

def myeval(untrustedinput):
return eval(untrustedinput, {__builtins__: None},
{ abs: abs, sin: math.sin })

Is it possible to define functions or import modules from the
untrusted input string?

Which Python built-ins and math functions would I have to add to
the functions dictionary to make it unsafe?

TIA! (Please cc me, thanks.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lists of variables

2010-02-21 Thread bartc


Michael Pardee python-l...@open-sense.com wrote in message 
news:mailman.22.1266722722.4577.python-l...@python.org...
I'm relatively new to python and I was very surprised by the following 
behavior:



a=1
b=2
mylist=[a,b]
print mylist

[1, 2]

a=3
print mylist

[1, 2]

Whoah!  Are python lists only for literals?  Nope:


c={}
d={}
mydlist=[c,d]
print mydlist

[{}, {}]

c['x']=1
print mydlist

[{'x': 1}, {}]

So it looks like variables in a list are stored as object references.
This seems to confirm that:

mydlist[1]['y']=4

print mydlist

[{}, {'y': 4}]

So I figure my initial example doesn't work because if you assign a


That shows a different outlook. I would have said your first example works 
as expected and it was the second example that was strange, possibly due to 
shallow instead of deep copies by Python.


--
Bartc 


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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread sstein...@gmail.com

On Feb 21, 2010, at 4:40 PM, Mensanator wrote:

 On Feb 21, 12:14 pm, Paul Boddie p...@boddie.org.uk wrote:
 On 21 Feb, 17:32, Mensanator mensana...@aol.com wrote:
 
 On Feb 21, 10:30 am, Mensanator mensana...@aol.com wrote:
 
 What versions of Python does it suuport?
 
 What OS are supported?
 
 From the Web site referenced in the announcement (http://
 dreampie.sourceforge.net/):
 
 
 # Supports Python 2.5, Python 2.6, Jython 2.5, IronPython 2.6 and
 Python 3.1.
 # Works on Windows and Linux.
 
 
 Yeah, I saw that. Funny that something important like that wasn't part
 of the
 announcement. I notice no mention of Mac OS, so visiting the website
 was a complete
 waste of time on my part, wasn't it?

See my earlier message -- I have it running just fine on 10.6 with MacPorts and 
even managed to report a bug!

S


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

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


Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Martin v. Loewis
 It's far from scientific, but I've seen behaviour that's close to a 100%
 performance penalty on a dual-core linux system:
 
http://www.rfk.id.au/blog/entry/a-gil-adventure-threading2
 
 Short story:  a particular test suite of mine used to run in around 25
 seconds, but a bit of ctypes magic to set thread affinity dropped the
 running time to under 13 seconds.

Indeed, it's not scientific - but with a few more details, you could
improve it quite a lot: what specific Linux distribution (the posting
doesn't even say it's Linux), what specific Python version had you been
using? (less important) what CPUs? If you can: what specific test suite?

A lot of science is about repeatability. Making a systematic study is
(IMO) over-valued - anecdotal reports are useful, too, as long as they
allow for repeatable experiments.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Ryan Kelly
On Sun, 2010-02-21 at 23:05 +0100, Martin v. Loewis wrote: 
  It's far from scientific, but I've seen behaviour that's close to a 100%
  performance penalty on a dual-core linux system:
  
 http://www.rfk.id.au/blog/entry/a-gil-adventure-threading2
  
  Short story:  a particular test suite of mine used to run in around 25
  seconds, but a bit of ctypes magic to set thread affinity dropped the
  running time to under 13 seconds.
 
 Indeed, it's not scientific - but with a few more details, you could
 improve it quite a lot: what specific Linux distribution (the posting
 doesn't even say it's Linux), what specific Python version had you been
 using? (less important) what CPUs? If you can: what specific test suite?

I'm on Ubuntu Karmic, Python 2.6.4, an AMD Athlon 7750 dual core.

Unfortunately the test suite is for a proprietary application.  I've
been able to reproduce similar behaviour with an open-source test suite,
using the current trunk of the pyfilesystem project:

  http://code.google.com/p/pyfilesystem/


In this project OSFS is an object-oriented interface to the local
filesystem.  The test case TestOSFS.test_cases_in_separate_dirs runs
three theads, each doing a bunch of IO in a different directory.

Running the tests normally:

r...@durian:/storage/software/fs$ nosetests 
fs/tests/test_fs.py:TestOSFS.test_cases_in_separate_dirs
.
--
Ran 1 test in 9.787s


That's the best result from five runs - I saw it go as high as 12
seconds.  Watching it in top, I see CPU usage at around 150%.

Now using threading2 to set the process cpu affinity at the start of the
test run:

r...@durian:/storage/software/fs$ nosetests 
fs/tests/test_fs.py:TestOSFS.test_cases_in_separate_dirs
.
--
Ran 1 test in 3.792s


Again, best of five.  The variability in times here is much lower - I
never saw it go above 4 seconds.  CPU usage is consistently 100%.



  Cheers,

 Ryan


-- 
Ryan Kelly
http://www.rfk.id.au  |  This message is digitally signed. Please visit
r...@rfk.id.au|  http://www.rfk.id.au/ramblings/gpg/ for details




signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: with statement and standard library

2010-02-21 Thread John Nagle

nobrowser wrote:

Hi.  The with statement is certainly nifty.  The trouble is, the
*only* two documented examples how it can be used with the library
classes are file objects (which I use all the time) and thread locks
which I almost never use.  Yet there are many, many classes in the
library whose use would be more elegant and readable if the with
statement could be employed.  Start with the connection objects in
httplib and you can probably come up with 10 others easily. 


   with is important for locks because it matters when they're
released.  It's not as important if release is just resource
recovery.  Reference counting will recover most objects when they
go out of scope anyway.

   Don't get carried away just because a new feature is available.

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


Re: with statement and standard library

2010-02-21 Thread Chris Rebert
On Sun, Feb 21, 2010 at 3:21 PM, John Nagle na...@animats.com wrote:
 nobrowser wrote:

 Hi.  The with statement is certainly nifty.  The trouble is, the
 *only* two documented examples how it can be used with the library
 classes are file objects (which I use all the time) and thread locks
 which I almost never use.  Yet there are many, many classes in the
 library whose use would be more elegant and readable if the with
 statement could be employed.  Start with the connection objects in
 httplib and you can probably come up with 10 others easily.

   with is important for locks because it matters when they're
 released.  It's not as important if release is just resource
 recovery.  Reference counting will recover most objects when they
 go out of scope anyway.

If you're using CPython that is. The other implementations don't use
refcounting and thus don't guarantee the GC will be that timely.
So if one wants maximum portability, the `with` statement is *quite* useful.

Not to mention there are other uses for `with` besides just freeing
resources; e.g. setting a temporary decimal arithmetic context.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient way to break up a list into two pieces

2010-02-21 Thread Steven D'Aprano
On Sun, 21 Feb 2010 11:07:24 -0800, marwie wrote:

 x = SomeReallyBigListOrString
 for item in x[1:]:
     process(item)

 has to copy the entire list or string (less the first item). But
 honestly, I've never found a situation where it actually mattered.
 
 Good grief, it copies that, too? I assumed that the copying is at least
 delayed until the assignment and that x[1:] is represented by some
 wrapper that just shuffles the indices around (much like the .indices
 method that MRAB suggested).

Such complexity doesn't happen for free. It costs developer time, more 
complexity means more bugs, and more runtime overhead, especially for 
small lists. 99.9% of programs operate on small amounts of data, and 
small gets bigger every year.

(I was reading one of my old Uni text books the other day, and one of the 
projects was an application to index all the words in a text file. The 
author decided to use disk storage rather than in-memory data structures 
because he was hoping to read files up to 60,000 words, and considered it 
unlikely that any PCs would have enough memory to store 60,000 words!)

Unless you actually profile the code, you're as likely to be *slowing 
Python down* by such extra sophistication as you are to speed it up. 
Copying blocks of pointers is really fast on modern CPUs.

As a general rule, Python aims for simplicity of implementation rather 
than clever, but fragile, tricks.


 Maybe copying chunks of data really isn't that much of an issue as it
 used to be (and maybe I'm getting old). The application I have in mind
 has to do with symbolic computation, and expressions would be
 represented by python lists. It's too early to do any profiling (in
 fact, it's at the deciding if python is the right language to implement
 it stage), but it will have to handle expressions with many terms (i.e.
 long lists), and in the end taking these lists apart and putting them
 back together in different order is the only thing the code will do.


Are you likely to have expressions with a hundred or so MILLION terms?

If so, then you should start thinking about clever tricks to minimise 
copying. Otherwise, you're engaged in premature optimization, which is 
the root of all computer science evil :)



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


Re: lists of variables

2010-02-21 Thread Gregory Ewing

Steven D'Aprano wrote:

On Sat, 20 Feb 2010 22:31:44 -0800, Carl Banks wrote:


The one place where Python does have references is when accessing
variables in an enclosing scope (not counting module-level).  


What makes you say that?


I think Carl is talking about cells, which *are* actually objects
(in CPython at least), but they're internal details of the
interpreter, and you can't do anything useful with them from
Python code.

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Steven D'Aprano
On Sun, 21 Feb 2010 13:40:54 -0800, Mensanator wrote:

 Yeah, I saw that. Funny that something important like that wasn't part
 of the
 announcement. I notice no mention of Mac OS, so visiting the website was
 a complete
 waste of time on my part, wasn't it?

Of course not. Now you know that Mac OS isn't officially supported, so 
you're less ignorant than you were before you went to the website.

But since Dreampie is written in Python, it shouldn't be that hard to 
have it run on Mac OS, provided you can get the GUI tool kit it requires.



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


Re: Pure virtual functions in Python?

2010-02-21 Thread Gregory Ewing

lallous wrote:

If the base defines the method and it was empty, then my C++ code
would still call the function. This is not optimal because I don't
want to go from C++ to Python if the _derived_ class does not
implement the cb.


I would simply not implement the method at all in the base
class. Then the C++ code can do an attribute lookup for
the method, and if it's not found, do nothing.

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


Re: Use eval() safely?

2010-02-21 Thread Steven D'Aprano
On Sun, 21 Feb 2010 22:25:11 +0100, W. Martin Borgert wrote:

 Hi,
 
 I know that this issue has been discussed before, but most of the time
 using only one argument to eval().
 
 Is it possible to use the following code, e.g. run as part of a web
 application, to break in and if so, how?
 
 import math
 
 def myeval(untrustedinput):
 return eval(untrustedinput, {__builtins__: None},
 { abs: abs, sin: math.sin })
 
 Is it possible to define functions or import modules from the untrusted
 input string?
 
 Which Python built-ins and math functions would I have to add to the
 functions dictionary to make it unsafe?

You've got the right idea, but the task is difficult.

Please read this thread:

http://tav.espians.com/a-challenge-to-break-python-security.html



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


Problem creating executable, with PyQwt

2010-02-21 Thread Gib Bogle
My student is trying to build an executable version of a program that uses PyQt 
and PyQwt, on Windows XP.  She has installed: Python 2.6.1, Qt 4.5.0, PyQt 4.5, 
and PyQwt 5.2.0.  There is a module error on running the executable produced by 
py2exe.  Here is the info I got from my student:


quote

Traceback (most recent call last):
  File ABM15.pyw, line 15, in module
  File PyQt4\Qwt5\__init__.pyc, line 32, in module
  File PyQt4\Qwt5\Qwt.pyc, line 12, in module
  File PyQt4\Qwt5\Qwt.pyc, line 10, in __load
ImportError: No module named QtSvg


If you Google this last line, you'll find that I've posted this to a forum, but 
no one answered me. Someone has also had this problem before, although I think 
they were using PyInstaller and not py2exe. They say that its because Qwt has a 
hidden import for QtSvg. If I can turn this off, maybe it'll work, but I don't 
know how.


I have downloaded py2exe and I run the attached setup.py file in my working 
directory. It creates two directories: 'dist' and 'build'. An executable is 
created in the 'dist' directory along with other things. When I tried running 
it, it produces a log file, in which I find the error messages.


\quote

Perhaps someone can recognize these symptoms.

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


Re: Is there a way to continue after an exception ?

2010-02-21 Thread Stef Mientki

On 21-02-2010 03:51, Ryan Kelly wrote:

On Sun, 2010-02-21 at 13:17 +1100, Lie Ryan wrote:
   

On 02/21/10 12:02, Stef Mientki wrote:
 

On 21-02-2010 01:21, Lie Ryan wrote:
   

On Sun, Feb 21, 2010 at 12:52 AM, Stef Mientki
   

stef.mien...@gmail.com  wrote:
 
   

hello,

I would like my program to continue on the next line after an uncaught
exception,
is that possible ?

thanks
Stef Mientki


 

That reminds me of VB's On Error Resume Next

 

I think that's what I'm after ...
   

A much better approach is to use callbacks, the callbacks determines
whether to raise an exception or continue execution:

def handler(e):
 if datetime.datetime.now()= datetime.datetime(2012, 12, 21):
 raise Exception('The world has ended')
 # else: ignore, it's fine

def add_ten_error_if_zero(args, handler):
 if args == 0:
 handler(args)
 return args + 10

print add_ten_error_if_zero(0, handler)
print add_ten_error_if_zero(10, handler)
print add_ten_error_if_zero(0, lambda e: None) # always succeeds
 


Or if you don't like having to explicitly manage callbacks, you can try
the withrestart module:

 http://pypi.python.org/pypi/withrestart/

It tries to pinch some of the good ideas from Common Lisp's
error-handling system.

   from withrestart import *

   def add_ten_error_if_zero(n):
   #  This gives calling code the option to ignore
   #  the error, or raise a different one.
   with restarts(skip,raise_error):
   if n == 0:
   raise ValueError
   return n + 10

   # This will raise ValueError
   print add_ten_error_if_zero(0)

   # This will print 10
   with Handler(ValueError,skip):
   print add_ten_error_if_zero(0)

   # This will exit the python interpreter
   with Handler(ValueError,raise_error,SystemExit):
   print add_ten_error_if_zero(0)



   Cheers,

   Ryan


   

thanks Ryan (and others),

your description of withstart  was very informative,
and I think I understand why it's impossible what I want
(something like madExcept for Delphi / C / C++, see
*http://www.madshi.net/madExceptDescription.htm )
*
It are not the bugs that you can predict / expect to catch,
but the uncaught bugs.

So made some first steps,
and this seems to be sufficient for now,
if you're interested, look here,
  http://mientki.ruhosting.nl/data_www/pylab_works/pw_bug_reporter.html

cheers,
Stef



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


Re: Problem creating executable, with PyQwt

2010-02-21 Thread David Boddie
On Monday 22 February 2010 01:17, Gib Bogle wrote:

 quote
 
  Traceback (most recent call last):
File ABM15.pyw, line 15, in module
File PyQt4\Qwt5\__init__.pyc, line 32, in module
File PyQt4\Qwt5\Qwt.pyc, line 12, in module
File PyQt4\Qwt5\Qwt.pyc, line 10, in __load
  ImportError: No module named QtSvg
 
 If you Google this last line, you'll find that I've posted this to a
 forum, but no one answered me. Someone has also had this problem before,
 although I think they were using PyInstaller and not py2exe. They say that
 its because Qwt has a hidden import for QtSvg. If I can turn this off,
 maybe it'll work, but I don't know how.
 
 I have downloaded py2exe and I run the attached setup.py file in my
 working directory. It creates two directories: 'dist' and 'build'. An
 executable is created in the 'dist' directory along with other things.
 When I tried running it, it produces a log file, in which I find the error
 messages.
 
 \quote
 
 Perhaps someone can recognize these symptoms.

Someone asked this question on the PyQt mailing list, too:

  http://www.riverbankcomputing.com/pipermail/pyqt/2010-February/025827.html

I believe it was also asked on the #pyqt IRC channel on freenode. I think
I have previously referred people with py2exe/PyQt issues to this page on
the PyQt Wiki:

  http://www.py2exe.org/index.cgi/Py2exeAndPyQt

If you can somehow convince py2exe to include the QtSvg module (and
presumably the libQtSvg library as well) then perhaps that will solve
this problem.

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


Re: Apologies -- Test message

2010-02-21 Thread rantingrick
On Feb 21, 12:49 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:

Note: The author of this message requested that it not be archived.
This message will be removed from Groups in 6 days (Feb 28, 12:49 pm).

I've not seen a message via Gmane in something like 36
hours... and
find it hard to believe this group would be that quiet...


Could it be that Gmane is giving you a taste of your own (David
Copperfield) medicine?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread rantingrick


Mensanator snipped: Yeah, I saw that. Funny that something
important like that wasn't part of the announcement. I notice no
mention of Mac OS, so visiting the website was a complete waste of
time on my part, wasn't it?

Oh Mensanator, why you always so grumpy? I visited your site a few
years ago and i found it to be a complete waste of my time but you
don't hear me whining about it do you? Besides mac is always the last
to get releases (if any) everybody knows that. If you drive a porsche
you can't get all upset every time you find yourself on road with pot-
holes, your just not *that* important because you drive a porsche!
Please (in the future) leave the ranting to me, i'm better at it ;).

Thanks for the release Noam, i look forward to test driving it.
hehe  ;)

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Philip Semanchuk


On Feb 21, 2010, at 8:39 PM, rantingrick wrote:




Mensanator snipped: Yeah, I saw that. Funny that something
important like that wasn't part of the announcement. I notice no
mention of Mac OS, so visiting the website was a complete waste of
time on my part, wasn't it?

Oh Mensanator, why you always so grumpy? I visited your site a few
years ago and i found it to be a complete waste of my time but you
don't hear me whining about it do you? Besides mac is always the last
to get releases (if any) everybody knows that.



Erm...not if the developer uses a Mac.  =)


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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Shashwat Anand
Just got it working in mac. Installing dependencies took a bit though.

On Mon, Feb 22, 2010 at 7:38 AM, Philip Semanchuk phi...@semanchuk.comwrote:


 On Feb 21, 2010, at 8:39 PM, rantingrick wrote:



 Mensanator snipped: Yeah, I saw that. Funny that something
 important like that wasn't part of the announcement. I notice no
 mention of Mac OS, so visiting the website was a complete waste of
 time on my part, wasn't it?

 Oh Mensanator, why you always so grumpy? I visited your site a few
 years ago and i found it to be a complete waste of my time but you
 don't hear me whining about it do you? Besides mac is always the last
 to get releases (if any) everybody knows that.



 Erm...not if the developer uses a Mac.  =)



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

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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread sstein...@gmail.com

On Feb 21, 2010, at 9:10 PM, Shashwat Anand wrote:

 Just got it working in mac. Installing dependencies took a bit though.

I used macports and it was only 2 installs:

# sudo port install py26-pygtksourceview 
# sudo port install py26-gtk2

It sure did install a lot of other stuff, like a new gcc(?) though; took almost 
an hour.

S



 
 On Mon, Feb 22, 2010 at 7:38 AM, Philip Semanchuk phi...@semanchuk.com 
 wrote:
 
 On Feb 21, 2010, at 8:39 PM, rantingrick wrote:
 
 
 
 Mensanator snipped: Yeah, I saw that. Funny that something
 important like that wasn't part of the announcement. I notice no
 mention of Mac OS, so visiting the website was a complete waste of
 time on my part, wasn't it?
 
 Oh Mensanator, why you always so grumpy? I visited your site a few
 years ago and i found it to be a complete waste of my time but you
 don't hear me whining about it do you? Besides mac is always the last
 to get releases (if any) everybody knows that.
 
 
 Erm...not if the developer uses a Mac.  =)
 
 
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Problem creating executable, with PyQwt

2010-02-21 Thread Gib Bogle

Thanks David.


Someone asked this question on the PyQt mailing list, too:

  http://www.riverbankcomputing.com/pipermail/pyqt/2010-February/025827.html


That's my student, Helvin.



I believe it was also asked on the #pyqt IRC channel on freenode. I think
I have previously referred people with py2exe/PyQt issues to this page on
the PyQt Wiki:

  http://www.py2exe.org/index.cgi/Py2exeAndPyQt

If you can somehow convince py2exe to include the QtSvg module (and
presumably the libQtSvg library as well) then perhaps that will solve
this problem.


I just did a quick test myself, and confirmed that this works for sip.  I'm not 
at all clear what --includes arguments might be needed for QtSvg (and 
libQtSvg).  I'll pass this info on to Helvin.


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


Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Mensanator
On Feb 21, 7:39 pm, rantingrick rantingr...@gmail.com wrote:
 Mensanator snipped: Yeah, I saw that. Funny that something
 important like that wasn't part of the announcement. I notice no
 mention of Mac OS, so visiting the website was a complete waste of
 time on my part, wasn't it?

 Oh Mensanator, why you always so grumpy?

Part of the job requirements of a gadfly.

 I visited your site a few
 years ago and i found it to be a complete waste of my time but you
 don't hear me whining about it do you?

Did I ever claim it wasn't?

 Besides mac is always the last
 to get releases (if any) everybody knows that.

I'm not complaining about the lack of Mac support, just that
it wasn't mentioned in the announcement.

 If you drive a porsche
 you can't get all upset every time you find yourself on road with pot-
 holes, your just not *that* important because you drive a porsche!

You're not getting the point.

 Please (in the future) leave the ranting to me, i'm better at it ;).

 Thanks for the release Noam, i look forward to test driving it.
 hehe  ;)

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


PAPER PRESENTATIONS AND SEMIMAR TOPICS.

2010-02-21 Thread miss world
PAPER PRESENTATIONS AND SEMIMAR TOPICS.
CHECK OUR VAST PAPER PRESENTATIONS AND SEMIMAR TOPICS INCLUDING
PROJECTS FOR FREE AT
http://presentationsandseminars.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient way to break up a list into two pieces

2010-02-21 Thread Jonathan Gardner
On Sat, Feb 20, 2010 at 10:48 PM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
 On Sat, 20 Feb 2010 21:21:47 -0800, Jonathan Gardner wrote:
 For ten items, though, is it really faster to muck around with array
 lengths than just copying the data over? Array copies are extremely fast
 on modern processors.

 My mistake, he actually wants l1[10:] copied. So you might be copying a
 huge amount of data, not just ten items.

 Or if you prefer, replace 10 by 1.


If you need to scale that direction, it's time to install a database.

 Programmer time and processor time being what it is, I still think my
 answer is the correct one. No, it's not what he says he wants, but it is
 what he needs.

 You missed the point that your suggestion gives radically different
 behaviour to what the OP indicated he is using. He mutates the list in
 place, you rebind the list's name. That has *very* different semantics.


 The OP may not care about the difference, but if he does require the
 first behaviour, then your solution doesn't help.


Correct.

-- 
Jonathan Gardner
jgard...@jonathangardner.net
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Use eval() safely?

2010-02-21 Thread Gregory Ewing

W. Martin Borgert wrote:


def myeval(untrustedinput):
return eval(untrustedinput, {__builtins__: None},
{ abs: abs, sin: math.sin })

Is it possible to define functions or import modules from the
untrusted input string?


This is NOT safe as it stands. It still isn't safe even if
you put nothing in the globals dict at all.

A couple of ways someone can do nasty things to you:

# Wipe out any file writable by the calling process
eval([c for c in (0).__class__.__bases__[0].__subclasses__() if c.__name__ == 
'file'][0]('/my/precious/file', 'w'))


# Use up large amounts of memory and CPU time
eval(10**10)

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


Re: Use eval() safely?

2010-02-21 Thread Steven D'Aprano
On Mon, 22 Feb 2010 18:45:40 +1300, Gregory Ewing wrote:

 W. Martin Borgert wrote:
 
 def myeval(untrustedinput):
 return eval(untrustedinput, {__builtins__: None},
 { abs: abs, sin: math.sin })
 
 Is it possible to define functions or import modules from the untrusted
 input string?
 
 This is NOT safe as it stands. It still isn't safe even if you put
 nothing in the globals dict at all.

It's *especially* not safe if you put nothing in the globals dict, 
because Python kindly rectifies that by putting the builtins into it:

 eval(__builtins__.keys(), {}, {})
['IndexError', 'all', 'help', 'vars', ... 'OverflowError']


 eval(globals(), {}, {})
{'__builtins__': {...}}

 eval(globals(), {'__builtins__': None}, {})
Traceback (most recent call last):
  File stdin, line 1, in module
  File string, line 1, in module
NameError: name 'globals' is not defined

So {'__builtins__': None} is safer than {}. Still not safe, exactly, but 
safer. Or at least you make the Black Hats work harder before they own 
your server :)




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


Re: Reading a large bz2 textfile exits early

2010-02-21 Thread Norman Rieß

Am 02/21/10 22:09, schrieb Dennis Lee Bieber:

On Sat, 20 Feb 2010 23:12:50 +0100, Norman Rießnor...@smash-net.org
declaimed the following in comp.lang.python:

   

Hello,

i am trying to read a large bz2 compressed textfile using the bz2 module.
The file is 1717362770 lines long and 8GB large.
Using this code

source_file = bz2.BZ2File(file, r)
 for line in source_file:
 print line.strip()

 print Exiting
 print I used file:  + file

the loop exits cleanly after 4311 lines in midline and the prints are
executed.
This happened on two different boxes runnig different brands of linux.
Is there something i miss or should be done differently?

 

Please verify your indentation! What you posted above is invalid in
many ways.
   

I am sorry, the indentation suffered from pasting.

This is the actual code:

source_file = bz2.BZ2File(file, r)
for line in source_file:
print line.strip()

print Exiting
print I used file:  + file



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


[issue7751] urllib.urlopen(///C|/foo/bar/spam.foo) IOError: [Errno 22]

2010-02-21 Thread Éric Araujo

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

Ok, thanks for clarifying :)

Regards

--

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



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-02-21 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Fixed in r78247 (trunk) and r78248 (release26-maint) (plus a fix in r78272 and 
r78279 to avoid test failures when the filesystem encoding is ascii).
I didn't use the any_cwd decorator -- I might consider it in future if it turns 
out that there are more tests like these.

--
dependencies:  -Add a context manager to change cwd in test.test_support and 
run the test suite in a temp dir.
resolution:  - fixed

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



[issue4999] multiprocessing.Queue does not order objects

2010-02-21 Thread Stefan Krah

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

I think it would be nice to update the documentation if this isn't
resolved yet. The patch adds a warning that FIFO behavior is not
guaranteed.

--
keywords: +patch
nosy: +skrah
Added file: http://bugs.python.org/file16276/warn_fifo.patch

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



[issue5211] Fix complex type to avoid coercion in 2.7.

2010-02-21 Thread Mark Dickinson

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

Apologies for the delay;  tomorrow was a long time coming...

The patch looks great---thank you!  I added a .. versionchanged note to the 
documentation, and fixed a couple of whitespace issues; apart from that I 
didn't change anything.  Applied in r78280.

--
resolution:  - accepted
stage:  - committed/rejected
status: open - closed

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



[issue2395] [Py3k] struct module changes of PEP 3118

2010-02-21 Thread Mark Dickinson

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

I think this can be closed as a duplicate of issue 3132.  (Yes, this issue came 
first, but all the interesting(?) discussion is over in issue 3132.)

--
dependencies:  -implement PEP 3118 struct changes
nosy: +mark.dickinson
resolution:  - duplicate
status: open - closed
superseder:  - implement PEP 3118 struct changes

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



[issue3132] implement PEP 3118 struct changes

2010-02-21 Thread Mark Dickinson

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

[Meador Inge]
 So the next step is to kick off a thread on python-dev summarizing the
 questions\problems we have come up with?  I can get that started.

Sounds good.  I'd really like to see some examples of how these struct-module 
additions would be used in real life.

--

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



[issue7384] curses crash on FreeBSD

2010-02-21 Thread Mark Dickinson

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

 It does appear that curses itself is broken on FreeBSD

Rereading this, it doesn't say what I meant it to say:  I meant that the Python 
curses module seems to be broken, not that the system-level curses library is 
broken (though that seems possible too).

--

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Dominique Pellé

New submission from Dominique Pellé dominique.pe...@gmail.com:

I built Vim-7.2.368 editor with python interpreter using
Python-2.6.4 library on Linux x86.

When I run a python command (any command, it does not matter)
in the Vim editor with Valgrind memory checker, I see valgrind
errors within the Python library.  It looks to me like they
are errors within the Python library and not errors in Vim.

I attach the valgrind error log file.

Steps to reproduce the bug:

1/ Download  compile Vim with python interpreter

  $ hg clone https://vim.googlecode.com/hg/ vim
  $ cd vim
  $ ./configure --enable-pythoninterp 
--with-python-config-dir=/usr/local/lib/python2.6/config
  $ make

(you may also want to tweak vim/src/Makefile to compile with -O0 -g
to have more interesting stacks in valgrind logs)

2/ Run a Python command within Vim with Valgrind memory checker: 

  $ cd vim/src
  $ valgrind --log-file=valgrind.log ./vim -c ':python foo=0'

3/ Observe in valgrind.log the errors in Python lib  

The stack is quite deep in the errors and Valgrind memory checker has a limit 
to dump at most 50 functions in stack frame. I increased that limit to 100 to 
be able to see the full stack trace as in attached log file valgrind.log.

In the fist error in attached valgrind.log, memory is used in a
buffer that has already been freed. Looking at the Python
code, this function does not make much sense to me:

1040 PyObject *
1041 PyMarshal_ReadLastObjectFromFile(FILE *fp)
1042 {
1043 /* 75% of 2.1's .pyc files can exploit SMALL_FILE_LIMIT.
1044  * REASONABLE_FILE_LIMIT is by defn something big enough for Tkinter.pyc.
1045  */
1046 #define SMALL_FILE_LIMIT (1L  14)
1047 #define REASONABLE_FILE_LIMIT (1L  18)
1048 #ifdef HAVE_FSTAT
1049 off_t filesize;
1050 #endif
1051 #ifdef HAVE_FSTAT
1052 filesize = getfilesize(fp);
1053 if (filesize  0) {
1054 char buf[SMALL_FILE_LIMIT];
1055 char* pBuf = NULL;
1056 if (filesize = SMALL_FILE_LIMIT)
1057 pBuf = buf;
1058 else if (filesize = REASONABLE_FILE_LIMIT)
1059 pBuf = (char *)PyMem_MALLOC(filesize);
1060 if (pBuf != NULL) {
1061 PyObject* v;
1062 size_t n;
1063 /* filesize must fit into an int, because it
1064is smaller than REASONABLE_FILE_LIMIT */
1065 n = fread(pBuf, 1, (int)filesize, fp);
1066 v = PyMarshal_ReadObjectFromString(pBuf, n);
1067 if (pBuf != buf)
1068 PyMem_FREE(pBuf);
1069 return v;
1070 }
1071 
1072 }
1073 #endif
1074 /* We don't have fstat, or we do but the file is larger than
1075  * REASONABLE_FILE_LIMIT or malloc failed -- read a byte at a time.
1076  */
1077 return PyMarshal_ReadObjectFromFile(fp);
1078 
1079 #undef SMALL_FILE_LIMIT
1080 #undef REASONABLE_FILE_LIMIT
1081 }

Memory is allocated for pBuf at line marshal.c:1059.
Then at line marshall.c:1066 v= PyMarshal_ReadObjectFromString(pBuf, n);
is called. 

The v structure contains pointer to the pBuf buffer (see line marshall.c:1103). 
Then pBuf is freed at marshall.c:1068 and v is returned.

So v which is returned contains a pointer v.ptr to buffer
that has just been freed. That looks wrong to me. What's the
point of v containing an address to something freed?

Looking at the latest version of Python/marshal.c in SVN,
this function has not been changed since 2.6.4:

http://svn.python.org/projects/python/trunk/Python/marshal.c

--
components: Library (Lib)
files: valgrind.log.gz
messages: 99660
nosy: dominiko
severity: normal
status: open
title: Valgrind error when running Python command within Vim
versions: Python 2.6
Added file: http://bugs.python.org/file16277/valgrind.log.gz

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Mark Dickinson

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

The code you identify looks okay to me:  in PyMarshal_ReadObjectFromString, 
isn't it only the temporary variable rf that has a pointer to the string?

Have you read Misc/README.valgrind in the Python source?

--
nosy: +mark.dickinson

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Dominique Pellé

Dominique Pellé dominique.pe...@gmail.com added the comment:

 Have you read Misc/README.valgrind in the Python source?

No, I had not see this file.
Thanks for pointing it to me.

I've just read it, reconfigured  recompiled Python-2.6.4 with:

./configure --without-pymalloc

It now runs without Valgrind error.

Sorry for the noise. 
This issue can thus be closed

--

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Dominique Pellé

Dominique Pellé dominique.pe...@gmail.com added the comment:

Closed: this was not a bug, I had to build Python lib with configure 
--without-pymalloc to avoid valgrind errors.

--
status: open - closed

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-02-21 Thread Alex Willmer

Alex Willmer a...@moreati.org.uk added the comment:

On 17 February 2010 19:35, Matthew Barnett rep...@bugs.python.org wrote:
 The main text at http://pypi.python.org/pypi/regex appears to have lost its 
 backslashes, for example:

    The Unicode escapes u and U are supported.

 instead of:

    The Unicode escapes \u and \U are supported.

Matthew, As you no doubt realised that text is read straight from the
Features.txt file. PyPI interprets it as RestructuredText, which uses
\ as an escape character in various cases. Do you intentionally write
Features.txt as RestructuredText? If so here is a patch that escapes
the \ characters as appropriate, otherwise I'll work out how to make
PyPI read it as plain text.

Regards, Alex
-- 
Alex Willmer a...@moreati.org.uk
http://moreati.org.uk/blog

--
Added file: http://bugs.python.org/file16278/Features-backslashes.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2636
___=== modified file 'Features.txt'
--- Features.txt2010-02-17 12:22:14 +
+++ Features.txt2010-02-21 14:44:13 +
@@ -61,7 +61,7 @@
 regex.findall and regex.finditer support an 'overlapped' flag which 
permits overlapped matches
 
 Unicode escapes (#3665)
-The Unicode escapes \u and \U are supported.
+The Unicode escapes \\u and \\U are supported.
 
 Large patterns (#1160)
 Patterns can be much larger.
@@ -94,23 +94,23 @@
 Named groups can be named with (?name...) as well as the current 
(?Pname...).
 
 Group references
-Groups can be referenced within a pattern with \gname. This also allows 
there to be more than 99 groups.
+Groups can be referenced within a pattern with \\gname. This also allows 
there to be more than 99 groups.
 
 Named characters
-\N{name}
+\\N{name}
 Named characters are supported.
 
 Unicode properties
-\p{name}
-\P{name}
-Unicode properties are supported. \p{name} matches a character which has 
property 'name' and \P{name} matches a character which doesn't have property 
'name'.
+\\p{name}
+\\P{name}
+Unicode properties are supported. \\p{name} matches a character which has 
property 'name' and \\P{name} matches a character which doesn't have property 
'name'.
 
 Posix character classes
 [[:alpha:]]
 Posix character classes are supported.
 
 Search anchor
-\G
+\\G
 A search anchor has been added. It matches at the position where each 
search started/continued and can be used for contiguous matches or in negative 
variable-length lookbehinds to limit how far back the lookbehind goes:
 
  regex.findall(r\w{2}, abcd ef)

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Mark Dickinson

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

Thanks for the update!

--

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
resolution:  - invalid

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread Adam Collard

New submission from Adam Collard adam.coll...@gmail.com:

Originally reported at:
  https://bugs.edge.launchpad.net/bugs/384602

In Python 2.6, the dbshelve.py module throws an AttributeError exception 
whenever a call is made to a method that depends upon an __iter__ method.  The 
exception is:

  File /usr/lib/python2.6/bsddb/dbshelve.py, line 167, in __iter__
return self.db.__iter__()
AttributeError: 'DB' object has no attribute '__iter__'

This means that, if mydb is an istance of a DB object, the following examples 
will fail:

for key in mydb: print key
 
print (k for k in mydb.iterkeys())

for k, d in mydb.itervalues(): print k, d

and many other statements depending on iterable(mydb) being true

Note that, in Python 2.5, these examples work and no exception is thrown.  In 
fact, if you have both 2.5 and 2.6 installed on the same system, you can run 
the same program containing code as above with Python2.5 without issue while 
running it under Python 2.6 raises the exception seen above.

--
messages: 99667
nosy: adam-collard
severity: normal
status: open
title: dbshelve.py throws exception: AttributeError: 'DB' object has no 
attribute '__iter__'

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread R. David Murray

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

Could you please provide a complete example that demonstrates the problem?  A 
naive example using shelve with a dbhash database seems to work fine.

--
nosy: +r.david.murray
priority:  - normal
stage:  - test needed
type:  - behavior
versions: +Python 2.6, Python 2.7

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



[issue1722344] Thread shutdown exception in Thread.notify()

2010-02-21 Thread sorin

sorin sorin.sbar...@gmail.com added the comment:

Any idea if there is a nightly build for Python 2.6? The latest release was 
2.6.4 and was 2 days before submitting the patch. 

Or the only alternative is to build it myself? Any ideas on when we could see 
2.6.5? - I tried to look for a release timeline but I wasn't able to locate one.

--
nosy: +sorin

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread Adam Collard

Adam Collard adam.coll...@gmail.com added the comment:

Attached a simple example.

--
Added file: http://bugs.python.org/file16280/dbshelve_example.py

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



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-21 Thread Mark Dickinson

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

Please could you generate and upload a patch against the Python source?  (For 
Windows, you can do this using the WinMerge tool, amongst others.)  I'm unable 
to open the file you attached on my machine:

No application knows how to open ... xmlrpc.client.modify.rar.

If you could explain how param is being used improperly, that might also 
help.

--
nosy: +mark.dickinson

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-02-21 Thread Martin v . Löwis

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

 I would suggest using my _DARWIN_C_SOURCE implementation
 unconditionally and make similar changes to posix_setgroups, but this
 is probably a subject for a separate issue.

I would propose a different strategy: if _SC_NGROUPS_MAX is defined, use
that to find out how much memory to allocate, otherwise, fall back to
the current max array size. Can you find out whether doing so would also
fix the issue at hand?

--

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



[issue3132] implement PEP 3118 struct changes

2010-02-21 Thread Mark Dickinson

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

About long doubles again:  I just encountered someone on the #python IRC 
channel who wanted to know whether struct.pack and struct.unpack supported 
reading and writing of x87 80-bit long doubles (padded to 12 bytes each in the 
input).  A few quotes from him/her, with permission (responses from others, 
including me, edited out;  I can supply a fuller transcript if necessary, but I 
hope what's below isn't misleading).

[18:39] bdesk: Hi, is struct.pack able to handle 80-bit x86 extended floats?
[18:40] bdesk: How can I read and write these 80-bit floats, in binary, using 
python?
[18:44] bdesk: dickinsm: I have a C program that uses binary files as input and 
output, and I want to deal with these files using python if possible.
[18:49] bdesk: I don't need to do arithmetic with the full 80 bits of precision 
within the python program, although It would be better if I could.
[18:50] bdesk: I would need to use the float in a more semantically useful 
manner than treating it as a black box of 12 bytes.
[18:55] bdesk: Until python gets higher precision floats, my preferred 
interface would be to lose some precision when unpacking the floats.

The main thing that I realized from this is that unpacking as a ctypes long 
double isn't all that useful for someone who wants to be able to do arithmetic 
on the unpacked result.  And if you don't want to do arithmetic on the unpacked 
result, then you're probably just shuffling the bytes around without caring 
about their meaning, so there's no need to unpack as anything other than a 
sequence of 12 bytes.

On the other hand, I suppose it's enough to be able to unpack as a ctypes 
c_longdouble and then convert to a Python float (losing precision) for the 
arithmetic.  Alternatively, we might consider simply unpacking a long double 
directly into a Python float (and accepting the loss of precision);  that seems 
to be what would be most useful for the use-case above.

--

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread R. David Murray

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

The bug seems to have been introduced by an incomplete or incorrect translation 
to the newer idiom (DictMixin to MutableMapping).  Since bsddb is gone in py3, 
I'm inclined to fix it by just going back to using DictMixin.  There are no 
tests for the DictMixin functionality added in Python 2.3.

--
components: +Library (Lib)
keywords: +easy
nosy: +jcea

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



[issue6436] trace module doesn't seem to produce .cover files for Py3 (but does for Py2)

2010-02-21 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

I noticed the same behavior today.

Let's consider a test case using my python script version_check.py (attached).

Normally the script does the following on my Ubuntu 9.10 box:

# Python 2.6 example:
m...@ebx2009:~/test$ which python
/usr/bin/python
m...@ebx2009:~/test$ python version_check.py
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]

# Python 3.1 example:
m...@ebx2009:~/test$ which python3
/usr/local/bin/python3
m...@ebx2009:~/test$ python3 version_check.py
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]

# Starting with a directory with only the script in it:
m...@ebx2009:~/test$ ls
version_check.py
# I use the -C . to force the .cover files to be dumped in my current 
directory:
m...@ebx2009:~/test$ python -m trace --count -C . version_check.py 
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]
m...@ebx2009:~/test$ ls
threading.cover  version_check.cover  version_check.py
# So this worked fine.

# Let's remove the cover files and try with Python 3.1:
m...@ebx2009:~/test$ rm *.cover
m...@ebx2009:~/test$ ls
version_check.py
m...@ebx2009:~/test$ python3 -m trace --count -C . version_check.py 
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]
m...@ebx2009:~/test$ ls
threading.cover  version_check.py
# Its annoying that the threading.cover is still being made, but 
version_check.cover did not get generated in any case...

I tracked the problem down inside of lib/trace.py (same code in both python 
versions):

def localtrace_count(self, frame, why, arg):
if why == line:
filename = frame.f_code.co_filename
print(frame.f_code.co_filename)  # my new debug line
lineno = frame.f_lineno
key = filename, lineno
self.counts[key] = self.counts.get(key, 0) + 1
return self.localtrace

If you put my print debug line in, we get some more interesting behavior from 
my example runs:

m...@ebx2009:~/test$ python -m trace --count -C . version_check.py 
/usr/lib/python2.6/threading.py
string
version_check.py
version_check.py
version_check.py
version_check.py
version_check.py
version_check.py
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]

m...@ebx2009:~/test$ python3 -m trace --count -C . version_check.py 
/usr/local/lib/python3.1/threading.py
string
string
string
string
string
string
string
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]

So python3 is not retaining the module name correctly. Instead its just giving 
string. So the bottom line is frame.f_code.co_filename is now behaving 
differently. I'm not sure how to fix that.

--
nosy: +mnewman
versions: +Python 3.2
Added file: http://bugs.python.org/file16282/version_check.py

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton

Jeremy Hylton jer...@alum.mit.edu added the comment:

On Sat, Feb 20, 2010 at 12:06 AM, R. David Murray
rep...@bugs.python.org wrote:

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

 But the docs (which presumably describe the API) say that the socket is 
 unusable after the call to close, which argues that the paramiko sockets are 
 following the documented API.  Do the docs need to be corrected?

I mean the documented socket API.

Jeremy

 --

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


--

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton

Jeremy Hylton jer...@alum.mit.edu added the comment:

In particular, I mean this part of the socket API:

socket.makefile([mode[, bufsize]])
Return a file object associated with the socket. (File objects are
described in File Objects.) The file object references a dup()ped
version of the socket file descriptor, so the file object and socket
object may be closed or garbage-collected independently. The socket
must be in blocking mode (it can not have a timeout). The optional
mode and bufsize arguments are interpreted the same way as by the
built-in file() function.

The language may be a little vague, but it means that closing the file
generated by makefile() should not close the underlying socket.

Jeremy

On Sun, Feb 21, 2010 at 3:23 PM, Jeremy Hylton rep...@bugs.python.org wrote:

 Jeremy Hylton jer...@alum.mit.edu added the comment:

 On Sat, Feb 20, 2010 at 12:06 AM, R. David Murray
 rep...@bugs.python.org wrote:

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

 But the docs (which presumably describe the API) say that the socket is 
 unusable after the call to close, which argues that the paramiko sockets are 
 following the documented API.  Do the docs need to be corrected?

 I mean the documented socket API.

 Jeremy

 --

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


 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue7806
 ___
 ___
 Python-bugs-list mailing list
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu



--

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



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

Perhaps this is now really a bug:

# Response to e-mail to webmas...@python.org:
#

This is the mail system at host mail.python.org.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

  The mail system

webmaster-reply...@mail.python.org (expanded from webmas...@python.org):
   Command died with status 1: /usr/bin/replybot -C /etc/replybot.cfg -s
   WEBMASTER. Command output: Traceback (most recent call last):   File
   /usr/bin/replybot, line 5, in module from pkg_resources import
   load_entry_point ImportError: No module named pkg_resources

Final-Recipient: rfc822; webmaster-reply...@mail.python.org
Original-Recipient: rfc822;webmas...@python.org
Action: failed
Status: 5.3.0
Diagnostic-Code: x-unix; Traceback (most recent call last):   File
   /usr/bin/replybot, line 5, in module from pkg_resources import
   load_entry_point ImportError: No module named pkg_resources


-- Forwarded message --
From: Michael Newman michael.b.new...@gmail.com
To: webmas...@python.org
Date: Sun, 21 Feb 2010 15:31:31 -0500
Subject: please update copyright to show 2010
Please consider fixing this bug:

Update copyright notice on python websites to 2010
http://bugs.python.org/issue7929

Thanks for maintaining a great website.

-Mike

--

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray

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

So do I.  I'm saying that paramiko appears to be following the socket API as 
documented in the python docs (ie: that closing the socket means it is no 
longer usable).

--

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



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

I posted the copyright note, and the reply bot bug on the wiki at:
http://wiki.python.org/moin/SiteImprovements

--

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray

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

So HTTConnection is closing the thing returned by makefile and that is closing 
the socket, except that the socket library makes sure it doesn't actually close 
the socket until the dupped file handle is also closed?  I guess I need to look 
at this more closely when I have time in order to fully understand it.

--

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



[issue1722344] Thread shutdown exception in Thread.notify()

2010-02-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

I have seen somewhere (ask google), that python 2.6.5 would be released 
mid-march.
But except for a few platforms, python.org does not provide compiled binaries.

--

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



[issue7964] -m pdb SyntaxError for \r\n formatted py files

2010-02-21 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

I'm interested in finding a workaround for this issue in the next 24 hours. I 
can also help contribute a test case. I'll investigate further.

--
nosy: +jaraco

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



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Martin v . Löwis

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

Closing as fixed, as the replybot issue is listed on the wiki.

--
resolution:  - fixed
status: open - closed

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



  1   2   >