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

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

2010-02-06 Thread Wolodja Wentland
(5, 'c'), (6, 'c')] >>> next(k_instances) Traceback (most recent call last): File "", line 1, in StopIteration There are certainly millions of ways to do this and most of them will be better than my proposal here, but you might like this approach. Anoth

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 Wentland : :&#

Re: a problem with writing a generator

2010-01-14 Thread Wolodja Wentland
following slides 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 Wentland : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 9

Re: problem with multiprocessing and defaultdict

2010-01-12 Thread Wolodja Wentland
cessing.Manager() managed_dict = manager.dict() ... -- .''`. Wolodja Wentland : :' : `. `'` 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: share dictionary between processes

2009-12-18 Thread Wolodja Wentland
share_module.share("shared_dictionary", > creator.create_dictionary) > 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 i

Memory consumption of multiprocessing.Pool

2009-12-15 Thread Wolodja Wentland
se any memory in the pool processes? This is important as I don't always know when a pool is instanciated and the pool processes should *not* have the same memory requirements as the parent process. Am I missing something here? -- .''`. Wolodja Wentland : :'

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 > 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 a

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/ >

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 gra

Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
regards -- .''`. Wolodja Wentland : :' : `. `'` 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: [distutils] Install script under a different name

2009-12-05 Thread Wolodja Wentland
ng Distribute/setuptools though, ... [1] http://packages.python.org/distribute/setuptools.html#automatic-script-creation -- .''`. Wolodja Wentland : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC signature.a

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

2009-12-04 Thread Wolodja Wentland
uot;(1)" is not an integer, but an one-arity tuple ? The following might clarify the issue: >>> t = (1) >>> type(t) >>> t = (1,) >>> type(t) >>> t = 1, >>> type(t) It is the ',' not the '(' and ')' ...

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 > > 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 and are

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

2009-12-02 Thread Wolodja Wentland
ders that are still using Python 2.X and are used to the 'old way' to adapt 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 Wentland : :' :

Re: Python Programming Challenges for beginners?

2009-11-27 Thread Wolodja Wentland
gt; with sites like Code Chef...etc...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.pythonchalleng

Re: creating pipelines in python

2009-11-23 Thread Wolodja Wentland
package in the stdlib of Python 2.6. [1] http://www.dabeaz.com/generators/ -- .''`. Wolodja Wentland : :' : `. `'` 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
which mimics "tail -f" perfectly. It comes 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/ -- .''`. Wolo

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.g

Re: How can pip install a GitHub code drop?

2009-11-15 Thread Wolodja Wentland
ind regards Wolodja -- .''`. Wolodja Wentland : :' : `. `'` 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 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 > 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
requirement file would contain the following line: -e git+git://example.com/repo.git#egg=rep I hope this answers your questions :-D -- .''`. Wolodja Wentland : :' : `. `'` 4096R/CAF14EFC `- 081C B7CD FF04 2BA9 94EA 36B2 8B7F 7D30 CAF1 4EFC

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 > wrote: > > > http://docs.python.org/library/distutils.html#module-distutils > > http://packages.python.org/distribute/ > > ktx... now some utterly retarded questions to p

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

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 > 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 en

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 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. Therefore, I insist o

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

2009-10-31 Thread Wolodja Wentland
... else: raise ImportError, 'no os specific module found' sys.modules['os.path'] = path --- snip --- If you really want 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: 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=75599&r2=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 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 implem

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-24 Thread Wolodja Wentland
On Sat, Oct 24, 2009 at 07:54 +, Vinay Sajip wrote: > Wolodja Wentland cl.uni-heidelberg.de> writes: [snip] > > foo > > |__bar > > |__baz > > |__newt > > |___witch > > > > I set every loggers log level to DEBUG and u

Re: A new way to configure Python logging

2009-10-23 Thread Wolodja Wentland
command line have been parsed and does not change (often) 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 t

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" 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: http://bugs.python.org/iss

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"?> xmlns="http://www.ebay.co

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 configurat

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 c

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: 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

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

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 installati

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 > escribió: > > >reliably finding distribution data from your program seems to be an > >unsolved issue for programs packaged with distutils. [...] >

Re: Where are python module installed?

2009-09-20 Thread Wolodja Wentland
? Yes. > $ ls > bin include lib 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
e a complicated API that relies on externally managed information or __file__ hacks. Before you copy this i should note that i plan to use string templates within 'build_info' and just substitute the wanted information and not generate the whole file from scratch. The module detection lo