Re: Advanced Python Programming Oxford Lectures [was: Re: *Advanced* Python book?]

2010-03-25 Thread Michele Simionato
On Mar 25, 1:28 pm, Ethan Furman wrote: > > Michele, > > Was wondering if you'd had a chance to re-post your lectures -- just did > a search for them and came up empty, and I would love to read them! > > Many thanks in advance! Oops, I forgot! I will try to make them available soon. -- http://ma

Re: Advanced Python Programming Oxford Lectures [was: Re: *Advanced* Python book?]

2010-03-26 Thread Michele Simionato
On Mar 25, 2:24 pm, Michele Simionato wrote: > On Mar 25, 1:28 pm, Ethan Furman wrote: > > > > > Michele, > > > Was wondering if you'd had a chance to re-post your lectures -- just did > > a search for them and came up empty, and I would love to read them!

Re: function decorator-like function

2010-03-28 Thread Michele Simionato
Another option is to use my own decorator module (http:// pypi.python.org/pypi/decorator): from decorator import decorator @decorator def d(func, *args): print 3 return func(*args) @d def f(a, b): print a + b f(5, 7) -- http://mail.python.org/mailman/listinfo/python-list

STARTTLS extension not supported by server

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

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

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

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
you can attach properties to it. You have a good chance of not breaking anything 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
techniques, so I am not sure how much my gut feeling is sound. Apparently 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 langu

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 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 to check stacks of threads and lock status. > But I don't know how to do it in python. > > -- > Best Regards, > Le

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: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 8:25 am, Alice Bevan–McGregor 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 everybody is reinventing

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 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 wrote: > Michele Simionato wrote: > > On Jan 11, 4:06 pm, Alice Bevan McGregor wrote: > > >> Plac appears (from the documentation) to be written on top of argparse. > >>  :( > > > And the problem with that being wh

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 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 main(verbose: ('prints mor

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 6:57 pm, Mike wrote: > On Jan 11, 11:26 am, Michele Simionato > 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 are

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 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 weird.  ;) > > One

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

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

doctests working both in Python 2.X and Python 3.X

2010-04-11 Thread Michele Simionato
I do not want to write two documentations for a module working both in Python 2.X and Python 3.X. To avoid that, I would need the ability to interpret doctests according to the used Python version. I mean something like that: """ Documentation of the module --

Sphinx hosting

2010-05-03 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-03 Thread Michele Simionato
On May 4, 8:07 am, "Martin v. Loewis" 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 (http://pypi.python.org/pypi/decorator) the suppor

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 4, 8:37 am, "Martin v. Loewis" 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_edit&name=decorator > > and provide a zip file at Upload Documentation. > > R

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 4, 9:48 am, James Mills wrote: > On Tue, May 4, 2010 at 5:27 PM, Michele Simionato > > wrote: > > Cool, that's good to know. I am still accepting recommendations for > > non-Python projects ;) > > bitbucket (1) also provide static file hosting through th

Re: Sphinx hosting

2010-05-04 Thread Michele Simionato
On May 5, 6:39 am, James Mills wrote: > On Wed, May 5, 2010 at 2:08 PM, Michele Simionato > > wrote: > > Interesting. I tried to see if the same was true for the Wiki in > > Google code but apparently it does not work. Does anybody here know if > > it is possible

Re: Sphinx hosting

2010-05-10 Thread Michele Simionato
On May 5, 8:00 am, James Mills wrote: > On Wed, May 5, 2010 at 3:35 PM, Michele Simionato > > 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  it > > works in BitBucket and

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 callba

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

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
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: Generator expressions vs. comprehensions

2010-05-24 Thread Michele Simionato
On May 25, 12:47 am, Carl Banks 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 would complicate ite

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 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 to support Pyt

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" 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] >         sys.exi

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 12:03 pm, Giampaolo Rodolà 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 was designed to

Re: asyncore loop and cmdloop problem

2010-05-25 Thread Michele Simionato
On May 25, 2:56 pm, "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 library? Likel

plac, the easiest command line arguments parser in the world

2010-06-01 Thread Michele Simionato
rg $ python example.py arg1 arg2 usage: example.py [-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

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 wrote: > Tim Golden 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 plac a run and see how it behaves.

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 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 told him that t

Re: functools.wraps and help()

2010-06-02 Thread Michele Simionato
On Jun 2, 2:20 pm, Ulrich Eckhardt 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 > function takes, which

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 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://pypi.python.org/pypi/C

Re: Python Forum

2010-06-03 Thread Michele Simionato
On Jun 3, 12:28 pm, "Martin P. Hellwig" 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 Groups interface and I a

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 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 message, an

Re: optparse: best way

2010-06-08 Thread Michele Simionato
On Jun 8, 10:38 am, hiral 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', dest=exe_file..

Re: Overriding "__setattr__" of a module - possible?

2010-06-15 Thread Michele Simionato
On Jun 16, 4:43 am, John Nagle 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, "__setattr__", m

Re: Overriding "__setattr__" of a module - possible?

2010-06-15 Thread Michele Simionato
On Jun 16, 7:25 am, John Nagle 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 sys.modules[module.

plac 0.5 is out!

2010-06-20 Thread Michele Simionato
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 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 support is already t

Re: plac 0.5 is out!

2010-06-20 Thread Michele Simionato
On Jun 20, 8:26 pm, Andre Alexander Bell 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. :( Aa

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 3:30 pm, dirknbr 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", >                       default=10, ty

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 9:56 pm, Ben Finney wrote: > Michele Simionato 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 > > * optparse

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 11:47 pm, rantingrick 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 arg.startswith('-'):

Re: I strongly dislike Python 3

2010-06-30 Thread Michele Simionato
On Jun 30, 2:52 pm, Lie Ryan 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 debu

Re: C interpreter in Lisp/scheme/python

2010-07-07 Thread Michele Simionato
an *embedded* language: 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 wrote: > On Jul 7, 1:31 am, Paul McGuire 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 leave behind my faithful pre-2.6 user

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: Code generator and visitor pattern

2010-07-16 Thread Michele Simionato
or parsing XML data) work exactly that way. Actually one of the motivating examples for the introduction of generators in Python was their use in flattening data structure, i.e. exactly the pattern used by os.walk. The message 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

Re: linux console command line history

2010-07-20 Thread Michele Simionato
On Jul 20, 11:38 pm, "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 press th

Re: understanding the mro (long)

2010-07-23 Thread Michele Simionato
On Jul 24, 4:42 am, Rolando Espinoza La Fuente 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 do not know i

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: Multiprocessing zombie processes

2010-07-26 Thread Michele Simionato
On Jul 25, 1:11 am, Navkirat Singh 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 joined it becom

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

2010-08-01 Thread Michele Simionato
On Jul 31, 5:08 am, Steven D'Aprano 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 idea that there is ONE > superclass

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

2010-08-02 Thread Michele Simionato
On Aug 1, 1:08 pm, News123 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 solved as follo

Re: 79 chars or more?

2010-08-17 Thread Michele Simionato
my Emacs is set to 79 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: a problem with concurrency

2009-06-05 Thread Michele Simionato
On Fri, Jun 5, 2009 at 2:59 PM, Tim Chase wrote: > The common way to do this is to not bother with the "somebody else is > editing this record" because it's nearly impossible with the stateless web > to determine when somebody has stopped browsing a web page.  Instead, each > record simply has a "

Re: Odd closure issue for generators

2009-06-05 Thread Michele Simionato
On Jun 6, 12:06 am, Terry Reedy wrote: > Brian Quinlan wrote: > > > Sorry, I wasn't as precise as I should have been. > > > If you consider this example: > > ( for x in y) > > > I thought that every time that was evaluated, it would be done in > > a new closure with x bound to the value of x at t

Re: doctests and decorators

2009-06-16 Thread Michele Simionato
On Jun 16, 6:39 pm, Eric Snow wrote: > On Jun 16, 10:31 am, Christian Heimes wrote: > > > > > Eric Snow schrieb: > > > > Apparently there is a known issue with doctests, in which tests in > > > functions using externally defined decorators are ignored.  The > > > recommended fix is to update the

Re: Best way to enumerate classes in a module

2009-06-26 Thread Michele Simionato
On Jun 24, 7:07 pm, Terry Reedy wrote: > Дамјан Георгиевски wrote: > > I need to programmaticaly enumerate all the classes in a given module. > > Currently I'm using dir(module) but the Notice on the documentation page > > [1]  says "dir() is supplied primarily as a convenience for use at an > > i

Re: invoking a method from two superclasses

2009-07-01 Thread Michele Simionato
On Jul 1, 2:34 am, Mitchell L Model wrote: > I suspect we should have a Multiple Inheritance HOWTO, though details and > recommendations would be controversial. I've accumulated lots of abstract > examples along the lines of my question, using multiple inheritance both to > create combination clas

Re: Custom namespaces

2009-08-06 Thread Michele Simionato
On Aug 2, 6:46 am, Chris Rebert wrote: > > Is there any way to install a custom type as a namespace? > > For classes/objects, yes, using metaclasses. > See the __prepare__() method in PEP > 3115:http://www.python.org/dev/peps/pep-3115/ Here is an example of usage: http://www.artima.com/weblogs/

Re: Generate a new object each time a name is imported

2009-08-06 Thread Michele Simionato
On Aug 2, 1:18 pm, Paul Rubin wrote: > Peter Otten <__pete...@web.de> writes: > > >>> import sys > > >>> sys.modules["yadda"] = A() > > OMG wow.  I bow to you.  But I'm not sure whether that's bowing in > awe or in terror. I had to play this kind of tricks on our

Re: your favorite debugging tool?

2009-08-25 Thread Michele Simionato
On Aug 22, 4:25 pm, Esmail wrote: > Hi all, > > What is your favorite tool to help you debug your > code? The times when I would just use 'print' are long past. Nowadays I spend lots of my time with code written by others than myself. I use pdb all the time, and now also ipdb (ipdb is very cool i

Re: recursive decorator

2009-09-03 Thread Michele Simionato
On Sep 3, 12:19 am, Ethan Furman wrote: > Greetings, List! > > The recent thread about a recursive function in a class definition led > me back to a post about bindfunc from Arnaud, and from there I found > Michele Simionato's decorator module (many thanks! :-), and from there I > began to wonder.

Re: Entry Level Python Jobs

2009-09-03 Thread Michele Simionato
On Sep 2, 5:31 pm, JonathanB wrote: > I am a self-taught Python programmer with a liberal arts degree (Cross- > cultural studies). I have been programming for several years now and > would like to get a job as a python programmer. Unfortunately most of > the job posts I have seen are for CS Majors

Re: recursive decorator

2009-09-04 Thread Michele Simionato
return x*recur(x-1) print f(4) # =>24 Please accept this without explanation since it would take me a lot of time to explain how it works. Just accept that bytecode hacks are incredible (and nonportable too) ;-) Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: recursive decorator

2009-09-04 Thread Michele Simionato
On Sep 4, 7:03 pm, Ethan Furman wrote: > Just to verify, using the decorator module is portable, yes? Yes, it is portable. BTW, here is what you want to do (requires decorator-3.1.2): from decorator import FunctionMaker def bindfunc(f): name = f.__name__ signature = ', '.join(FunctionM

Re: recursive decorator

2009-09-05 Thread Michele Simionato
> def enable_recur(f): >     print f.func_code.co_names >     if 'recur' not in f.func_code.co_names: >         return f # do nothing on non-recursive functions >     c = Code.from_code(f.func_code) >     c.code[1:1] = [(LOAD_GLOBAL, f.__name__), (STORE_FAST, 'recur')] >     for i, (opcode, value)

Re: Threading.py Class Syntax and Super

2009-09-16 Thread Michele Simionato
On Sep 16, 12:23 pm, Casey wrote: > Hi, > > I noticed that the many (if not all) classes in threading.py[1] all > inherit from object, yet non of the init methods call super(). I am > curious as to why this is the chosen implementation? If the benefit of > new-style classes is to support multiple

Re: recommendation for webapp testing?

2009-09-16 Thread Michele Simionato
On Sep 16, 7:00 am, Schif Schaf wrote: > Hi, > > I need to do some basic website testing (log into account, add item to > cart, fill out and submit forms, check out, etc.). What modules would > be good to use for webapp testing like this? > > From a bit of searching, it looks like twill was used f

Re: recommendation for webapp testing?

2009-09-17 Thread Michele Simionato
On Sep 17, 4:21 am, Schif Schaf wrote: > After some more searching I found Mechanize (a Python version of > Perl's WWW::Mechanize): > > http://wwwsearch.sourceforge.net/mechanize/ > > Anyone here tried it? Twill uses mechanize internally. -- http://mail.python.org/mailman/listinfo/python-list

Re: Most "active" coroutine library project?

2009-09-24 Thread Michele Simionato
On Aug 23, 5:02 pm, Phillip B Oldham wrote: > I've been taking a look at the multitude of coroutine libraries > available for Python, but from the looks of the projects they all seem > to be rather "quiet". I'd like to pick one up to use on a current > project but can't deduce which is the most po

Re: is this whiff/wsgi claim true?

2009-09-25 Thread Michele Simionato
On Sep 25, 4:26 pm, Aaron Watters wrote: > Hi folks.  I just modified the WHIFF concepts index page > >    http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts > > To include the following paragraph with a startling and arrogant > claim in the final sentence :) > > """ > Developers build WHIFF

Re: Most "active" coroutine library project?

2009-09-25 Thread Michele Simionato
On Sep 23, 11:53 pm, exar...@twistedmatrix.com wrote: > I specifically left out all "yield" statements in my version, since > that's exactly the point here. :)  With "real" coroutines, they're not > necessary - coroutine calls look just like any other call. Personally, I like the yield. I understa

Re: Structured programming with optionParser

2010-08-30 Thread Michele Simionato
On Aug 31, 3:45 am, NickC 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 removing most of the boilerp

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 clas

Re: argparse list

2010-09-02 Thread Michele Simionato
On Sep 2, 1:45 pm, Neal Becker 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 easiest approach?

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

2010-09-21 Thread Michele Simionato
Python. But the situation is not different for other languages such as Perl 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: 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 = plac.parser_from(main).forma

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 matched

Re: A good decorator library

2010-10-23 Thread Michele Simionato
On Oct 22, 10:42 pm, Felipe Bastos Nunes 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 programming it in py

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 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: How to get dynamically-created fxn's source?

2010-11-09 Thread Michele Simionato
On Nov 5, 5:55 pm, gb345 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 preserve a textu

sqlite3 is non-transactional??

2017-06-15 Thread Michele Simionato
erted in script1, since they are part of the same transaction. Instead they are not removed! Can somebody share some light on this? I discover the issue while 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: 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

Decorating coroutines

2017-07-15 Thread Michele Simionato
errors or strange behaviors. I 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: 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 un

<    4   5   6   7   8   9