Re: ANN: decorator 4.2.0

2018-01-17 Thread Michele Simionato
On Monday, January 15, 2018 at 2:20:15 PM UTC+1, Michele Simionato wrote: > Dear all, > > a new release of the decorator module is out. The new feature is a simple > facility to define parametric families of decorators (aka decorators with > arguments). > > Here a

ANN: decorator 4.2.0

2018-01-15 Thread Michele Simionato
Dear all, a new release of the decorator module is out. The new feature is a simple facility to define parametric families of decorators (aka decorators with arguments). Here are the relevant links: Download: https://pypi.python.org/pypi/decorator/4.2.0 Project:

Re: Let's talk about debuggers!

2017-10-25 Thread Michele Simionato
pdb plus plus: https://pypi.python.org/pypi/pdbpp -- https://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing shows no benefit

2017-10-20 Thread Michele Simionato
There is a trick that I use when data transfer is the performance killer. Just save your big array first (for instance on and .hdf5 file) and send to the workers the indices to retrieve the portion of the array you are interested in instead of the actual subarray. Anyway there are cases where

Re: Users of namedtuple: do you use the _source attribute?

2017-07-17 Thread Michele Simionato
Il giorno lunedì 17 luglio 2017 19:20:04 UTC+2, Steve D'Aprano ha scritto: > collections.namedtuple generates a new class using exec, and records the > source > code for the class as a _source attribute. > > Although it has a leading underscore, it is actually a public attribute. The > leading

decorator 4.1 is out

2017-07-17 Thread Michele Simionato
Dear all, a new release of the decorator module is out. For the first time we support decorating Python 3.5 coroutines. For instance, this is an example of how to implement a tracing decorator called log_start_stop that you can use for debugging: import time import logging from asyncio import

Decorating coroutines

2017-07-15 Thread Michele Simionato
am not aware of any issues, but one is never sure with new features. Thanks for your help, Michele Simionato -- https://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 is non-transactional??

2017-06-15 Thread Michele Simionato
Thanks. I suspected the culprit was executescript, but I did not see it documented in https://docs.python.org/3/library/sqlite3.html#connection-objects. -- https://mail.python.org/mailman/listinfo/python-list

sqlite3 is non-transactional??

2017-06-15 Thread Michele Simionato
porting some code from PostgreSQL to sqlite3, with Postgres doing the right thing and sqlite failing. I am puzzled, Michele Simionato -- https://mail.python.org/mailman/listinfo/python-list

Re: argparse and subparsers

2016-06-28 Thread Michele Simionato
I did not know about docopt. It is basically the same idea of this recipe I wrote about 12 years ago: https://code.activestate.com/recipes/278844-parsing-the-command-line/?in=user-1122360 Good that it was reinvented :-) -- https://mail.python.org/mailman/listinfo/python-list

ANN: plac 0.9.3

2016-06-08 Thread Michele Simionato
://github.com/micheles/plac/blob/0.9.3/doc/plac.pdf Michele Simionato -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

Decorator 4.0.10

2016-06-07 Thread Michele Simionato
I have released a new version of the decorator module with an improved documentation, thanks also to the nice CSS submitted by Tony Goodchild. If you are a long time user of the module, see what's new at http://pythonhosted.org/decorator/documentation.html --

Re: Recommendation for Object-Oriented systems to study

2016-05-29 Thread Michele Simionato
On Sunday, May 29, 2016 at 4:42:17 PM UTC+2, Ankush Thakur wrote: > Hello, > > I'm a self-taught programmer who has managed to claw his way out of Python > basics and even covered the intermediate parts. But I feel I have a ton of > theory in my head and would like to see some smallish

Re: XML Binding

2015-09-11 Thread Michele Simionato
On Thursday, September 3, 2015 at 6:55:06 PM UTC+2, Palpandi wrote: > Hi All, > > Is there any module available in python standard library for XML binding? If > not, any other suggestions. > > Which is good for parsing large file? > 1. XML binding > 2. Creating our own classes > > > Thanks, >

Re: ANN: decorator-4.0.0 released

2015-07-24 Thread Michele Simionato
Ops! Cut and paste error from an old announcement. Of course now there is a single documentation both for Python 2 and 3, so the only valid link is https://github.com/micheles/decorator/blob/4.0.0/documentation.rst -- https://mail.python.org/mailman/listinfo/python-announce-list

ANN: decorator-4.0.0 released

2015-07-24 Thread Michele Simionato
simpler; moreover all the decorators involved preserve the signature of the decorated functions. Enjoy! Michele Simionato -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

ANN: decorator 3.4.1

2015-03-16 Thread Michele Simionato
on several Python versions at the same time: https://travis-ci.org/micheles/decorator/builds/54584865 Enjoy! Michele Simionato -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

Re: Python Object Systems

2014-08-14 Thread Michele Simionato
Il giorno mercoledì 13 agosto 2014 19:13:16 UTC+2, thequie...@gmail.com ha scritto: What is the difference between traits and roles? People keep using the same names to mean different concepts. For me traits are the things described here:

Re: Python Object Systems

2014-08-13 Thread Michele Simionato
Years ago I wrote strait: https://pypi.python.org/pypi/strait I wonder who is using it and for what purpose, since surprisingly enough it has 50+ downloads per day. For me it was more of an experiment than a real project. -- https://mail.python.org/mailman/listinfo/python-list

Trying to understand the memory occupation of big lists

2013-05-03 Thread Michele Simionato
I have a memory leak in a program using big arrays. With the goal of debugging it I run into the memory_profiler module. Then I discovered something which is surprising to me. Please consider the following script: $ cat memtest.py import gc from memory_profiler import profile @profile def

Re: Decorating functions without losing their signatures

2013-04-03 Thread Michele Simionato
On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote: After thinking about it for a while I've come up with the following abomination Alas, there is actually no good way to implement this feature in pure Python without abominations. Internally the decorator module does something

Re: Testing against multiple versions of Python

2012-10-19 Thread Michele Simionato
ShiningPanda looks really really cool. I need to investigate it. -- http://mail.python.org/mailman/listinfo/python-list

Testing against multiple versions of Python

2012-10-18 Thread Michele Simionato
is welcome! Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

surprising behaviour of global dictionaries

2012-10-09 Thread Michele Simionato
I have the following module implementing a registry of functions with a decorator: $ cat x.py registry = {} # global dictionary def dec(func): registry[func.__name__] = func print registry, id(registry) return func if __name__ == '__main__': import xlib print registry,

Re: surprising behaviour of global dictionaries

2012-10-09 Thread Michele Simionato
On Tuesday, October 9, 2012 5:24:17 PM UTC+2, Peter Otten wrote: Seriously, you shouldn't use the main script as a library; it is put into the sys.modules cache under the __main__ key. Subsequent imports under its real name will not find that name in the cache and import another instance

Re: Style question: metaclass self vs cls?

2012-07-17 Thread Michele Simionato
The standard is to use `cls`. In the __new__ method you can use `mcl` or `meta`. -- http://mail.python.org/mailman/listinfo/python-list

A better contextlib.contextmanager

2012-05-23 Thread Michele Simionato
Python 3.2 enhanced contextlib.contextmanager so that it is possible to use a context manager as a decorator. For instance, given the contextmanager factory below @contextmanager def before_after(): print(before) yield print(after) it is possibile to use it to generate decorators:

Re: Instrumenting a class to see how it is used

2012-05-14 Thread Michele Simionato
This may get you started (warning: not really tested). $ echo instr.py from warnings import warn oget = object.__getattribute__ tget = type.__getattribute__ class Instr(object): class __metaclass__(type): def __getattribute__(cls, name): clsname = tget(cls,

Re: Hierarchical commnd line parsing / help texts

2011-09-28 Thread Michele Simionato
plac is based on argparser and it is intended to be much easier to use. See http://plac.googlecode.com/hg/doc/plac.html Here is an example of usage. $ cat vcs.py class VCS(object): A fictitious version control tool commands = ['checkout', 'commit'] def checkout(self, url):

Re: Argparse, and linking to methods in Subclasses

2011-07-18 Thread Michele Simionato
Here is an example by using my own library plac (http://pypi.python.org/pypi/plac): class Server(): def configure_logging(self, logging_file): pass def check(self): pass def deploy(self): pass def configure(self): pass def __init__(self,

Re: Class decorators might also be super too

2011-05-29 Thread Michele Simionato
He is basically showing that using mixins for implementing logging is not such a good idea, i.e. you can get the same effect in a better way by making use of other Python features. I argued the same thing many times in the past. I even wrote a module once (strait) to reimplement 99% of multiple

Re: Python's super() considered super!

2011-05-27 Thread Michele Simionato
On Friday, May 27, 2011 10:49:52 AM UTC+2, Ben Finney wrote: The exquisite care that you describe programmers needing to maintain is IMO just as much a deterrent as the super-is-harmful essay. Worth quoting. Also I think this article may encourage naive programmers along the dark path of

Re: Python's super() considered super!

2011-05-27 Thread Michele Simionato
The fact that even experienced programmers fail to see that super(type(self),self) in Python 2 is NOT equivalent to super() in Python 3 is telling something. -- http://mail.python.org/mailman/listinfo/python-list

Re: Markdown to reStructuredText

2011-02-10 Thread Michele Simionato
Looks cool, I will have a look at it, thanks! -- http://mail.python.org/mailman/listinfo/python-list

Markdown to reStructuredText

2011-02-09 Thread Michele Simionato
Do you know if there is any converter from the Markdown syntax to the rst syntax? Googling for markdown2rst did not help. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: DRY and static attribute for multiple classes.

2011-02-02 Thread Michele Simionato
Notice that Peter's approach also works without inheritance: registries = {} @property def per_class(self): cls = type(self) try: return registries[cls] except KeyError: result = registries[cls] = [] return result class A(object): per_class=per_class class B(object):

Re: Ideas for a module to process command line arguments

2011-01-13 Thread Michele Simionato
On Jan 12, 6:09 pm, Alice Bevan–McGregor al...@gothcandy.com wrote: entirely sure what you mean by 'smart' options.  If your'e referring to using a single hyphen and a list of characters to represent a long option (which, to the rest of the world, use two leading hyphens) then that's pretty

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 8:25 am, Alice Bevan–McGregor al...@gothcandy.com wrote: explicit callbacks or typecasting functions, etc. I got tired of using PasteScript and OptParse.  Mostly OptParse, actually.  :/ It's a pity that the argument parsing modules in the standard library are so verbose that

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 4:06 pm, Alice Bevan–McGregor al...@gothcandy.com wrote: Plac appears (from the documentation) to be written on top of argparse.  :( And the problem with that being what? -- http://mail.python.org/mailman/listinfo/python-list

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 5:22 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Michele Simionato wrote: On Jan 11, 4:06 pm, Alice Bevan McGregor al...@gothcandy.com wrote: Plac appears (from the documentation) to be written on top of argparse.  :( And the problem with that being what

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 4:06 pm, Alice Bevan–McGregor al...@gothcandy.com wrote: After looking into it, Plac's default help display isn't very helpful; you need to massage your application a fair amount before generating nice, complete-looking argument lists and such.  For example:         def

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 6:57 pm, Mike ter...@gmail.com wrote: On Jan 11, 11:26 am, Michele Simionato michele.simion...@gmail.com wrote: In that case easy_install/pip/whatever will install the dependency automatically (who is installing dependencies by hand nowadays?). I do. Is this bad? :} You

decorator 3.3 is out

2011-01-01 Thread Michele Simionato
Python 3 and function annotations you may want to try out the new decorator module (easy_install decorator) and give me feedback. See http://pypi.python.org/pypi/decorator for more. Thanks for your time and Happy New Year to all fellows Pythonistas! Michele Simionato P.S. today I have

Re: STARTTLS extension not supported by server

2010-11-29 Thread Michele Simionato
For future googlers: it turns out in my case the call to .starttls() was not needed: I removed it and everything worked. Dunno why I was there in the first place, the original code was written by somebody else. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using property() to extend Tkinter classes but Tkinter classes are old-style classes?

2010-11-29 Thread Michele Simionato
in doing so, but you cannot know for sure unless you try. I don't know if Tkinter uses features of old-style classes which are inconsistent with new- style classes, but probably the answer is not much. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-29 Thread Michele Simionato
here at work we are going to use Erlang in the near future and I hope to get my hand dirty and see in practice how well one can work with a language without inheritance. BTW, is there anybody here with experience on such languages and caring to share his learned lessons? Michele

Re: How do you find out what's happening in a process?

2010-11-29 Thread Michele Simionato
On Nov 29, 7:01 am, Leo Jay python.leo...@gmail.com wrote: Hi all, I'd like to know how do you guys find out what's happening in your code if the process seems not work. In java, I will use jstack pid to check stacks of threads and lock status. But I don't know how to do it in python. --

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-26 Thread Michele Simionato
not know of other use cases either. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

STARTTLS extension not supported by server

2010-11-15 Thread Michele Simionato
and to figure out where the problem is? TIA, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get dynamically-created fxn's source?

2010-11-09 Thread Michele Simionato
On Nov 5, 5:55 pm, gb345 gb...@invalid.com wrote: For a project I'm working on I need a way to retrieve the source code of dynamically generated Python functions.  (These functions are implemented dynamically in order to simulate partial application in Python.[1])  The ultimate goal is to

Re: Best method for a menu in a command line program?

2010-11-04 Thread Michele Simionato
On Nov 4, 2:19 am, braden faulkner brf...@gmail.com wrote: I'm using a menu for my command line app using this method. choice = foobar while choice != q:     if choice == c:         temp = input(Celsius temperature:)         print Fahrenheit:,celsius_to_fahrenheit(temp)     elif choice ==

Re: A good decorator library

2010-10-23 Thread Michele Simionato
On Oct 22, 10:42 pm, Felipe Bastos Nunes felipe.bast...@gmail.com wrote: Hi! I was looking for a good decorator library to study and make my own decorators. I've read the Bruce Eckel's blog at artima dot com. But I need some more examples. I'm building a WSN simulator like SHOX is in java, but

Re: using optparser

2010-10-16 Thread Michele Simionato
Accepting both options and positional arguments for the same purpose does not look like a good idea to me. Anyway, here is a solution using plac (http://pypi.python.org/pypi/ plac) assuming you can afford an external dependency: import plac @plac.annotations( personname=(person to be

Re: optparser: how to register callback to display binary's help

2010-10-13 Thread Michele Simionato
Here is a solution using plac (http://pypi.python.org/pypi/plac) and not OptionParse, in the case the Linux underlying command is grep: import subprocess import plac @plac.annotations(help=('show help', 'flag', 'h')) def main(help): if help: script_usage =

Re: Python in Linux - barrier to Python 3.x

2010-09-21 Thread Michele Simionato
or Ruby. C is free from this problem because it is a very old and stable language. There is no more content in that post and everybody should already know such basic facts. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: argparse list

2010-09-02 Thread Michele Simionato
On Sep 2, 1:45 pm, Neal Becker ndbeck...@gmail.com wrote: I'm interested in using argparse to parse a string formatted as: my_prog --option1=1,10,37 That is, a list of comma delimited values.  I guess nargs almost does it, but expects options to be space-delimited. What would be the

Re: Structured programming with optionParser

2010-08-30 Thread Michele Simionato
On Aug 31, 3:45 am, NickC reply...@works.fine.invalid wrote: I'm struggling to see how you could refactor the option parsing function. After all, it has to process the options, so it has to do all the setup for those options, and then process them. Perhaps plac could simplify your life, by

Re: Structured programming with optionParser

2010-08-30 Thread Michele Simionato
Perhaps, I should give an example of using plac. For instance, here is how you could implement a SVN-like tool with two commands ``checkout`` and ``commit``. The trick is to write a class with two methods ``checkout`` and ``commit`` and an attribute ``.commands`` listing them, and to call the

Re: 79 chars or more?

2010-08-17 Thread Michele Simionato
chars and longer code looks ugly, that I look at two-side diffs all the time, and that sometimes I want to print on paper the code I have to work with. OTOH, I do not see a single advantage in using long lines. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Michele Simionato
On Jul 31, 5:08 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: I have read Michelle Simionato's articles on super in Python. One l please! I am a man! ;-) But Michelle is wrong to conclude that the problem lies with the concept of *superclass*. The problem lies with the

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-02 Thread Michele Simionato
On Aug 1, 1:08 pm, News123 news1...@free.fr wrote: I wondered, whether there's a simple/standard way to let the Optionparser just ignore unknown command line switches. thanks in advance for any ideas I will plug in my own work on plac: http://pypi.python.org/pypi/plac Your problem would be

Re: Multiprocessing zombie processes

2010-07-26 Thread Michele Simionato
On Jul 25, 1:11 am, Navkirat Singh navkir...@gmail.com wrote: OK I wanted zombie processes and have been able to regenerate them with multiprocessing. Now lets see how I can handle them. The multiprocessing docs say: Joining zombie processes On Unix when a process finishes but has not been

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-25 Thread Michele Simionato
Everything you ever wanted to know about super is collected here: http://micheles.googlecode.com/hg/artima/python/super.pdf M.S. -- http://mail.python.org/mailman/listinfo/python-list

Re: understanding the mro (long)

2010-07-24 Thread Michele Simionato
On Jul 24, 4:42 am, Rolando Espinoza La Fuente dark...@gmail.com wrote: Finally everything make sense. And make think about be careful when doing multiple inheritance. Any thoughts? ~Rolando I am not fond of multiple inheritance either and I wrote at length about the dangers of it. If you

Re: linux console command line history

2010-07-21 Thread Michele Simionato
On Jul 20, 11:38 pm, kak...@gmail.com kak...@gmail.com wrote: Hi to all, I 'm writing a linux console app with sockets. It's basically a client app that fires commands in a server. For example: $log user 55 $sessions list $server list etc. What i want is, after entering some commands, to

Re: Code generator and visitor pattern

2010-07-16 Thread Michele Simionato
is stop thinking like in Java and start using idiomatic Python. We are here to help. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

multiline input and readline

2010-07-14 Thread Michele Simionato
like such function is wrapped in Python: what are my options? Notice that compatibility with pyreadline (which work on Windows) would be a plus. TIA, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: C interpreter in Lisp/scheme/python

2010-07-07 Thread Michele Simionato
: then thanks to macros you could write a *compiled* sublanguage. Doing the same in Python is essentially impossible. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)

2010-07-07 Thread Michele Simionato
On Jul 7, 10:55 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jul 7, 1:31 am, Paul McGuire pt...@austin.rr.com wrote: I just couldn't get through on the python-dev list that I couldn't just upgrade my code to 2.6 and then use 2to3 to keep in step across the 2-3 chasm, as this would

Re: I strongly dislike Python 3

2010-06-30 Thread Michele Simionato
On Jun 30, 2:52 pm, Lie Ryan lie.1...@gmail.com wrote: On 06/27/10 11:24, Steven D'Aprano wrote: Producing print function takes a little bit more effort than producing a print statement. (1) The main use-cases for print are quick (and usually dirty) scripts, interactive use, and as a

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 3:30 pm, dirknbr dirk...@gmail.com wrote: I get an int object is not callable TypeError when I execute this. But I don't understand why.     parser = optparse.OptionParser(usage: %lines [options] arg1)     parser.add_option(-l, --lines, dest=lines,                      

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 9:56 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Michele Simionato michele.simion...@gmail.com writes: optparse is so old-fashioned. Use plac! The OP should be made aware that: * plac is a third-party library with (TTBOMK) no prospect of inclusion   in the standard library

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 11:47 pm, rantingrick rantingr...@gmail.com wrote: Give your *script* an enema, and do *yourself* a favor by harnessing the simplistic elegance of the optphart module instead! #-- Start Script --# def optphart(args):     d = {'args':[]}     for arg in args:         if

plac 0.5 is out!

2010-06-20 Thread Michele Simionato
to Python 3.1, but the new features require Python 2.5. You can download it from PyPI ($ easy_install -U plac): http://pypi.python.org/pypi/plac Enjoy! Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: plac 0.5 is out!

2010-06-20 Thread Michele Simionato
On Jun 20, 12:02 pm, Andre Alexander Bell p...@andre-bell.de wrote: How about adding some support for internationalization of the generated usage output? The usage message of plac is actually generated by the underlying argparse library. argparse use gettext internally, so I would say the

Re: plac 0.5 is out!

2010-06-20 Thread Michele Simionato
On Jun 20, 8:26 pm, Andre Alexander Bell p...@andre-bell.de wrote: On 06/20/2010 11:22 AM, Michele Simionato wrote: A few weeks ago I presented on this list my most recent effort, plac.  http://micheles.googlecode.com/hg/plac/doc/plac_ext.html But this one is broken. :( Aagh! The good one

Re: Overriding __setattr__ of a module - possible?

2010-06-16 Thread Michele Simionato
On Jun 16, 7:25 am, John Nagle na...@animats.com wrote:     OK, working on this.  I can make a module make itself into a fake class, but can't yet do it to other modules from outside.                                         John Nagle I think you can with something like import module

Re: Overriding __setattr__ of a module - possible?

2010-06-15 Thread Michele Simionato
On Jun 16, 4:43 am, John Nagle na...@animats.com wrote:    Is it possible to override __setattr__ of a module?  I want to capture changes to global variables for debug purposes.    None of the following seem to have any effect.         modu.__setattr__ = myfn         setattr(modu,

Re: optparse: best way

2010-06-08 Thread Michele Simionato
On Jun 8, 10:38 am, hiral hiralsmaill...@gmail.com wrote: Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments     where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option(-oexe',

Re: Python Forum

2010-06-03 Thread Michele Simionato
On Jun 3, 12:28 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On the other hand it might not be so bad that you don't get questions from users here who are unable to use a nntp reader or news to mail service. I am unable to use a nntp reader or news to mail service. I use the Google

Re: plac, the easiest command line arguments parser in the world

2010-06-03 Thread Michele Simionato
On Jun 2, 6:37 am, Michele Simionato michele.simion...@gmail.com wrote: I would like to announce to the world the first public release of plac:  http://pypi.python.org/pypi/plac The second release is out. I have added the recognition of keyword arguments, improved the formatting of the help

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Michele Simionato
On Jun 2, 10:43 am, Paul Rubin no.em...@nospam.invalid wrote: Tim Golden m...@timgolden.me.uk writes: pattern, which provides a minimally semi-self-documenting approach for positional args, but I've always found the existing offerings just a little too much work to bother with. I'll give

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Michele Simionato
On Jun 2, 11:01 am, Stefan Behnel stefan...@behnel.de wrote: I managed to talk a Java-drilled collegue of mine into writing a Python script for a little command line utility, but he needed a way to organise his argument extraction code when the number of arguments started to grow beyond two. I

Re: functools.wraps and help()

2010-06-02 Thread Michele Simionato
On Jun 2, 2:20 pm, Ulrich Eckhardt eckha...@satorlaser.com wrote: Hi! When I use help() on a function, it displays the arguments of the function, along with the docstring. However, when wrapping the function using functools.wraps it only displays the arguments that the (internal) wrapper

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Michele Simionato
On Jun 2, 6:37 am, Michele Simionato michele.simion...@gmail.com wrote: With blatant immodesty, plac claims to be the easiest to use command line arguments parser module in the Python world It seems I have to take that claim back. A few hours after the announce I was pointed out to http

plac, the easiest command line arguments parser in the world

2010-06-01 Thread Michele Simionato
[-h] arg example.py: error: unrecognized arguments: arg2 You can find in the documentation a lot of other simple and not so simple examples: http://micheles.googlecode.com/hg/plac/doc/plac.html Enjoy! Michele Simionato P.S. answering an unspoken question: yes, we really needed yet

Re: Generator expressions vs. comprehensions

2010-05-25 Thread Michele Simionato
On May 25, 9:08 am, Peter Otten __pete...@web.de wrote: But the list comprehension is already non-equivalent to the for loop as the loop variable isn't leaked anymore. We do have three similar constructs with subtle differences. I think not turning the list-comp into syntactic sugar for

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 10:42 am, kak...@gmail.com kak...@gmail.com wrote: Hi to all, i'm creating a command line application using asyncore and cmd. At if __name__ == '__main__':     import socket     args = sys.argv[1:]     if not args:         print Usage: %s querystring % sys.argv[0]        

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 12:03 pm, Giampaolo Rodolà g.rod...@gmail.com wrote: Too bad cmdloop() doesn't provide an argument to return immediately. Why don't you submit this patch on the bug tracker? --- Giampaolohttp://code.google.com/p/pyftpdlibhttp://code.google.com/p/psutil Because it is not a bug, cmd

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 2:56 pm, kak...@gmail.com kak...@gmail.com wrote: Could you please provide me with a simple example how to do this with threads. I don't know where to put the cmdloop(). Please help, i' m so confused! Thank you What are you trying to do? Do you really need to use the standard

Re: Generator expressions vs. comprehensions

2010-05-24 Thread Michele Simionato
On May 25, 12:47 am, Carl Banks pavlovevide...@gmail.com wrote: The situation here is known.  It can't be corrected, even in Python 3, without modifying iterator protocol to tie StopIteration to a specific iterator.  This is possible and might be worth it to avoid hard-to- diagnose bugs but it

Re: help with the Python 3 version of the decorator module

2010-05-24 Thread Michele Simionato
On May 22, 10:49 am, Michele Simionato michele.simion...@gmail.com wrote: I have finally decided to port the decorator module to Python 3. Changing the module was zero effort (2to3 worked) but changing the documentation was quite an effort, since I had to wait for docutils/ pygements

help with the Python 3 version of the decorator module

2010-05-22 Thread Michele Simionato
from the building process, if any. I am not sure of what will happen if you do not have distribute or if you have a previous version of the module, or if you use pip or something else (even in Python 2.X). The packaging in Python has become a real mess! TIA for you help, Michele Simionato

Re: Another Go is Python-like article.

2010-05-22 Thread Michele Simionato
things which are quite different from Python e.g. the attitude towards exceptions. In theory Go should be akin to C, but my gut feeling is that in practice programming in it should not feel too much different from programming in Python (but I do not have first hand experience). Michele Simionato

Re: Is Python a functional programming language?

2010-05-11 Thread Michele Simionato
On May 10, 8:18 pm, a...@pythoncraft.com (Aahz) wrote: saying that functional features are tacked on understates the case.  Consider how frequently people reach for list comps and gen exps.  Function dispatch through dicts is the standard replacement for a switch statement.  Lambda callbacks

Re: Iterating over dict and removing some elements

2010-05-11 Thread Michele Simionato
Or you copy the whole dictionary or you just copy the keys: for k in d.keys(): ... or for k in list(d): ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Sphinx hosting

2010-05-10 Thread Michele Simionato
On May 5, 8:00 am, James Mills prolo...@shortcircuit.net.au wrote: On Wed, May 5, 2010 at 3:35 PM, Michele Simionato michele.simion...@gmail.com wrote: I am sure it has, but I was talking about just putting in the repository an index.html file and have it published, the wayI hear

Sphinx hosting

2010-05-04 Thread Michele Simionato
: it is not that annoying, but perhaps there is already some services out there publishing Sphinx pages directly. Do you know of any? Currently I am hosting my stuff on Google Code but I do not see an easy way to publish the documentation there. Any hint is appreciated. Michele Simionato -- http

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 4, 8:07 am, Martin v. Loewis mar...@v.loewis.de wrote: If it's a Python package that this documentation is about, you can host it on PyPI. It must not be Python, but let's consider this case first. How does it work? When I published my decorator module

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 4, 8:37 am, Martin v. Loewis mar...@v.loewis.de wrote: Do you know of recent improvements on the PyPI side about docs hosting? Yes; go to your package's pkg_edit page, i.e. http://pypi.python.org/pypi?%3Aaction=pkg_editname=decorator and provide a zip file at Upload Documentation.

  1   2   3   4   5   6   7   8   9   >