Re: I love the decorator in Python!!!

2011-12-08 Thread alex23
On Dec 9, 2:38 am, Chris Angelico wrote: > One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I was testing this out in > IDLE, and the fly help for the function no

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
In article , Chris Angelico wrote: > http://thedailywtf.com/Series/Error_0x27_d.aspx > > This is getting quite off-topic though. Getting off-topic, perhaps, but your comment really does bring some closure. When I was pondering the original, "too many values to unpack" message, I did indeed

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 1:07 PM, Steven D'Aprano wrote: > I forget where I saw this, but somebody took a screen shot of an error > message from a GUI application that said something like: > > A fatal error occurred: no error > > and then aborted the app. An errant error! Sounds like the stuff that

[OT] Book authoring

2011-12-08 Thread Miki Tebeka
Greetings, Any recommendations for a book authoring system that supports the following: 1. Code examples (with syntax highlighting and line numbers) 2. Output HTML, PDF, ePub ... 3. Automatic TOC and index 4. Search (in HTML) - this is a "nice to have" Can I somehow use Sphinx? Thanks, -- Miki -

Re: adding elements to set

2011-12-08 Thread Terry Reedy
On 12/8/2011 1:54 PM, Duncan Booth wrote: Yes, the documentation describes this although I don't think anything highlights that it is a change from Python 2.x: [http://docs.python.org/py3k/reference/datamodel.html] The Python 3 docs are 're-based' on 3.0, with change notes going forward from

Re: subprocess.Popen under windows 7

2011-12-08 Thread Lie Ryan
On 12/09/2011 09:41 AM, Frank van den Boom wrote: What can I do, to prevent pressing the return key? I didn't have Windows 7 right now, but that shouldn't happen with the code you've given; when trimming code for posting, you should check that the trimmed code still have the exact same proble

Re: Misleading error message of the day

2011-12-08 Thread Steven D'Aprano
On Thu, 08 Dec 2011 18:10:17 +, Grant Edwards wrote: > On 2011-12-08, Roy Smith wrote: >> On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant >> wrote: >>> string are iterable, considering this, the error is correct. >> >> Yes, I understand that the exception is correct. I

ANN: Speedometer 2.4 - bandwidth and download monitor

2011-12-08 Thread Ian Ward
Announcing Speedometer 2.8 -- Speedometer home page: http://excess.org/speedometer/ Download: http://excess.org/speedometer/speedometer-2.8.tar.gz New in this release: - Added a linear scale option: -l. Best used in combination with -m (and

Re: Misleading error message of the day

2011-12-08 Thread Lie Ryan
On 12/09/2011 07:13 AM, Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
In article , Grant Edwards wrote: > On 2011-12-08, Roy Smith wrote: > > On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant > > wrote: > >> string are iterable, considering this, the error is correct. > > > > Yes, I understand that the exception is correct. I'm not saying t

Re: I love the decorator in Python!!!

2011-12-08 Thread Ethan Furman
Chris Angelico wrote: One piece of sophistication that I would rather like to see, but don't know how to do. Instead of *args,**kwargs, is it possible to somehow copy in the function's actual signature? I was testing this out in IDLE, and the fly help for the function no longer gave useful info a

Re: I love the decorator in Python!!!

2011-12-08 Thread Ethan Furman
Chris Angelico wrote: One piece of sophistication that I would rather like to see, but don't know how to do. Instead of *args,**kwargs, is it possible to somehow copy in the function's actual signature? I was testing this out in IDLE, and the fly help for the function no longer gave useful info a

subprocess.Popen under windows 7

2011-12-08 Thread Frank van den Boom
Hello, i have something like this under windows 7: print("try command...") arglist = [PATH_TO_7ZIP,"a", "-sfx", archive_name, "*", "-r", "-p",PASSWORD] p = subprocess.Popen(args=arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=srcdir) output, error

Re: tracking variable value changes

2011-12-08 Thread Arnaud Delobelle
On 8 December 2011 21:50, Ian Kelly wrote: > You can get the same effect with a float by putting it in a container > object and binding both variables to the same container objects rather > than to the float directly.  Then, to change the value, change the > contents of the container object.  Wha

Re: tracking variable value changes

2011-12-08 Thread Ben Finney
Catherine Moroney writes: > Is there a way to create a C-style pointer in (pure) Python so the > following code will reflect the changes to the variable "a" in the > dictionary "x"? No, Python doesn't do pointers. Rather, objects have references and that's how the program accesses the objects.

Re: tracking variable value changes

2011-12-08 Thread Ian Kelly
On Thu, Dec 8, 2011 at 1:17 PM, Catherine Moroney wrote: > Hello, > > Is there a way to create a C-style pointer in (pure) Python so the following > code will reflect the changes to the variable "a" in the > dictionary "x"? > > For example: > a = 1.0 b = 2.0 x = {"a":a, "b":b}

Re: How to get a correct entry in the menu for a Python application on Mac OS X

2011-12-08 Thread Gregory Ewing
Detlev Offenbach wrote: I am fairly new to Mac OS X and would like to know, what I have to do to make my Python application show the correct name in the menu bar. What did I do so far. I created an application package containing the .plist file with correct entries and a shell script, that star

Re: tp_new, tp_alloc, tp_init

2011-12-08 Thread Gregory Ewing
Michael Hennebry wrote: I've been reading about writing extension types in C and am rather fuzzy about the relationship between tp_new, tp_alloc and tp_init. Most especially, why tp_new? It seems to me that tp_alloc and tp_init would be sufficient. tp_new and tp_init correspond to the Python me

Re: Numpy ndarray to C array

2011-12-08 Thread Robert Kern
On 12/8/11 7:56 PM, Enrico wrote: I am trying to pass a multi-dimensional ndarray to C as a multi- dimensional C array for the purposes of passing it to mathematica. They already have a wrapper for a 1-D Python list. where the list is copied to "list". Shown below: I would like to create a sim

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 7:58 AM, alister wrote: > not as useless as "Keyboard Error press F1 to continue" If it said "press F1 to ignore" then I would agree. This, however, is more akin to "replace user and strike any key to continue", but more implicit. ChrisA -- http://mail.python.org/mailman/

Re: tracking variable value changes

2011-12-08 Thread Jerry Hill
On Thu, Dec 8, 2011 at 3:17 PM, Catherine Moroney < catherine.m.moro...@jpl.nasa.gov> wrote: > Is there some way to rewrite the code above so the change of "a" from > 1.0 to 100.0 is reflected in the dictionary. I would like to use > simple datatypes such as floats, rather than numpy arrays or cl

Re: Python horks on WinXP path names

2011-12-08 Thread Eric
On Dec 8, 2:43 pm, Ian Kelly wrote: > On Thu, Dec 8, 2011 at 1:16 PM, Eric wrote: > > I'm running Python 2.7 on WinXP (ActiveState community version) and > > when I try to do this: > > > if __name__ == '__main__': > >    root = Tkinter.Tk() > >    root.withdraw() > >    fileNames = tkFileDialog.a

tracking variable value changes

2011-12-08 Thread Catherine Moroney
Hello, Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable "a" in the dictionary "x"? For example: >>> a = 1.0 >>> b = 2.0 >>> x = {"a":a, "b":b} >>> x {'a': 1.0, 'b': 2.0} >>> a = 100.0 >>> x {'a': 1.0, 'b': 2.0} ## at

Re: Misleading error message of the day

2011-12-08 Thread alister
On Thu, 08 Dec 2011 18:10:17 +, Grant Edwards wrote: > On 2011-12-08, Roy Smith wrote: >> On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant >> wrote: >>> string are iterable, considering this, the error is correct. >> >> Yes, I understand that the exception is correct. I

Re: Python horks on WinXP path names

2011-12-08 Thread Jerry Hill
On Thu, Dec 8, 2011 at 3:16 PM, Eric wrote: > I'm running Python 2.7 on WinXP (ActiveState community version) and > when I try to do this: > > if __name__ == '__main__': >root = Tkinter.Tk() >root.withdraw() >fileNames = tkFileDialog.askopenfilenames() >root.destroy() >print f

Re: Python horks on WinXP path names

2011-12-08 Thread Ian Kelly
On Thu, Dec 8, 2011 at 1:16 PM, Eric wrote: > I'm running Python 2.7 on WinXP (ActiveState community version) and > when I try to do this: > > if __name__ == '__main__': >    root = Tkinter.Tk() >    root.withdraw() >    fileNames = tkFileDialog.askopenfilenames() >    root.destroy() >    print fi

Re: Misleading error message of the day

2011-12-08 Thread Ethan Furman
Benjamin Kaplan wrote: On Thu, Dec 8, 2011 at 2:09 PM, Ethan Furman wrote: Benjamin Kaplan wrote: If the RHS was a tuple or a list, yes you could know immediately. But unpacking works with any iterable, so it probably doesn't special-case lists and tuples. Iterables don't have a size- they jus

Re: Questions about LISP and Python.

2011-12-08 Thread Ben Finney
MRAB writes: > GvR isn't our leader, we are his followers. There's a difference. :-) +1 QotW -- \ “Guaranteed to work throughout its useful life.” —packaging for | `\ clockwork toy, Hong Kong | _o__)

Python horks on WinXP path names

2011-12-08 Thread Eric
I'm running Python 2.7 on WinXP (ActiveState community version) and when I try to do this: if __name__ == '__main__': root = Tkinter.Tk() root.withdraw() fileNames = tkFileDialog.askopenfilenames() root.destroy() print fileNames # windows filename gets for fileName in fileNames

Re: Misleading error message of the day

2011-12-08 Thread Ethan Furman
Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible otherwise. Which thread was that? ~Etha

Numpy ndarray to C array

2011-12-08 Thread Enrico
I am trying to pass a multi-dimensional ndarray to C as a multi- dimensional C array for the purposes of passing it to mathematica. They already have a wrapper for a 1-D Python list. where the list is copied to "list". Shown below: static PyObject * mathlink_PutIntegerList(mathlink_Link *self, PyO

Re: Misleading error message of the day

2011-12-08 Thread Robert Kern
On 12/8/11 4:21 PM, Chris Angelico wrote: On Fri, Dec 9, 2011 at 2:55 AM, Andrea Crotti wrote: Yes but how do you know how many values you generated when it quits? I mean I don't know how it work internally, but it should keep a temporary list of the yielded values to be able to find out how ma

Sybase module 0.40pre2 released

2011-12-08 Thread Robert Boehne
WHAT IS IT: The Sybase module provides a Python interface to the Sybase relational database system. It supports all of the Python Database API, version 2.0 with extensions. Please downolad, test and report any problems with the pre-release. ** This version is a pre-release not intended for p

Re: Misleading error message of the day

2011-12-08 Thread Jean-Michel Pichavant
Roy Smith wrote: On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: string are iterable, considering this, the error is correct. Yes, I understand that the exception is correct. I'm not saying the exception should be changed, just that we have the opportuni

Re: Misleading error message of the day

2011-12-08 Thread Benjamin Kaplan
On Thu, Dec 8, 2011 at 2:09 PM, Ethan Furman wrote: > Benjamin Kaplan wrote: >> >> On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: >>> >>> (some, >>>  very, >>>  long, >>>  list, >>>  of, >>>  variable, >>>  names, >>>  to, >>>  get, >>>  the, >>>  stuff, >>>  unpacked, >>>  into) = function_tha

Re: Misleading error message of the day

2011-12-08 Thread Ethan Furman
Benjamin Kaplan wrote: On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: (some, very, long, list, of, variable, names, to, get, the, stuff, unpacked, into) = function_that_should_return_a_14_tuple() raises ValueError: too many values to unpack Quick, what's the bug? Did I forget

Re: Misleading error message of the day

2011-12-08 Thread Benjamin Kaplan
On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: > (some, >  very, >  long, >  list, >  of, >  variable, >  names, >  to, >  get, >  the, >  stuff, >  unpacked, >  into) = function_that_should_return_a_14_tuple() > > raises > > ValueError: too many values to unpack > > Quick, what's the bug?  Did

Re: adding elements to set

2011-12-08 Thread Duncan Booth
Chris Angelico wrote: > On Fri, Dec 9, 2011 at 4:32 AM, Peter Otten <__pete...@web.de> wrote: >> The only thing that has changed (in 2.7) is the algorithm to >> calculate the hash value. The bits are rotated to turn the four least >> significant bits into the most signicant ones. According to a c

Re: adding elements to set

2011-12-08 Thread Peter Otten
Chris Angelico wrote: > On Fri, Dec 9, 2011 at 4:32 AM, Peter Otten <__pete...@web.de> wrote: >> The only thing that has changed (in 2.7) is the algorithm to calculate >> the hash value. The bits are rotated to turn the four least significant >> bits into the most signicant ones. According to a co

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
(some, very, long, list, of, variable, names, to, get, the, stuff, unpacked, into) = function_that_should_return_a_14_tuple() raises ValueError: too many values to unpack Quick, what's the bug? Did I forget a variable on the LHS, or is my function returning more things than it shou

Re: Misleading error message of the day

2011-12-08 Thread Grant Edwards
On 2011-12-08, Roy Smith wrote: > On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: >> string are iterable, considering this, the error is correct. > > Yes, I understand that the exception is correct. I'm not saying the > exception should be changed, just that we have

Re: Questions about LISP and Python.

2011-12-08 Thread MRAB
On 08/12/2011 04:10, Rick Johnson wrote: [snip] I believe this community has a cancer. A cancer that is rotting us from the inside. A cancer that has metastasis and is spreading like wild fire. The problem with a cancer is not that it rots, but that it grows uncontrollably. *Inquisitive Joe a

Re: Misleading error message of the day

2011-12-08 Thread Tim Chase
On 12/08/11 09:30, Roy Smith wrote: On Thursday, December 8, 2011 9:47:02 AM UTC-5, Robert Kern wrote: Would including the respective numbers help your thought processes? ValueError: too many values to unpack (expected 2, got 3) I don't know if that would have done the trick for me on this p

Re: I love the decorator in Python!!!

2011-12-08 Thread Ian Kelly
> One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I was testing this out in > IDLE, and the fly help for the function no longer gave useful info > about its argum

Re: adding elements to set

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 4:32 AM, Peter Otten <__pete...@web.de> wrote: > The only thing that has changed (in 2.7) is the algorithm to calculate the > hash value. The bits are rotated to turn the four least significant bits > into the most signicant ones. According to a comment in Objects/objects.c >

Re: adding elements to set

2011-12-08 Thread Peter Otten
Chris Angelico wrote: > It checks for equality using hashes. By default, in Python 2, objects' > hashes are their ids - meaning that no two of them hash alike, and > you'll get duplicates in your set. (In Python 3, the default appears > to be that they're unhashable and hence can't go into the set

Re: I love the decorator in Python!!!

2011-12-08 Thread Andrew Berg
Decorators are great for adding common functionality to several functions without duplicating code. For example, I have one for my IRC bot that checks that the person sending the command is authorized to use the command. It's only "if mask in owner list then execute function else say access denied"

Re: I love the decorator in Python!!!

2011-12-08 Thread Andrew Berg
On 12/8/2011 10:38 AM, Chris Angelico wrote: > One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I remember seeing this in a PEP that is planned to be implemented i

Re: adding elements to set

2011-12-08 Thread Peter Otten
Andrea Crotti wrote: > I've wasted way too much time for this, which is surely not a Python bug, > not something that surprised me a lot. > > I stupidly gave for granted that adding an object to a set would first > check if there are equal elements inside, and then add it. > > As shown below thi

Re: adding elements to set

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 3:34 AM, Andrea Crotti wrote: > I've wasted way too much time for this, which is surely not a Python bug, > not something that surprised me a lot. > > I stupidly gave for granted that adding an object to a set would first > check if there are equal elements inside, and then

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 3:24 AM, K.-Michael Aye wrote: > I understand this one, it seems really useful. And maybe i start to sense > some more applicability. Like this, with extra flags that could be set at > run time, I could influence the way a function is executed without designing > the functio

adding elements to set

2011-12-08 Thread Andrea Crotti
I've wasted way too much time for this, which is surely not a Python bug, not something that surprised me a lot. I stupidly gave for granted that adding an object to a set would first check if there are equal elements inside, and then add it. As shown below this is not clearly the case.. Is it p

Re: I love the decorator in Python!!!

2011-12-08 Thread K . -Michael Aye
On 2011-12-08 11:43:12 +, Chris Angelico said: On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: I am still perplexed about decorators though, am happily using Python for many years without them, but maybe i am missing something? For example in the above case, if I want the names atta

Re: Need some IPC pointers

2011-12-08 Thread Lie Ryan
On 12/01/2011 08:03 AM, Andrew Berg wrote: I've done some research, but I'm not sure what's most appropriate for my situation. What I want to do is have a long running process that spawns processes (that aren't necessarily written in Python) and communicates with them. The children can be spawned

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 2:55 AM, Andrea Crotti wrote: > Yes but how do you know how many values you generated when it quits? > I mean I don't know how it work internally, but it should keep a temporary > list of the yielded values to be able to find out how many values are > there.. Iterator unpac

Re: Misleading error message of the day

2011-12-08 Thread Andrea Crotti
On 12/08/2011 03:42 PM, Roy Smith wrote: Why not? Take this example: def i(): i = 0 while True: print "returning:", i yield i i += 1 a, b = i() ./iter.py returning: 0 returning: 1 returning: 2 Traceback (most recent call last): File "./iter.py", line 1

Re: Misleading error message of the day

2011-12-08 Thread Heiko Wundram
Am 08.12.2011 16:42, schrieb Roy Smith: The exception was raised when i() returned it's third value, so saying "expected 2, got 3" is exactly correct. Yes, it is true that it might have gotten more if it kept going, but that's immaterial; the fact that it got to 3 is what caused the Holy Hand

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
On Thursday, December 8, 2011 10:16:56 AM UTC-5, Heiko Wundram wrote: > Am 08.12.2011 15:47, schrieb Robert Kern: > > Would including the respective numbers help your thought processes? > > ValueError: too many values to unpack (expected 2, got 3) > > Not possible in the general case (as the right

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: > string are iterable, considering this, the error is correct. Yes, I understand that the exception is correct. I'm not saying the exception should be changed, just that we have the opportunity to produce a more useful

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
On Thursday, December 8, 2011 9:47:02 AM UTC-5, Robert Kern wrote: > Would including the respective numbers help your thought processes? > > ValueError: too many values to unpack (expected 2, got 3) I don't know if that would have done the trick for me on this particular one. On the other hand

Re: Misleading error message of the day

2011-12-08 Thread Heiko Wundram
Am 08.12.2011 15:47, schrieb Robert Kern: Would including the respective numbers help your thought processes? ValueError: too many values to unpack (expected 2, got 3) Not possible in the general case (as the right-hand side might be an arbitrary iterable/iterator...). -- --- Heiko. -- http:

Re: Documentation using Sphinx

2011-12-08 Thread Andrea Crotti
On 12/08/2011 02:09 PM, sajuptpm wrote: Hi, I am trying source code documentation using Sphinx. Here i have to copy paste all modules in to *.rst file, that is painful. Have any way to create documentation (doc for all modules, classes and methods in the project directory) from project folder qui

Re: Misleading error message of the day

2011-12-08 Thread Jean-Michel Pichavant
Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have been a,

Re: Misleading error message of the day

2011-12-08 Thread Robert Kern
On 12/8/11 2:23 PM, Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have be

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 1:23 AM, Roy Smith wrote: > I just spent a while beating my head against this one. > > # Python 2.6 a, b = 'foo' > Traceback (most recent call last): >  File "", line 1, in > ValueError: too many values to unpack Definitely weird! I smell a job for a linter though. If

Re: Misleading error message of the day

2011-12-08 Thread Andrea Crotti
On 12/08/2011 02:23 PM, Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should hav

Misleading error message of the day

2011-12-08 Thread Roy Smith
I just spent a while beating my head against this one. # Python 2.6 >>> a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have been a, b = 'foo', 'bar' I understan

Documentation using Sphinx

2011-12-08 Thread sajuptpm
Hi, I am trying source code documentation using Sphinx. Here i have to copy paste all modules in to *.rst file, that is painful. Have any way to create documentation (doc for all modules, classes and methods in the project directory) from project folder quickly. I also plannig to add a code browsin

Re: sending a variable to an imported module

2011-12-08 Thread Bastien Semene
Thanks both, Putting the variable inside a module works well. As the content is an object created inside another module I'm using this trick : module.CONFIG = module.load() So the variable is handled by the module that creates/use it, easy to use and pretty "native" to understand. Le 08

Re: sending a variable to an imported module

2011-12-08 Thread Dave Angel
On 12/08/2011 06:28 AM, Bastien Semene wrote: Hi list, I'm trying to pass a variable to an imported module without singletons. I've seen in the doc, and tested that I can't use global to do it : === module.py === def testf(): print test === main.py === global test test = 1 imported_module =

Re: sending a variable to an imported module

2011-12-08 Thread Arnaud Delobelle
On 8 December 2011 11:28, Bastien Semene wrote: > Hi list, > > I'm trying to pass a variable to an imported module without singletons. > I've seen in the doc, and tested that I can't use global to do it : > > === module.py === > def testf(): >  print test > > > === main.py === > global test > test

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Angelico
On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: > I am still perplexed about decorators though, am happily using Python for > many years without them, but maybe i am missing something? > For example in the above case, if I want the names attached to each other > with a comma, why wouldn't I

sending a variable to an imported module

2011-12-08 Thread Bastien Semene
Hi list, I'm trying to pass a variable to an imported module without singletons. I've seen in the doc, and tested that I can't use global to do it : === module.py === def testf(): print test === main.py === global test test = 1 imported_module = __import__(module, globals(), locals(), [], -1

Re: Questions about LISP and Python.

2011-12-08 Thread Matt Joiner
Guido is too busy secretly pouring his cruelty and malice into a master ring to answer trolls. Help yourself to a lesser ring on your way out. On Dec 8, 2011 10:14 PM, "Andrea Crotti" wrote: > On 12/08/2011 04:10 AM, Rick Johnson wrote: > >> ... >> >> Why has GvR not admonished the atrocious beha

Re: I love the decorator in Python!!!

2011-12-08 Thread K . -Michael Aye
On 2011-12-08 08:59:26 +, Thomas Rachel said: Am 08.12.2011 08:18 schrieb 8 Dihedral: I use the @ decorator to behave exactly like a c macro that does have fewer side effects. I am wondering is there other interesting methods to do the jobs in Python? In combination with a generator,

Re: Questions about LISP and Python.

2011-12-08 Thread Chris Angelico
On Thu, Dec 8, 2011 at 10:10 PM, Andrea Crotti wrote: > Supposing even that Guido resigns, why do you think that the power should go > to you? > Power is not something that you can claim for, you have to earn the right, > and > ranting doesn't normally buy anything ;) Power is something you creat

Re: Questions about LISP and Python.

2011-12-08 Thread Andrea Crotti
On 12/08/2011 04:10 AM, Rick Johnson wrote: ... Why has GvR not admonished the atrocious behavior of some people in this community? Why has GvR not admitted publicly the hideous state of IDLE and Tkinter? Where is the rally call? Where is the community spirit? The future of Pythin is in your han

Re: Insert trusted timestamp to PDF

2011-12-08 Thread marco . rucci
On Thursday, December 8, 2011 8:59:31 AM UTC+1, Hegedüs, Ervin wrote: > > The timestamp is applied to the pdf in detached mode (i.e. as a separate > > .tsr file) > > I'm afraid that's not good for us - we need to propagate PDF > files in enbedded mode. I'll do some research and let you know if i

Re: how to test attribute existence of feedparser objects

2011-12-08 Thread Chris Rebert
On Thu, Dec 8, 2011 at 1:34 AM, HansPeter wrote: > Hi, > > While using the feedparser library for downloading RSS feeds some of > the blog entries seem to have no title. > >  File "build\bdist.win32\egg\feedparser.py", line 382, in __getattr__ > AttributeError: object has no attribute 'title' > >

mrjob v0.3.0 released

2011-12-08 Thread Jimmy Retzlaff
What is mrjob? --- mrjob is a Python package that helps you write and run Hadoop Streaming jobs. mrjob fully supports Amazon's Elastic MapReduce (EMR) service, which allows you to buy time on a Hadoop cluster on an hourly basis. It also works with your own Hadoop cluster. Some

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Angelico
On Thu, Dec 8, 2011 at 7:59 PM, Thomas Rachel wrote: > Many other things are thinkable... And many more are unthinkable. Can we start an International Obfuscated Python Code Contest? It's the only place such... abhorrences can properly flourish. ChrisA -- http://mail.python.org/mailman/listinfo

how to test attribute existence of feedparser objects

2011-12-08 Thread HansPeter
Hi, While using the feedparser library for downloading RSS feeds some of the blog entries seem to have no title. File "build\bdist.win32\egg\feedparser.py", line 382, in __getattr__ AttributeError: object has no attribute 'title' Is there a way to test the existence of an attribute? I can use

Re: order independent hash?

2011-12-08 Thread Hrvoje Niksic
Tim Chase writes: > From an interface perspective, I suppose it would work. However one > of the main computer-science reasons for addressing by a hash is to > get O(1) access to items (modulo pessimal hash structures/algorithms > which can approach O(N) if everything hashes to the same > value/

Re: I love the decorator in Python!!!

2011-12-08 Thread Thomas Rachel
Am 08.12.2011 08:18 schrieb 8 Dihedral: I use the @ decorator to behave exactly like a c macro that does have fewer side effects. I am wondering is there other interesting methods to do the jobs in Python? In combination with a generator, you can do many funny things. For example, you ca

Re: Dynamic variable creation from string

2011-12-08 Thread Jussi Piitulainen
Terry Reedy writes: > On 12/7/2011 7:03 PM, Steven D'Aprano wrote: > > On Wed, 07 Dec 2011 09:09:16 -0800, Massi wrote: > > > >> Is there a way to create three variables dynamically inside Sum > >> in order to re write the function like this? > > I should have mentioned in my earlier response tha

Re: I love the decorator in Python!!!

2011-12-08 Thread Chris Rebert
On Wed, Dec 7, 2011 at 11:18 PM, 8 Dihedral wrote: > I use the @ decorator to behave exactly like a c macro that > does have fewer side effects. > > I am wondering is there other interesting methods to do the > jobs in Python? * Class decorators (http://www.python.org/dev/peps/pep-3129/ ); i.

Re: Insert trusted timestamp to PDF

2011-12-08 Thread Hegedüs , Ervin
hello, On Wed, Dec 07, 2011 at 11:39:20PM -0800, marco.ru...@gmail.com wrote: > Hi, take a look at this online tool: http://easytimestamping.com I need to create the PDF on my server - it could be any online service, but it must to have any kind of API. > It is able to apply RFC3161 compliant t