Re: determining which value is the first to appear five times in a list?

2010-02-06 Thread Wolodja Wentland
here, but you might like this approach. Another approach would use itertools.takewhile() or itertools.ifilter() ... Just have a look :-) yours sincerely -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA

Re: determining which value is the first to appear five times in a list?

2010-02-06 Thread Wolodja Wentland
On Sat, Feb 06, 2010 at 14:42 -0500, Terry Reedy wrote: On 2/6/2010 2:09 PM, Wolodja Wentland wrote: I think you can use the itertools.groupby(L, lambda el: el[1]) to group elements in your *sorted* list L by the value el[1] (i.e. the identifier) and then iterate through these groups until

Re: basic Class in Python

2010-01-17 Thread Wolodja Wentland
On Sun, Jan 17, 2010 at 15:05 -0800, BarryJOgorman wrote: [...] class Person: def _init_(self, name, job=None, pay=0): ^^ -- __init__(self, ... It's __init__() not _init_()! Have fun learning Python! -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de

Re: a problem with writing a generator

2010-01-14 Thread Wolodja Wentland
will help you a lot: http://www.dabeaz.com/generators/ If you have further questions just ask and have fun playing with generators in Python ... -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2

Re: problem with multiprocessing and defaultdict

2010-01-12 Thread Wolodja Wentland
() managed_dict = manager.dict() ... -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python

Re: share dictionary between processes

2009-12-18 Thread Wolodja Wentland
) while True: pass Have a look at multiprocessing.Manager() it provides (among other things) proxies for dictionaries that can be used in different threads. These are even accessible on different hosts if configures correctly. -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de

Memory consumption of multiprocessing.Pool

2009-12-15 Thread Wolodja Wentland
and the pool processes should *not* have the same memory requirements as the parent process. Am I missing something here? -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC

Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
regards -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
On Fri, Dec 11, 2009 at 03:03 -0800, Bearophile wrote: Wolodja Wentland: Which library would you choose? This one probably uses low memory, but I don't know if it works still: http://osl.iu.edu/~dgregor/bgl-python/ That project looks not that maintained and graph-tool [1] is based on boost

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
On Fri, Dec 11, 2009 at 08:55 -0500, Neal Becker wrote: Bearophile wrote: Wolodja Wentland: Which library would you choose? This one probably uses low memory, but I don't know if it works still: http://osl.iu.edu/~dgregor/bgl-python/ How about python interface to igraph? Don't know

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
On Fri, Dec 11, 2009 at 07:31 -0800, IngoognI wrote: On Dec 11, 11:12 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de wrote: Which library would you choose? looking at the galery at networx, it seems to be all balls 'n sticks, how about writing the data to a file POV-Ray can read

Re: [distutils] Install script under a different name

2009-12-05 Thread Wolodja Wentland
] http://packages.python.org/distribute/setuptools.html#automatic-script-creation -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc Description: Digital signature

Re: Why the expression (1) is not an one-arity tuple, but int ?

2009-12-04 Thread Wolodja Wentland
) type 'int' t = (1,) type(t) type 'tuple' t = 1, type(t) type 'tuple' It is the ',' not the '(' and ')' ... -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-03 Thread Wolodja Wentland
On Wed, Dec 02, 2009 at 08:03 -0800, Mark Summerfield wrote: On Dec 2, 11:20 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de It would be quite nice if you could mark all the Python 3 idioms that work in Python 2.X as well. This would allow readers that are still using Python 2.X

Re: Moving from Python 2 to Python 3: A 4 page cheat sheet

2009-12-02 Thread Wolodja Wentland
their coding style accordingly. You could just add a little (2.X) after the idiom for example. And thanks for the nice cheat sheet! :-D -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC

Re: Python Programming Challenges for beginners?

2009-11-27 Thread Wolodja Wentland
...but at this stage that is not the right 'venue' for me. I mainly need challenges like the ones they have in Learning Perl. Project Euler has already been pointed out to you, but I enjoyed solving the riddles at: http://www.pythonchallenge.com/ Enjoy! :-) -- .''`. Wolodja Wentlandwentl

Re: creating pipelines in python

2009-11-23 Thread Wolodja Wentland
/generators/ -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Imitating tail -f

2009-11-22 Thread Wolodja Wentland
from a talk by David Beazley on generators which you can find at [2] and [3]. Enjoy! [1] http://www.dabeaz.com/generators/follow.py [2] http://www.dabeaz.com/generators-uk/ [3] http://www.dabeaz.com/coroutines/ -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de

Re: How can pip install a GitHub code drop?

2009-11-15 Thread Wolodja Wentland
Wolodja -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: How can pip install a GitHub code drop?

2009-11-15 Thread Wolodja Wentland
On Mon, Nov 16, 2009 at 01:11 +0100, Wolodja Wentland wrote: On Sun, Nov 15, 2009 at 09:16 -0800, Phlip wrote: How can I point pip at the repo to install the library? sudo pip -e git+git://github.com/Phlip/Kozmiq.git pip -e git+git://github.com/Phlip/Kozmiq.git#egg=Kozmiq err... pip

Re: how to create a pip package

2009-11-11 Thread Wolodja Wentland
On Tue, Nov 10, 2009 at 20:25 -0800, Phlip wrote: On Nov 10, 3:11 pm, Wolodja Wentland wentl...@cl.uni-heidelberg.de wrote: The pip requirement file would contain the following line: -e git+git://example.com/repo.git#egg=rep Let me ask it like this. What happens when a user types

Re: how to create a pip package

2009-11-10 Thread Wolodja Wentland
On Mon, Nov 09, 2009 at 19:48 -0800, Phlip wrote: I have a single file that I need my crew to pip install. Where do you plan to host this file? Will it be available on PiPy? When I Google for how to create a pip package I don't hit anything. Of course that info is out there; I can't seem to

Re: how to create a pip package

2009-11-10 Thread Wolodja Wentland
On Tue, Nov 10, 2009 at 06:30 -0800, Phlip wrote: On Nov 10, 1:54 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de wrote: http://docs.python.org/library/distutils.html#module-distutils http://packages.python.org/distribute/ ktx... now some utterly retarded questions to prevent false

Re: how to create a pip package

2009-11-10 Thread Wolodja Wentland
would contain the following line: -e git+git://example.com/repo.git#egg=rep I hope this answers your questions :-D -- .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.asc

Re: How to get the realpath of a symbolic link?

2009-10-31 Thread Wolodja Wentland
to understand how a module is working then have a look at its source code. Python is open source -- Use that privilige! kind regards Wolodja Wentland signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-10-31 Thread Wolodja Wentland
On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote: On Sat, Oct 31, 2009 at 4:14 PM, Robert Kern robert.k...@gmail.com wrote: [ snip ] I know that multiple classes or functions are typically defined in one file (i.e. module in python). However, I feel this make the code not easy to read.

Re: How to import only one module in a package when the package __init__.py has already imports the modules?

2009-10-31 Thread Wolodja Wentland
On Sat, Oct 31, 2009 at 18:29 -0500, Peng Yu wrote: On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland wentl...@cl.uni-heidelberg.de wrote: On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote: Are you serious? Do you *really* put each function in its own file? How exactly does this enhance

Re: PEP 391 (Dictionary-Based Configuration for Logging) Updated

2009-10-28 Thread Wolodja Wentland
On Wed, Oct 28, 2009 at 10:27 +, Vinay Sajip wrote: I've updated PEP 391 (Dictionary-Based Configuration for Logging): http://svn.python.org/view/peps/trunk/pep-0391.txt?r1=75599r2=75918 +1 All feedback gratefully received! The PEP does not seem to specify how handler are retrieved by

Re: A new way to configure Python logging

2009-10-25 Thread Wolodja Wentland
On Sun, Oct 25, 2009 at 10:48 +, Vinay Sajip wrote: Wolodja Wentland wentland at cl.uni-heidelberg.de writes: [ HTMLHandler, multiple configuration files ] OK! I agree that these parts are hard to standardise and do not really belong in the *logging* module. Maybe a kind soul implements

Re: A new way to configure Python logging

2009-10-24 Thread Wolodja Wentland
On Sat, Oct 24, 2009 at 07:54 +, Vinay Sajip wrote: Wolodja Wentland wentland at cl.uni-heidelberg.de writes: [snip] foo |__bar |__baz |__newt |___witch I set every loggers log level to DEBUG and use the respective logger in You only need set foo's

Re: sequential multiple processes

2009-10-24 Thread Wolodja Wentland
On Sun, Oct 25, 2009 at 00:41 +0900, Hyunchul Kim wrote:  How to run multiple processes with sequential input of a thousand of data  in a script run?  I have a python script and 1,000 independent

Re: A new way to configure Python logging

2009-10-23 Thread Wolodja Wentland
) afterwards. My main idea is to see the configuration files not as the final configuration of the logging system but rather as a definition of the building blocks that can be plucked together easily programmatically if the developer sees the need to do so. with kind regards Wolodja Wentland

Re: Unicode again ... default codec ...

2009-10-22 Thread Wolodja Wentland
On Thu, Oct 22, 2009 at 13:59 +0200, Lele Gaifax wrote: Gabriel Genellina gagsl-...@yahoo.com.ar writes: unittest, or ultimately, this bug: http://bugs.python.org/issue4947 http://bugs.python.org/issue4947#msg87637 as the best fit, I think You might also want to have a look at:

[issue1293741] doctest runner cannot handle non-ascii characters

2009-10-21 Thread Wolodja Wentland
Wolodja Wentland wentl...@cl.uni-heidelberg.de added the comment: Here is some more information. --- snip --- Normal behaviour $ locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=POSIX LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=de_DE.UTF-8 LC_MESSAGES

[issue1293741] doctest runner cannot handle non-ascii characters

2009-10-21 Thread Wolodja Wentland
Changes by Wolodja Wentland wentl...@cl.uni-heidelberg.de: Added file: http://bugs.python.org/file15174/unicode_bug_literals.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1293741

Re: strange behaviour of colon within string

2009-10-19 Thread Wolodja Wentland
On Mon, Oct 19, 2009 at 05:44 -0700, khany wrote: i am relatively new to python and i am trying to convert a php app i have over to it using googleapps. Welcome! anyway here is the problem. i poll ebay API which has in its XML ? xml version=1.0 encoding=utf-8?findItemsAdvancedRequest

Re: Finding application data after install - a solution?

2009-09-25 Thread Wolodja Wentland
On Fri, Sep 25, 2009 at 02:24 -0300, Gabriel Genellina wrote: En Thu, 24 Sep 2009 08:21:59 -0300, Wolodja Wentland How do *you* deal with application data in your programs? Is there a way that works on as many platforms as possible? On linux, using a configuration file like /etc

Re: Finding application data after install - a solution?

2009-09-24 Thread Wolodja Wentland
On Thu, Sep 24, 2009 at 04:07 -0300, Gabriel Genellina wrote: I do not intentionally focus on UNIX type systems, but I have grown up with *nix and I rather follow one scheme than none at all. But the proposed way works on Windows as well, although the users might find previously unseen

Re: Finding application data after install - a solution?

2009-09-24 Thread Wolodja Wentland
On Thu, Sep 24, 2009 at 12:51 +0100, Tim Golden wrote: Wolodja Wentland wrote: Is CSIDL_COMMON_APPDATA and environment variable set on all Windows flavours? Certainly all those which Python currently supports. There are some small subtleties which have changed between older and newer

Re: pycopg2 build problems

2009-09-23 Thread Wolodja Wentland
On Wed, Sep 23, 2009 at 12:24 -0700, devaru wrote: I'm trying to install psycopg2 on my system. I followed the instruction in INSTALL file and gave the command python setup.py build running build running build_py running build_ext error: No such file or directory I ran into this some days

Re: pycopg2 build problems

2009-09-23 Thread Wolodja Wentland
On Wed, Sep 23, 2009 at 22:38 +0200, Wolodja Wentland wrote: --- Debian example --- $ apt-file search /usr/bin/pg_config libpq-dev: /usr/bin/pg_config --- snip --- Just wanted to note that libpq-dev is a dependency of postgresql-server-dev-8.4 on squeeze. So you *might* want to consider

Re: Finding application data after install - a solution?

2009-09-22 Thread Wolodja Wentland
On Tue, Sep 22, 2009 at 07:42 -0700, Aahz wrote: I want to: 1. Give administrators the freedom to install the data wherever they want 2. Adhere to the FHS (installing data within modules breaks it) 3. Be able to find that data again regardless of the installation

Re: Finding application data after install - a solution?

2009-09-21 Thread Wolodja Wentland
On Mon, Sep 21, 2009 at 23:52 -0300, Gabriel Genellina wrote: En Sat, 19 Sep 2009 12:03:52 -0300, Wolodja Wentland wentl...@cl.uni-heidelberg.de escribió: reliably finding distribution data from your program seems to be an unsolved issue for programs packaged with distutils. [...] Isn't

Re: Where are python module installed?

2009-09-20 Thread Wolodja Wentland
share ^^^ here with kind regards Wolodja Wentland signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

Finding application data after install - a solution?

2009-09-19 Thread Wolodja Wentland
scratch. The module detection logic and exception handling might need some work as well. ;-) I have the following questions: 1. Is the distutils 'API' i use here likely to break? 2. Can you think of a better way to do this? with kind regards Wolodja Wentland signature.asc Description