Re: Dynamic variable creation from string

2011-12-12 Thread alex23
On Dec 8, 3:09 am, Massi wrote: > in my script I have a dictionary whose items are couples in the form > (string, integer values), say > > D = {'a':1, 'b':2, 'c':3} > > This dictionary is passed to a function as a parameter, e.g. : > > def Sum(D) : >     return D['a']+D['b']+D['c'] > > Is there a

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Gregory Ewing
Steven D'Aprano wrote: Modulo is hardly an obscure operation. "What's the remainder...?" is a simple question that people learn about in primary school. Well, sort of. The way I remember it, the remainder was just something that fell out as a side effect of division -- the annoying bit left ov

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Gregory Ewing
For what it's worth, googling for "python asterisk" gives this as the very first result: http://www.technovelty.org/code/python/asterisk.html which tells you exactly what you're probably wanting to know if you ask that. To check that this phenomemon isn't restricted to asterisks in particular

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Terry Reedy
On 12/11/2011 6:53 PM, Eelco Hoogendoorn wrote: There are other means of finding information than Google. Really. This is really only a very minor point in my argument, so I dont want to put the focus on this. On the contrary, it is a major point. You want us to change the language so you ca

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Terry Reedy
On 12/11/2011 6:44 PM, Eelco Hoogendoorn wrote: Can you come up with some terse symbols that will be able to express all of the below and dont make you wish you hadnt rather typed out the names? head, tuple(tail) = iterable head, list(tail) = iterable head, str(tail) = somestring head, generato

Re: I love the decorator in Python!!!

2011-12-12 Thread Ethan Furman
alex23 wrote: On Dec 9, 8:08 pm, Robert Kern wrote: On 12/9/11 5:02 AM, alex23 wrote: The 3rd party 'decorator' module takes care of issues like docstrings & function signatures. I'd really like to see some of that functionality in the stdlib though. Much of it is: http://docs.python.org

Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco Hoogendoorn
The above examples are seldom needed in Python because we have one general method to repeatedly split a sequence into head and tail. it = iter(iterable) # 'it' now represents the sequenced iterable head = next(it) # 'it' now represents the tail after removing the head In other words, ne

Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco Hoogendoorn
> No more, or less, explicit than the difference between "==" and "is". == may be taken to mean identity comparison; 'equals' can only mean one thing. Of course 'formally' these symbols are well defined, but so is brainf*ck Modulo is hardly an obscure operation. "What's the remainder...?" i

Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco Hoogendoorn
On the contrary, it is a major point. You want us to change the language so you can program by Google. Sorry, aint't gonna happen. On the contrary; I believe I get to decide which points I consider important. This one, I do not. Sorry for putting it in the first paragraph. -- http://mail.pyt

Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco Hoogendoorn
> On the contrary, it is a major point. Sorry, but im affraid it is up to ME to decide which point I feel are important. No, this is a minor point to me, and one that has been admirably put to rest by pointing out that spelling out the name of the symbol in google directly leads you to the inf

Re: unittest. customizing tstloaders / discover()

2011-12-12 Thread Thomas Bach
Gelonida N writes: > Do I loose anything if using nose. or example can all unit tests / doc > tests still be run from nose? AFAIK you don't loose anything by using nose – the unittests should all be found and doctests can be run via `--with-doctest', I never used doctests though. regards -- ht

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Jussi Piitulainen
Eelco Hoogendoorn writes: > As for %; it is entirely unclear to me why that obscure operation > ever got its own one-character symbol. Ill take 'mod', or even > better, 'modulus' any day of the week. The modulus is not the result but one of the arguments: when numbers x and y are congruent modulo

Re: Overriding a global

2011-12-12 Thread Jean-Michel Pichavant
Roy Smith wrote: MRAB wrote: or use 'globals': def function(self): logger = globals()['logger'].getChild('function') logger.debug('stuff') logger.debug('other stuff') Ah-ha! That's precisely what I was looking for. Much appreciated. Using the sa

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
> The modulus is not the result but one of the arguments: when numbers x > and y are congruent modulo n (stated in terms of the modulo operation: > x mod n = y mod n), the modulus is n. A word for x mod n is remainder. > > I agree about the obscurity of using the percent sign as the operator. > > A

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
By the way... Is there any particular reason why some of my replies do not show up on groups.google, and some of them do not show up on mail.python.org? Sorry to annoy people with reposting, but im going to be forced to do some of that until this is cleared up -- http://mail.python.org/mailm

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Jussi Piitulainen
Eelco writes: > > The modulus is not the result but one of the arguments: when numbers x > > and y are congruent modulo n (stated in terms of the modulo operation: > > x mod n = y mod n), the modulus is n. A word for x mod n is remainder. > > > > I agree about the obscurity of using the percent si

Re: I love the decorator in Python!!!

2011-12-12 Thread 88888 Dihedral
On Monday, December 12, 2011 1:47:52 PM UTC+8, alex23 wrote: > On Dec 12, 2:51 pm, 8 Dihedral > wrote: > > To wrap a function properly is different from the 1-line lampda. > > > > This is really functional programming. > > > > Every function can be decorated to change into a different one easi

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
> No more, or less, explicit than the difference between "==" and "is". == may be taken to mean identity comparison; 'equals' can only mean one thing. Of course 'formally' these symbols are well defined, but so is brainf*ck > Modulo is hardly an obscure operation. "What's the remainder...?" is a

Re: Dynamic variable creation from string

2011-12-12 Thread 88888 Dihedral
On Monday, December 12, 2011 3:11:18 PM UTC+8, alex23 wrote: > On Dec 8, 3:09 am, Massi wrote: > > in my script I have a dictionary whose items are couples in the form > > (string, integer values), say > > > > D = {'a':1, 'b':2, 'c':3} > > > > This dictionary is passed to a function as a parameter

Re: Dynamic variable creation from string

2011-12-12 Thread 88888 Dihedral
On Monday, December 12, 2011 3:11:18 PM UTC+8, alex23 wrote: > On Dec 8, 3:09 am, Massi wrote: > > in my script I have a dictionary whose items are couples in the form > > (string, integer values), say > > > > D = {'a':1, 'b':2, 'c':3} > > > > This dictionary is passed to a function as a parameter

Confusion about decorators

2011-12-12 Thread Henrik Faber
Hi group, I'm a bit confused regarding decorators. Recently started playing with them with Python3 and wanted (as an excercise) to implement a simple type checker first: I know there are lots of them out there, this is actually one of the reasons I chose that particular function (to compare my sol

Re: Confusion about decorators

2011-12-12 Thread Andrea Crotti
On 12/12/2011 01:27 PM, Henrik Faber wrote: Hi group, I'm a bit confused regarding decorators. Recently started playing with them with Python3 and wanted (as an excercise) to implement a simple type checker first: I know there are lots of them out there, this is actually one of the reasons I cho

Re: Confusion about decorators

2011-12-12 Thread Arnaud Delobelle
On 12 December 2011 13:27, Henrik Faber wrote: > Hi group, > > I'm a bit confused regarding decorators. Recently started playing with > them with Python3 and wanted (as an excercise) to implement a simple > type checker first: I know there are lots of them out there, this is > actually one of the

Re: Confusion about decorators

2011-12-12 Thread Henrik Faber
On 12.12.2011 14:37, Andrea Crotti wrote: > On 12/12/2011 01:27 PM, Henrik Faber wrote: >> Hi group, >> >> I'm a bit confused regarding decorators. Recently started playing with >> them with Python3 and wanted (as an excercise) to implement a simple >> type checker first: I know there are lots of t

Re: Confusion about decorators

2011-12-12 Thread Henrik Faber
On 12.12.2011 14:45, Arnaud Delobelle wrote: >> Can someone please enlighten me? > > You can (need to?) use the descriptor protocol to deal with methods. > > from functools import partial [...] >def __get__(self, obj, objtype): >return partial(self, obj) Whoa. This is abs

Re: Confusion about decorators

2011-12-12 Thread Arnaud Delobelle
On 12 December 2011 13:52, Henrik Faber wrote: > On 12.12.2011 14:45, Arnaud Delobelle wrote: > >>> Can someone please enlighten me? >> >> You can (need to?) use the descriptor protocol to deal with methods. >> >> from functools import partial > [...] >>        def __get__(self, obj, objtype): >>

RE: subprocess question

2011-12-12 Thread jyoung79
> import subprocess > p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', >> stdout=subprocess.PIPE) > out, err = p.communicate() > out >> ' 11M\t.\n' > You might prefer to use subprocess.check_output(); it slightly > simplifies your code: > http://docs.python.or

Re: subprocess question

2011-12-12 Thread Nobody
On Sun, 11 Dec 2011 22:02:23 -0800, Chris Rebert wrote: > p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', > stdout=subprocess.PIPE) > Alternatively, you can opt to use the shell by passing shell=True as > an argument. Except that the OP is talking about a directory passed

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Terry Reedy
On 12/12/2011 3:09 AM, Gregory Ewing wrote: people who don't become programmers, I suspect they never have much use for remainders in everyday life. Huh? Funny you should say 'everyday'. It is now 10 o'clock. In 20 hours, it will be (10+20) % 12 == 6 o'clock. It is now day 1 of the week. In 9

Re: Confusion about decorators

2011-12-12 Thread Henrik Faber
On 12.12.2011 15:01, Arnaud Delobelle wrote: >> I am very amazed -- I've been programming Python for about 5 years now >> and have never even come close to something as a "descriptor protocol". >> Python never ceases to amaze me. Do you have any beginners guide how >> this works? The Pydoc ("Data

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Terry Reedy
On 12/12/2011 5:59 AM, Jussi Piitulainen wrote: Past experience in mathematics newsgroups tells me that some mathematicians do not accept the existence of any remainder operator at all. Even though they carry hour/minute/second remindering devices on their bodies and put year/month/day remai

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Terry Reedy
On 12/12/2011 4:12 AM, Eelco Hoogendoorn wrote: The above examples are seldom needed in Python because we have one general method to repeatedly split a sequence into head and tail. it = iter(iterable) # 'it' now represents the sequenced iterable head = next(it) # 'it' now represents the tail a

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Nick Dokos
Terry Reedy wrote: > calculations are helped by the fact that (a+b) % c == a%c + b%c, so As long as we understand that == here does not mean "equal", only "congruent modulo c", e.g try a = 13, b = 12, c = 7. Nick -- http://mail.python.org/mailman/listinfo/python-list

multiprocessing module question

2011-12-12 Thread dmitrey
hi all, suppose I have a func F, list [args1,args2,args3,...,argsN] and want to obtain r_i = F(args_i) in parallel mode. My difficulty is: if F returns not None, than I should break calculations, and I can't dig in multiprocessing module documentation how to do it. Order doesn't matter for me (I ha

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Arnaud Delobelle
On 12 December 2011 15:52, Terry Reedy wrote: > No, *target unpacking (singular) is quite useful in specialized cases. But > it is not specifically head/tail unpacking. > a,*b,c = 1,2,3,4,5,6 a,b,c > (1, [2, 3, 4, 5], 6) *a,b,c = 1,2,3,4,5 a,b,c > ([1, 2, 3], 4, 5) > >> I pers

Wing IDE 4.1.2 released

2011-12-12 Thread Wingware
Hi, Wingware has released version 4.1.2 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call tip

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Arnaud Delobelle
On 12 December 2011 15:36, Terry Reedy wrote: > Huh? Funny you should say 'everyday'. It is now 10 o'clock. In 20 hours, it > will be (10+20) % 12 == 6 o'clock. It is now day 1 of the week. In 9 days it > will be day (1+9) % 7 == 3 of the week. Mental calculations are helped by > the fact that (a+

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Chris Angelico
On Tue, Dec 13, 2011 at 2:55 AM, Nick Dokos wrote: > Terry Reedy wrote: >> calculations are helped by the fact that (a+b) % c == a%c + b%c, so > > As long as we understand that == here does not mean "equal", only > "congruent modulo c", e.g try a = 13, b = 12, c = 7. This is the basis of the gra

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Chris Angelico
On Tue, Dec 13, 2011 at 3:15 AM, Arnaud Delobelle wrote: > > You mean (a + b) % c == (a%c + b%c) % c > > :) It's just integer wraparound. Modulo 9 is the same as "render this number in base 9 and take the last digit" (and printing a number in base 9 would normally be done with mod 9 division), an

Re: I love the decorator in Python!!!

2011-12-12 Thread Robert Kern
On 12/12/11 3:36 AM, alex23 wrote: On Dec 9, 8:08 pm, Robert Kern wrote: On 12/9/11 5:02 AM, alex23 wrote: The 3rd party 'decorator' module takes care of issues like docstrings &function signatures. I'd really like to see some of that functionality in the stdlib though. Much of it is:

PyDev and multithreaded application debug

2011-12-12 Thread Massi
Hi everyone, I've just started to use pydev to develop my python application and I'm encountering some problems to debug it. The application I'm dealing with is a multithreaded application; when I try to debug it with pydev, it seems not to be able to handle the execution of multiple threads. The p

Re: What happened to module.__file__?

2011-12-12 Thread Robert Kern
On 12/12/11 1:25 AM, MRAB wrote: On 12/12/2011 00:21, Steven D'Aprano wrote: I've just started using a Debian system, instead of the usual RedHat based systems I'm used to, and module.__file__ appears to have disappeared for some (but not all) modules. On Fedora: [steve@orac ~]$ python -E Pyth

automate commands to an .exe console program through python

2011-12-12 Thread Juan Perez
Hi, I'm new to this mailing list and new in python as well. I need to automate a .exe console program in windows, and send key characters like 'a', 'M' ... I don't need to take the output as is printed in a different text log, but I'll have to send the messages to the program. I had this running

Re: Documentation for python-evolution - where?

2011-12-12 Thread tinnews
Chris Angelico wrote: > On Mon, Dec 12, 2011 at 9:28 AM, wrote: > > I'm trying to use the python evolution (as in Gnome Evolution) module > > but I can't find any documetation beyond the odd trivial example and > > the API documentation at http://doc.conduit-project.org/evolution-python/ > > (or

Re: unittest. customizing tstloaders / discover()

2011-12-12 Thread Nathan Rice
Nose is absolutely the way to go for your testing needs. You can put "__test__ = False" in modules or classes to stop test collection. On Mon, Dec 12, 2011 at 5:44 AM, Thomas Bach wrote: > Gelonida N writes: > >> Do I loose anything if using nose. or example can all unit tests / doc >> tests st

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Jussi Piitulainen
Terry Reedy writes: > On 12/12/2011 5:59 AM, Jussi Piitulainen wrote: > > > Past experience in mathematics newsgroups tells me > > that some mathematicians do not accept the existence of any remainder > > operator at all. > > Even though they carry hour/minute/second remindering devices on their

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
> > I personally quite like them, but I would like them to be more general. > > It already is. The *target can be anywhere in the sequence. Im not sure if this is a genuine understanding, or trollish obtuseness. Yes, the target can be anywhere in the sequence. And yes, the resulting list can con

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
> They recognize modular arithmetic but for some reason insist that > there is no such _binary operation_. But as I said, I don't understand > their concern. (Except the related concern about some programming > languages, not Python, where the remainder does not behave well with > respect to divisi

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread gene heskett
On Monday, December 12, 2011 12:44:27 PM Chris Angelico did opine: > On Tue, Dec 13, 2011 at 2:55 AM, Nick Dokos wrote: > > Terry Reedy wrote: > >> calculations are helped by the fact that (a+b) % c == a%c + b%c, so > > > > As long as we understand that == here does not mean "equal", only > >

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Nick Dokos
Jussi Piitulainen wrote: > Terry Reedy writes: > > On 12/12/2011 5:59 AM, Jussi Piitulainen wrote: > > > > > Past experience in mathematics newsgroups tells me > > > that some mathematicians do not accept the existence of any remainder > > > operator at all. > > > > Even though they carry hour/

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Dave Angel
On 12/12/2011 12:46 PM, gene heskett wrote: On Monday, December 12, 2011 12:44:27 PM Chris Angelico did opine: This is the basis of the grade-school "casting out nines" method of checking arithmetic. Set c=9 and you can calculate N%c fairly readily (digit sum - I'm assuming here that the arithm

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Ian Kelly
On Mon, Dec 12, 2011 at 5:21 AM, Eelco wrote: > You cannot; only constructors modelling a sequence or a dict, and > only > in that order. Is that rule clear enough? The dict constructor can receive either a sequence or a mapping, so if I write this: def func(a, b, dict(c)): what will I

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Jussi Piitulainen
Eelco writes: > > They recognize modular arithmetic but for some reason insist that > > there is no such _binary operation_. But as I said, I don't understand > > their concern. (Except the related concern about some programming > > languages, not Python, where the remainder does not behave well w

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Nick Dokos
gene heskett wrote: > On Monday, December 12, 2011 12:44:27 PM Chris Angelico did opine: > > > On Tue, Dec 13, 2011 at 2:55 AM, Nick Dokos > wrote: > > > Terry Reedy wrote: > > >> calculations are helped by the fact that (a+b) % c == a%c + b%c, so > > > > > > As long as we understand that ==

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
On Dec 12, 7:09 pm, Ian Kelly wrote: > On Mon, Dec 12, 2011 at 5:21 AM, Eelco wrote: > > You cannot; only constructors modelling a sequence or a dict, and > > only > > in that order. Is that rule clear enough? > > The dict constructor can receive either a sequence or a mapping, so if > I write th

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Ian Kelly
On Mon, Dec 12, 2011 at 11:17 AM, Eelco wrote: > Im not sure if I was clear on that, but I dont care what the > constructors accept; I meant to overload on the concept the underlying > type models. Dicts model a mapping, lists/tuples model a sequence. MI > deriving from both these models is illega

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
> False. I stand corrected. > Or are you saying that only classes specifically derived from list, > tuple, or dict should be considered, and custom containers that are > not derived from any of those but implement the correct protocols > should be excluded?  If so, that sounds less than ideal. T

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
To get back on topic a little bit, lets get back to the syntax of all this: I think we all agree that recycling the function call syntax is less than ideal, since while it works in special contexts like a function signature, its symmetric counterpart inside a function call already has the meaning o

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
On Dec 12, 8:05 pm, Eelco wrote: > To get back on topic a little bit, lets get back to the syntax of all > this: I think we all agree that recycling the function call syntax is > less than ideal, since while it works in special contexts like a > function signature, its symmetric counterpart inside

Re: executable builder

2011-12-12 Thread J A
I am having some issues compiling an exe myself but most of that stems from the version of python I am using. That being said, try using GUI2EXE http://code.google.com/p/gui2exe this program makes the setup file go a lot easier, also it will tie in a few different tools like py2exe which is wha

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread OKB (not okblacke)
Steven D'Aprano wrote: > And you can blame C for the use of % instead of mod or modulo. Anytime you can blame C for something, you can also blame a bunch of other languages for foolishly perpetuating the inanities of C. -- --OKB (not okblacke) Brendan Barnwell "Do not follow where the

Re: Documentation for python-evolution - where?

2011-12-12 Thread Chris Angelico
On Tue, Dec 13, 2011 at 3:40 AM, wrote: > Actually I'm not sure if it's down to the docstrings because the help > available from Python itself stops (not unreasonably) at the interface > to the C library code.  What I was after (and you have told me where > it is) was the functions/methods availa

Re: automate commands to an .exe console program through python

2011-12-12 Thread Chris Angelico
On Tue, Dec 13, 2011 at 3:41 AM, Juan Perez wrote: > I need to automate a .exe console program in windows, and send key > characters like 'a', 'M' ... > I had this running in an autoIT script which with only activating cmd > window, and with the "send" parameter I had all already done. But I'm hav

Re: Overriding a global

2011-12-12 Thread Steven D'Aprano
On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: > Using the same name for 2 different objects is a bad idea in general. We have namespaces precisely so you don't need to care about making names globally unique. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding a global

2011-12-12 Thread Dave Angel
On 12/12/2011 04:28 PM, Steven D'Aprano wrote: On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: Using the same name for 2 different objects is a bad idea in general. We have namespaces precisely so you don't need to care about making names globally unique. True, but in this c

Re: Overriding a global

2011-12-12 Thread Joshua Landau
Wouldn't this be nicer, though?: def getChildLogger(id): return logger.getChild(id) def someFunc(): logger = getChildLogger("someFunc") -- UNTESTED -- No messing around with globals this way, and it's more extendable. And 'globals()["logger"].getChild("someFunc")' reads like a brick. -

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Terry Reedy
On 12/12/2011 12:12 PM, Eelco wrote: Im not sure if this is a genuine understanding, or trollish obtuseness. If you are referring to what I write, it is based on genuine understanding of Python. Yes, the target can be anywhere in the sequence. And yes, the resulting list can contain object

curses (or something) for windows

2011-12-12 Thread Eric
Is there something similar to curses available for the Windows version of Python (2.7, community edition)? Preferably something built-in. In general, I'm looking to do gui-ish things from within the command window. Also, in particular, is there a way to get the console size (rows, cols). I've se

Re: Overriding a global

2011-12-12 Thread Ben Finney
Dave Angel writes: > True, but in this code, the function is trying to both use the global > value, but also a local that deliberately has the same name, but a > different meaning and "value". The CPython compiler doesn't make this > easy, and I think the globals() technique is unnecessarily obsc

Re: Overriding a global

2011-12-12 Thread Joshua Landau
> > > If a function knows of the presence of a global, it's not asking too > > much for it to not re-use the same name in local scope. > > Yes. It's just a function wanting to act as-if it were in a different environment than its default. By that same reasoning you could state that "If a function

Re: curses (or something) for windows

2011-12-12 Thread alex23
On Dec 13, 7:15 am, Eric wrote: > Is there something similar to curses available for the Windows version > of Python (2.7, community edition)?  Preferably something built-in. > In general, I'm looking to do gui-ish things from within the command > window. > > Also, in particular, is there a way to

Re: Dynamic variable creation from string

2011-12-12 Thread alex23
On Dec 12, 10:49 pm, 8 Dihedral wrote: > This is the way to write an assembler or > to roll out a script language to be included in an app > by users. This is a garbage comment that has absolutely nothing to do with the topic at hand _at all_. -- http://mail.python.org/mailman/listinfo/pytho

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread alex23
On Dec 12, 10:21 pm, Eelco wrote: > >  Modulo is hardly an obscure operation. "What's the remainder...?" is a > >  simple question that people learn about in primary school. > > So is 'how much wood would a woodchucker chuck if a woodchucker could > chuck wood?'. But how often does that concept tu

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Eelco
> > Im not sure if this is a genuine understanding, or trollish > > obtuseness. > > If you are referring to what I write, it is based on genuine > understanding of Python. This is getting 'interesting'. In a way. I meant to write 'misunderstanding', as I think the context made quite clear. So agai

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread alex23
On Dec 13, 3:12 am, Eelco wrote: > But to relate it to the topic of this thread: no, the syntax does not > allow one to select the type of the resulting sequence. It always > constructs a list. So by this argument, _every_ function that returns a list should take an optional argument to specify a

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Ian Kelly
On Mon, Dec 12, 2011 at 11:51 AM, Eelco wrote: > Either way, its not hard to add some detail to the semantics to allow > all this. Even this function definition: > > def func(Foo(args), Foo(kwargs)) > > ...could even be defined unambigiously by overloading first on base > type, and if that does no

Re: curses (or something) for windows

2011-12-12 Thread Eric
On Dec 12, 5:47 pm, alex23 wrote: > On Dec 13, 7:15 am, Eric wrote: > > > Is there something similar to curses available for the Windows version > > of Python (2.7, community edition)?  Preferably something built-in. > > In general, I'm looking to do gui-ish things from within the command > > win

Re: I love the decorator in Python!!!

2011-12-12 Thread alex23
On Dec 13, 2:27 am, Robert Kern wrote: > On 12/12/11 3:36 AM, alex23 wrote: > > > On Dec 9, 8:08 pm, Robert Kern  wrote: > >> On 12/9/11 5:02 AM, alex23 wrote: > >>> The 3rd party 'decorator' module takes care of issues like docstrings > >>> &    function signatures. I'd really like to see some of

Simple legend code no longer works after upgrade to Ubuntu 11.10

2011-12-12 Thread C Barrington-Leigh
rom pylab import * plot([0,0],[1,1],label='Ubuntu 11.10') Before I upgraded to 2.7.2+ / 4 OCt 2011, the following code added a comment line with a legend. Now, the same code makes the legend appear "off-screen", ie way outside the axes limits. Can anyone help? And/or is there a new way to add a ti

Simple legend code no longer works after upgrade to Ubuntu 11.10

2011-12-12 Thread C Barrington-Leigh
""" Before I upgraded to 2.7.2+ / 4 OCt 2011, the following code added a comment line to an axis legend using matplotlib / pylab. Now, the same code makes the legend appear "off-screen", ie way outside the axes limits. Can anyone help? And/or is there a new way to add a title and footer to the le

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Steven D'Aprano
On Mon, 12 Dec 2011 16:58:33 -0500, Terry Reedy wrote: > On 12/12/2011 12:12 PM, Eelco wrote: >> Yes, we can cast the list to be whatever we want on the next line, > > Convert. For the very few cases one wants to do this, it is quite > adequate. +1 with the small proviso that there's not much

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Ian Kelly
On Mon, Dec 12, 2011 at 4:40 PM, Eelco wrote: >> For a linked list, no *target and no copying is needed: >> >> head, tail = llist > > I have no idea what this means. Each node of a linked list consists of a data member and a "next" member, that holds the next node in the list. The natural contai

Re: Dynamic variable creation from string

2011-12-12 Thread Steven D'Aprano
On Mon, 12 Dec 2011 15:45:06 -0800, alex23 wrote: > On Dec 12, 10:49 pm, 8 Dihedral > wrote: >> This is the way to write an assembler or to roll out a script language >> to be included in an app by users. > > This is a garbage comment that has absolutely nothing to do with the > topic at han

Re: Overriding a global

2011-12-12 Thread Dave Angel
On 12/12/2011 06:48 PM, Joshua Landau wrote: If a function knows of the presence of a global, it's not asking too much for it to not re-use the same name in local scope. Yes. It's just a function wanting to act as-if it were in a different environment than its default. By that same reasoning y

Re: Overriding a global

2011-12-12 Thread Steven D'Aprano
On Tue, 13 Dec 2011 09:27:09 +1100, Ben Finney wrote: > Dave Angel writes: > >> True, but in this code, the function is trying to both use the global >> value, but also a local that deliberately has the same name, but a >> different meaning and "value". The CPython compiler doesn't make this >>

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Steven D'Aprano
On Mon, 12 Dec 2011 04:21:15 -0800, Eelco wrote: >> No more, or less, explicit than the difference between "==" and "is". > > == may be taken to mean identity comparison; 'equals' can only mean one > thing. Nonsense. "Equals" can be taken to mean anything the language designer chooses, same as

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Chris Angelico
On Tue, Dec 13, 2011 at 1:43 PM, Steven D'Aprano wrote: > It merely happens that C's > use of the notation % for the remainder operation likely influenced > Python's choice of the same notation. Considering that Python also had the notion that "integer divided by integer yields integer" until Py3

Re: Verbose and flexible args and kwargs syntax

2011-12-12 Thread Ian Kelly
On Mon, Dec 12, 2011 at 7:43 PM, Steven D'Aprano wrote: > If I want to collect a sequence of arguments into a string, why shouldn't > I be allowed to write this? > >    def func(parg, str(args)): ... Obviously, because the correct syntax would be: def func(parg, ''.join(args)): ... :-P -- http

Re: Overriding a global

2011-12-12 Thread Ian Kelly
On Mon, Dec 12, 2011 at 4:48 PM, Joshua Landau wrote: > Rebinding logger locally in a function is really no > different to a subclass rebinding a variable from its main class using that > class' value. The only difference is that, in that case, you have an > alternate binding to the original value