Re: virtualenv wrecked my Django+modules install

2012-01-06 Thread Alec Taylor
I ran Pinax-env\Scripts\deactivate.bat but it didn't change anything. I'm skeptical if satchmo will work in a virtualenv, since many of its dependencies (such as PIL) I had to install with a setup from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil How would I get around this issue in a vir

Re: python philosophical question - strong vs duck typing

2012-01-06 Thread Devin Jeanpierre
> where n,m are compiler variables used to define the dependent > (paramaterized) types array(int,n) and int(n)/ The double use of n means > that the compiler checks that length n of the array equals the length > passed. > > My response: in Python, there is no need to pass concrete collection sizes

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 5:49 PM, Steven D'Aprano wrote: > In the real world, test conflicts and dependencies are bugs in your test > suite that should be fixed, like any other bug in code. The fact that it > is test code that is failing is irrelevant. I agree 100%, but none of that changes my poin

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Lie Ryan
On 01/07/2012 11:49 AM, Steven D'Aprano wrote: You may not be able to run tests*simultaneously*, due to clashes involving external resources, but you should be able to run them in random order. tests that involves external resources should be mocked, although there are always a few external re

Re: Help with python-list archives

2012-01-06 Thread random joe
On Jan 6, 1:41 am, Ian Kelly wrote: > One could also avoid creating the intermediate file by using a > StringIO to keep it in memory instead: Yes StringIO is perfect for this. Many thanks to all who replied. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get id(function) for each function in stack?

2012-01-06 Thread Steven D'Aprano
On Fri, 06 Jan 2012 10:02:28 -0800, dmitrey wrote: > hi all, > how to get id(func) for each func in stack? (I mean memory address, to > compare it with id(some known funcs)) Thank you in advance, D. id() does not return a memory address, except perhaps by accident. It returns a ID number. In Jyt

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Steven D'Aprano
On Fri, 06 Jan 2012 10:20:28 -0700, Ian Kelly wrote: > On Fri, Jan 6, 2012 at 10:01 AM, Lie Ryan wrote: >> That unittest executes its tests in alphabetical order is >> implementation detail for a very good reason, and good unittest >> practice dictates that execution order should never be defined

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Steven D'Aprano
On Sat, 07 Jan 2012 04:01:44 +1100, Lie Ryan wrote: > On 01/07/2012 12:36 AM, Ulrich Eckhardt wrote: >> True, perhaps, but doing it this way would be more fun and easier >> reusable in other cases where the default order is not desirable. I can >> also go and name the test functions test_000 to te

Re: how to get id(function) for each function in stack?

2012-01-06 Thread Lie Ryan
On 01/07/2012 06:50 AM, Ian Kelly wrote: On Fri, Jan 6, 2012 at 12:29 PM, dmitrey wrote: Python build-in function sum() has no attribute func_code, what should I do in the case? Built-in functions and C extension functions have no code objects, and for that reason they also do not exist in th

Re: Nested Function Question

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 2:46 PM, GZ wrote: > Hi, > > I am reading the documentation of functools.partial (http:// > docs.python.org/library/functools.html#functools.partial) and found > the following 'reference implementation' of functools.partial. > > def partial(func, *args, **keywords): >    def

Nested Function Question

2012-01-06 Thread GZ
Hi, I am reading the documentation of functools.partial (http:// docs.python.org/library/functools.html#functools.partial) and found the following 'reference implementation' of functools.partial. def partial(func, *args, **keywords): def newfunc(*fargs, **fkeywords): newkeywords = key

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Arnaud Delobelle
On 6 January 2012 13:40, Ulrich Eckhardt wrote: > Am 06.01.2012 12:44, schrieb Peter Otten: > >> Alternatively you can write your own test loader: > > [...CODE...] > > Well, actually you just did that for me and it works! ;) > > > Nonetheless, I'm still wondering if I could somehow replace the dic

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Arnaud Delobelle
On 6 January 2012 11:44, Peter Otten <__pete...@web.de> wrote: > class Loader(unittest.TestLoader): >    def getTestCaseNames(self, testCaseClass): >        """Return a sequence of method names found within testCaseClass >        sorted by co_firstlineno. >        """ That's a clever trick! -- A

Re: How to support a non-standard encoding?

2012-01-06 Thread Tim Wintle
On Fri, 2012-01-06 at 12:00 -0800, jmfauth wrote: > The distibution of such a codec may be a problem. There is a register_codec method (or similar) in the codecs module. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get id(function) for each function in stack?

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 12:56 PM, Dave Angel wrote: > On 01/06/2012 02:29 PM, dmitrey wrote: >> >> On Jan 6, 8:28 pm, Ian Kelly  wrote: >>> >>> On Fri, Jan 6, 2012 at 11:02 AM, dmitrey  wrote: hi all, how to get id(func) for each func in stack? (I mean memory address, to compare

Re: How to support a non-standard encoding?

2012-01-06 Thread jmfauth
On 6 jan, 11:03, Ivan wrote: > Dear All > > I'm developing a python application for which I need to support a > non-standard character encoding (specifically ISO 6937/2-1983, Addendum > 1-1989).  Here are some of the properties of the encoding and its use in > the application: > >    - I need to r

Re: how to get id(function) for each function in stack?

2012-01-06 Thread Dave Angel
On 01/06/2012 02:29 PM, dmitrey wrote: On Jan 6, 8:28 pm, Ian Kelly wrote: On Fri, Jan 6, 2012 at 11:02 AM, dmitrey wrote: hi all, how to get id(func) for each func in stack? (I mean memory address, to compare it with id(some known funcs)) Thank you in advance, D. The answer hasn't changed s

Re: how to get id(function) for each function in stack?

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 12:29 PM, dmitrey wrote: > Python build-in function sum() has no attribute func_code, what should > I do in the case? Built-in functions and C extension functions have no code objects, and for that reason they also do not exist in the stack. There is no way to find sum() i

Re: how to get id(function) for each function in stack?

2012-01-06 Thread dmitrey
On Jan 6, 8:28 pm, Ian Kelly wrote: > On Fri, Jan 6, 2012 at 11:02 AM, dmitrey wrote: > > hi all, > > how to get id(func) for each func in stack? (I mean memory address, to > > compare it with id(some known funcs)) > > Thank you in advance, D. > > The answer hasn't changed since your last thread

Re: how to get id(function) for each function in stack?

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 11:02 AM, dmitrey wrote: > hi all, > how to get id(func) for each func in stack? (I mean memory address, to > compare it with id(some known funcs)) > Thank you in advance, D. The answer hasn't changed since your last thread about this. The stack contains code objects, not

how to get id(function) for each function in stack?

2012-01-06 Thread dmitrey
hi all, how to get id(func) for each func in stack? (I mean memory address, to compare it with id(some known funcs)) Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Lie Ryan
On 01/07/2012 04:20 AM, Ian Kelly wrote: On Fri, Jan 6, 2012 at 10:01 AM, Lie Ryan wrote: That unittest executes its tests in alphabetical order is implementation detail for a very good reason, and good unittest practice dictates that execution order should never be defined (some even argued th

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 10:01 AM, Lie Ryan wrote: > That unittest executes its tests in alphabetical order is implementation > detail for a very good reason, and good unittest practice dictates that > execution order should never be defined (some even argued that the execution > order should be ran

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Lie Ryan
On 01/07/2012 12:36 AM, Ulrich Eckhardt wrote: Am 06.01.2012 12:43, schrieb Lie Ryan: On 01/06/2012 08:48 PM, Ulrich Eckhardt wrote: Hi! The topic explains pretty much what I'm trying to do under Python 2.7[1]. The reason for this is that I want dir(SomeType) to show the attributes in the orde

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 9:06 AM, Ian Kelly wrote: > On Fri, Jan 6, 2012 at 6:40 AM, Ulrich Eckhardt > wrote: >> Nonetheless, I'm still wondering if I could somehow replace the dict with an >> OrderedDict. > > In Python 3, yes.  This is pretty much the entire use case for the new > __prepare__ meth

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ian Kelly
On Fri, Jan 6, 2012 at 6:40 AM, Ulrich Eckhardt wrote: > Nonetheless, I'm still wondering if I could somehow replace the dict with an > OrderedDict. In Python 3, yes. This is pretty much the entire use case for the new __prepare__ method of metaclasses. See the "OrderedClass" example at: http:/

[ANN]: 'tsshbatch', Batch ssh Tool, Version 1.134 Released

2012-01-06 Thread Tim Daneliuk
'tsshbatch' Version 1.134 is now released and available for download at: http://www.tundraware.com/Software/tsshbatch This is the first public release. - What Is 'tsshbatch'? -- 'tsshbatch' is a tool

Re: UnicodeEncodeError when piping stdout, but not when printing directly to the console

2012-01-06 Thread Adam Funk
On 2012-01-06, Peter Otten wrote: > Adam Funk wrote: > >> On 2012-01-04, Peter Otten wrote: >> >>> Adam Funk wrote: >> How can I force python (preferably within my python program, rather than having to set something externally) to treat stdout as UTF-8? >>> >>> >>> $ cat force_utf8.py

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ethan Furman
Ulrich Eckhardt wrote: Hi! The topic explains pretty much what I'm trying to do under Python 2.7[1]. The reason for this is that I want dir(SomeType) to show the attributes in the order of their declaration. This in turn should hopefully make unittest execute my tests in the order of their d

Re: How to support a non-standard encoding?

2012-01-06 Thread Ivan Uemlianin
Dear Tim Thanks for your help. > If your system version of iconv contains that encoding, ... Alas, it doesn't: $ iconv -l |grep 6937 $ Also, I'd like to package the app so other people could use it, so I wouldn't want to depend too much on the local OS. Best wishes Ivan On 06/01

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ulrich Eckhardt
Am 06.01.2012 12:44, schrieb Peter Otten: Alternatively you can write your own test loader: [...CODE...] Well, actually you just did that for me and it works! ;) Nonetheless, I'm still wondering if I could somehow replace the dict with an OrderedDict. Thank you! Uli -- http://mail.python.

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Ulrich Eckhardt
Am 06.01.2012 12:43, schrieb Lie Ryan: On 01/06/2012 08:48 PM, Ulrich Eckhardt wrote: Hi! The topic explains pretty much what I'm trying to do under Python 2.7[1]. The reason for this is that I want dir(SomeType) to show the attributes in the order of their declaration. This in turn should hope

[ANNOUNCE] greenlet 0.3.3

2012-01-06 Thread Ralf Schmitt
Hi, I have uploaded greenlet 0.3.3 to PyPI: http://pypi.python.org/pypi/greenlet What is it? --- The greenlet module provides coroutines for python. coroutines allow suspending and resuming execution at certain locations. concurrence[1], eventlet[2] and gevent[3] use the greenlet module

Re: How to support a non-standard encoding?

2012-01-06 Thread Tim Wintle
On Fri, 2012-01-06 at 10:03 +, Ivan wrote: > Dear All > > I'm developing a python application for which I need to support a > non-standard character encoding (specifically ISO 6937/2-1983, Addendum > 1-1989). If your system version of iconv contains that encoding (mine does) then you could

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Peter Otten
Ulrich Eckhardt wrote: > The topic explains pretty much what I'm trying to do under Python > 2.7[1]. The reason for this is that I want dir(SomeType) to show the > attributes in the order of their declaration. This in turn should > hopefully make unittest execute my tests in the order of their > d

Re: replacing __dict__ with an OrderedDict

2012-01-06 Thread Lie Ryan
On 01/06/2012 08:48 PM, Ulrich Eckhardt wrote: Hi! The topic explains pretty much what I'm trying to do under Python 2.7[1]. The reason for this is that I want dir(SomeType) to show the attributes in the order of their declaration. This in turn should hopefully make unittest execute my tests in

replacing __dict__ with an OrderedDict

2012-01-06 Thread Ulrich Eckhardt
Hi! The topic explains pretty much what I'm trying to do under Python 2.7[1]. The reason for this is that I want dir(SomeType) to show the attributes in the order of their declaration. This in turn should hopefully make unittest execute my tests in the order of their declaration[2], so that t

share a apache pattern log parser

2012-01-06 Thread 罗晟
Hi, folks. Recently my work involved lots of parsing and statics of apache server log. Yes, we have pylogsparser and apachelog, but none of them is for human IMHO :( Inspired by kennethreitz, who is the author of the fabulous requests module, and his concept of "python for human", I extract a litt

How to support a non-standard encoding?

2012-01-06 Thread Ivan
Dear All I'm developing a python application for which I need to support a non-standard character encoding (specifically ISO 6937/2-1983, Addendum 1-1989). Here are some of the properties of the encoding and its use in the application: - I need to read and write data to/from files. The f

Re: UnicodeEncodeError when piping stdout, but not when printing directly to the console

2012-01-06 Thread Peter Otten
Adam Funk wrote: > On 2012-01-04, Peter Otten wrote: > >> Adam Funk wrote: > >>> How can I force python (preferably within my python program, rather >>> than having to set something externally) to treat stdout as UTF-8? >> >> >> $ cat force_utf8.py >> # -*- coding: utf-8 -*- >> import sys >> >>

Re: UnicodeEncodeError when piping stdout, but not when printing directly to the console

2012-01-06 Thread Adam Funk
On 2012-01-04, Peter Otten wrote: > Adam Funk wrote: >> How can I force python (preferably within my python program, rather >> than having to set something externally) to treat stdout as UTF-8? > > > $ cat force_utf8.py > # -*- coding: utf-8 -*- > import sys > > if sys.stdout.encoding is None: >

Re: help me get excited about python 3

2012-01-06 Thread peter
I'm sure Python 3 is wonderful, but I make heavy use of the Python Imaging Library, which as I understand it has not been adapted to Python 3. There may be alternatives, but as I have a large amount of working code using PIL I am reluctant to drop it just yet. Peter -- http://mail.python.org/mai

Re: problem to install Flask

2012-01-06 Thread 88888 Dihedral
MRAB於 2012年1月6日星期五UTC+8上午11時05分03秒寫道: > On 06/01/2012 02:24, 水静流深 wrote: > > ~$ sudo easy_install Flask > > Searching for Flask > > Reading http://pypi.python.org/simple/Flask/ > > Reading http://github.com/mitsuhiko/flask/ > > Best match: Flask 0.8 > > Downloading > > http://pypi.python.org/packag