Re: What version of glibc is Python using?

2013-10-11 Thread Christian Gollwitzer
Am 12.10.13 08:34, schrieb John Nagle: I'm trying to find out which version of glibc Python is using. I need a fix that went into glibc 2.10 back in 2009. (http://udrepper.livejournal.com/20948.html) So I try the recommended way to do this, on a CentOS server: /usr/local/bin/python2.7 Python 2.

What version of glibc is Python using?

2013-10-11 Thread John Nagle
I'm trying to find out which version of glibc Python is using. I need a fix that went into glibc 2.10 back in 2009. (http://udrepper.livejournal.com/20948.html) So I try the recommended way to do this, on a CentOS server: /usr/local/bin/python2.7 Python 2.7.2 (default, Jan 18 2012, 10:47:23) [GCC

Re: ANN: CUI text editor Kaa 0.0.4

2013-10-11 Thread Atsuo Ishimoto
Hi, Thank you for your question. > What's a "console user interface?" That's what Windows calls a "DOS > box". But otherwise you seem to imply it runs on Linux. I meant to say something like DOS box or Linux terminals. Unfortunately, Kaa does not work on Windows DOS box since Kaa requires curse

Re: Unicode Objects in Tuples

2013-10-11 Thread Ian Kelly
On Fri, Oct 11, 2013 at 7:31 AM, Stephen Tucker wrote: > On the original question, well, I accept Ned's answer (at 10.22). I also > like the idea of a helper function given by Peter Otten at 09.51. It still > seems like a crutch to help poor old Python 2.X to do what any programmer > (or, at least

Re: Metaclass/abc hackery

2013-10-11 Thread Marco Buttu
On 10/12/2013 04:47 AM, Demian Brecht wrote: Working on this though brought up a question: Is there anything in the data model that acts like "__setattr__" but when operating on a class definition instead of an instance? I'd be able to get rid of the late_bind function if something like that's a

Re: Inter-process locking

2013-10-11 Thread Piet van Oostrum
Jason Friedman writes: > I have a 3rd-party process that runs for about a minute and supports > only a single execution at a time. > > $ deploy > > If I want to launch a second process I have to wait until the first > finishes. Having two users wanting to run at the same time might > happen a fe

job openiongs @ CompSoft India

2013-10-11 Thread swetha N
job openiongs @ CompSoft India Job Title: Software Engineer Qualification: Any Graduate Experience: Fresher Location: Chennai for more details & apply click here: http://referenceglobe.com/Postings_Internal/view_job_details_encoded.php?postid=MTM5MQ== -- https://mail.python.org/mailman/listin

OT: looking for best solutions for tracking projects and skills

2013-10-11 Thread Jason Hsu
I realize this is off-topic, but I'm not sure what forum is best for asking about this. I figure that at least a few of you are involved in civic hacking groups. I recently joined a group that does civic hacking. (Adopt-A-Hydrant is an example of civic hacking.) We need a solution for trackin

Metaclass/abc hackery

2013-10-11 Thread Demian Brecht
As with most I'm sure, short of using abc's, I've had very little exposure to metaclasses. So, when digging into abc implementation, I figured it would be a good idea to dig into metaclasses, their usage and actually try writing one. What I did may be contrived, but it was fun nonetheless and a go

Inter-process locking

2013-10-11 Thread Jason Friedman
I have a 3rd-party process that runs for about a minute and supports only a single execution at a time. $ deploy If I want to launch a second process I have to wait until the first finishes. Having two users wanting to run at the same time might happen a few times a day. But, these users will n

Re: Problem in Multiprocessing module

2013-10-11 Thread Terry Reedy
On 10/11/2013 10:53 AM, William Ray Wing wrote: I'm running into a problem in the multiprocessing module. My code is running four parallel processes which are doing network access completely independently of each other (gathering data from different remote sources). On rare circumstances, the

Re: Consolidate several lines of a CSV file with firewall rules [PS]

2013-10-11 Thread Mark Lawrence
On 11/10/2013 22:22, Starriol wrote: On Friday, October 11, 2013 5:50:06 PM UTC-3, Tim Chase wrote: On 2013-10-11 15:40, Tim Chase wrote: the dangling open-quotes on #1 that cause most CSV parsers to read until the subsequent line is read. And by "subsequent line", I mean "subsequent cl

Re: ANN: CUI text editor Kaa 0.0.4

2013-10-11 Thread Dave Angel
On 11/10/2013 07:09, Atsuo Ishimoto wrote: > Hi, > > I've just released Kaa 0.0.4 to PyPI. > > https://pypi.python.org/pypi/kaaedit/ > > Kaa is a easy yet powerful text editor for console user interface, What's a "console user interface?" That's what Windows calls a "DOS box". But otherwise

Re: Skipping decorators in unit tests

2013-10-11 Thread Cameron Simpson
On 11Oct2013 02:37, Gilles Lenfant wrote: > * Adding an "__original__" attribute to the wrapper func in the decorators of > my own Just one remark: Call this __original or _original (or even original). The __x__ names are reserved for python operations (like __add__, supporting "+"). Cheers, -

Re: Multi-threading in Python vs Java

2013-10-11 Thread Cameron Simpson
On 11Oct2013 15:53, Terry Reedy wrote: > On 10/11/2013 4:41 AM, Peter Cacioppi wrote: > >I should add that the computational heavy lifting is done in a third party > >library. So a worker thread looks roughly like this (there is a subtle race > >condition I'm glossing over). > > > >while len(job

Re: Consolidate several lines of a CSV file with firewall rules [PS]

2013-10-11 Thread Starriol
On Friday, October 11, 2013 5:50:06 PM UTC-3, Tim Chase wrote: > On 2013-10-11 15:40, Tim Chase wrote: > > > the dangling open-quotes on #1 that cause most CSV parsers to read > > > until the subsequent line is read. > > > > And by "subsequent line", I mean "subsequent closing-quote" of > > c

Re: closure = decorator?

2013-10-11 Thread Terry Reedy
On 10/11/2013 8:08 AM, Franck Ditter wrote: In article <5257c3dd$0$29984$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: On Fri, 11 Oct 2013 10:14:29 +0300, Jussi Piitulainen wrote: Roy Smith writes: In article , Piet van Oostrum wrote: I usually say that a closure is a pa

Re: closure = decorator?

2013-10-11 Thread Terry Reedy
On 10/11/2013 12:44 PM, Steven D'Aprano wrote: On Fri, 11 Oct 2013 15:01:40 +0300, Jussi Piitulainen wrote: Steven D'Aprano writes: Closures have nothing to do with *arguments*. A better definition of a closure is that it is a function together with a snapshot of the environment it was called

Re: Consolidate several lines of a CSV file with firewall rules [PS]

2013-10-11 Thread Tim Chase
On 2013-10-11 15:40, Tim Chase wrote: > the dangling open-quotes on #1 that cause most CSV parsers to read > until the subsequent line is read. And by "subsequent line", I mean "subsequent closing-quote" of course. :-) -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: Consolidate several lines of a CSV file with firewall rules

2013-10-11 Thread Tim Chase
On 2013-10-11 08:01, Starriol wrote: > NO.;NAME;SOURCE;DESTINATION;VPN  ;SERVICE;ACTION;TRACK;INSTALL > ON;TIME;COMMENT > 1;;fwxcluster;mcast_vrrp;;vrrp;accept;Log;fwxcluster;Any;"VRRP;;*Comment > suppressed* ;igmp**; > 2;;fwxcluster;fwxcluster;;FireWall;accept;Log;fwxcluster;Any;"Managemen

Re: Multi-threading in Python vs Java

2013-10-11 Thread Peter Cacioppi
On Thursday, October 10, 2013 11:01:25 PM UTC-7, Peter Cacioppi wrote: > Could someone give me a brief thumbnail sketch of the difference between > multi-threaded programming in Java. > > > > I have a fairly sophisticated algorithm that I developed as both a single > threaded and multi-threade

Re: Unicode Objects in Tuples

2013-10-11 Thread Terry Reedy
On 10/11/2013 9:31 AM, Stephen Tucker wrote: to be able to by itself. The distinction between the "geekiness" of a tuple compared with the "non-geekiness" of a string is, itself, far too geeky for my liking. The distinction seems to be an utterly spurious - even artificial or arbitrary one to me

Re: Process pending Tk events from GObject main loop?

2013-10-11 Thread Christian Gollwitzer
Am 11.10.13 14:52, schrieb Skip Montanaro: I know I have things bassackwards, but trying to process Gtk events from Tkinter's main loop using after() isn't working. (I suspect our underlying C++ (ab)use of Gtk may require a Gtk main loop). I'd like to process Tk events periodically from a GObject

Re: Multi-threading in Python vs Java

2013-10-11 Thread Terry Reedy
On 10/11/2013 4:41 AM, Peter Cacioppi wrote: I should add that the computational heavy lifting is done in a third party library. So a worker thread looks roughly like this (there is a subtle race condition I'm glossing over). while len(jobs) : job = jobs.pop() model = Model(job)

Re: Regarding URL Shortener

2013-10-11 Thread Datin Farah Natasha
On Saturday, October 12, 2013 1:02:30 AM UTC+8, Steven D'Aprano wrote: > On Fri, 11 Oct 2013 09:14:08 -0700, Datin Farah Natasha wrote: > > > > > Hello guys, i want to make a simple sript that can automatically > > > generate normal to adf.ly links using my accounts? it is possible for me > >

Re: Skipping decorators in unit tests

2013-10-11 Thread Ned Batchelder
On 10/10/13 10:22 PM, Cameron Simpson wrote: On 10Oct2013 19:44, Ned Batchelder wrote: On 10/10/13 6:12 PM, Cameron Simpson wrote: Speaking for myself, I would be include to recast this code: @absolutize def addition(a, b): return a + b into: def _addition(a, b): retu

Re: Skipping decorators in unit tests

2013-10-11 Thread Ethan Furman
On 10/10/2013 08:13 PM, Cameron Simpson wrote: On 11Oct2013 02:55, Steven D'Aprano wrote: On Fri, 11 Oct 2013 09:12:38 +1100, Cameron Simpson wrote: Speaking for myself, I would be include to recast this code: @absolutize def addition(a, b): return a + b into: def _addition

Re: Unicode Objects in Tuples

2013-10-11 Thread Piet van Oostrum
Stephen Tucker writes: > ESRI compound the problem, actually, by making all the strings that the > ArcGIS Python interface > delivers (from MS SQLServer) Unicode! (I suppose, on reflection, they have no > choice.) So I am > stuck with the worst of both worlds - a generation of Python (2.X) that

Re: Skipping decorators in unit tests

2013-10-11 Thread Ethan Furman
On 10/10/2013 08:01 PM, Roy Smith wrote: On 10Oct2013 19:44, Ned Batchelder wrote: I have to admit I'm having a hard time understanding why you'd need to test the undecorated functions. After all, the undecorated functions aren't available to anyone. All that matters is how they behave with t

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Gene Heskett
On Friday 11 October 2013 12:49:40 Roy Smith did opine: > In article , > > Oscar Benjamin wrote: > > If someone tried to explain why their field couldn't use ً for the > > circumference of a unit circle I would suggest that they adjust the > > other parts of their notation not ً (there are othe

Re: datetime.timedelta.replace?

2013-10-11 Thread Joshua Landau
On 9 October 2013 16:15, Skip Montanaro wrote: > Datetime objects have a replace method, but timedelta objects don't. > If I take the diff of two datetimes and want to zero out the > microseconds field, is there some way to do it more cleanly than this? > > delta = dt1 - dt2 > zero_delta = datetim

Re: Unicode Objects in Tuples

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 09:16:36 +0100, Stephen Tucker wrote: > I am using IDLE, Python 2.7.2 on Windows 7, 64-bit. > > I have four questions: > > 1. Why is it that > print unicode_object > displays non-ASCII characters in the unicode object correctly, whereas > print (unicode_object, anot

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 10:05:03 -0400, Roy Smith wrote: > In article , > Oscar Benjamin wrote: > >> If someone tried to explain why their field couldn't use ð for the >> circumference of a unit circle I would suggest that they adjust the >> other parts of their notation not ð (there are other uses

Re: Regarding URL Shortener

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 09:14:08 -0700, Datin Farah Natasha wrote: > Hello guys, i want to make a simple sript that can automatically > generate normal to adf.ly links using my accounts? it is possible for me > to do this using python and use it as python command line. if it's > possible what library

Re: I am never going to complain about Python again

2013-10-11 Thread Joshua Landau
On 11 October 2013 10:11, Steven D'Aprano wrote: > On Fri, 11 Oct 2013 09:17:37 +0100, Joshua Landau wrote: > >> On 11 October 2013 03:08, Steven D'Aprano >> wrote: >>> >>> Given: >>> >>> x ∈ ℝ, x = 2 (reals) >>> y ∈ ℕ, y = 2 (natural numbers) >>> >>> we have x = y, but since 1/y is undefined (

Re: closure = decorator?

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 15:01:40 +0300, Jussi Piitulainen wrote: > Steven D'Aprano writes: >> Closures have nothing to do with *arguments*. A better definition of a >> closure is that it is a function together with a snapshot of the >> environment it was called from. [...] > Second, it's precisely not

Regarding URL Shortener

2013-10-11 Thread Datin Farah Natasha
Hello guys, i want to make a simple sript that can automatically generate normal to adf.ly links using my accounts? it is possible for me to do this using python and use it as python command line. if it's possible what library do i need to use? any help will be appreciated. -- https://mail.pyth

Problem in Multiprocessing module

2013-10-11 Thread William Ray Wing
I'm running into a problem in the multiprocessing module. My code is running four parallel processes which are doing network access completely independently of each other (gathering data from different remote sources). On rare circumstances, the code blows up when one of my processes has do st

Re: Consolidate several lines of a CSV file with firewall rules

2013-10-11 Thread Joel Goldstick
On Fri, Oct 11, 2013 at 11:01 AM, Starriol wrote: > Hi guys. > I have a CSV file, which I created using an HTML export from a Check Point > firewall policy. > Each rule is represented as several lines, in some cases. That occurs when a > rule has several address sources, destinations or services

Consolidate several lines of a CSV file with firewall rules

2013-10-11 Thread Starriol
Hi guys. I have a CSV file, which I created using an HTML export from a Check Point firewall policy. Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or services. I need the output to have each rule described in only one l

Consolidate several lines of a CSV file with firewall rules

2013-10-11 Thread juanscopp
Hi guys. I have a CSV file, which I created using an HTML export from a Check Point firewall policy. Each rule is represented as several lines, in some cases. That occurs when a rule has several address sources, destinations or services. I need the output to have each rule described in only one l

Re: Multi-threading in Python vs Java

2013-10-11 Thread Piet van Oostrum
Chris Angelico writes: > On Fri, Oct 11, 2013 at 7:41 PM, Peter Cacioppi > wrote: >> So, my hope is that the GIL restrictions won't be problematic here. That is >> to say, I don't need **Python** code to ever run concurrently. I just need >> Python to allow a different Python worker thread to

calculating download speed from .pcap file

2013-10-11 Thread patrick
hi, im looking for a way to calculate download speed for a http connection inside my .pcap file. but doing even a simple read with dpkt doesnt really work. import pcap, dpkt import socket pcapReader = dpkt.pcap.Reader(file("http-download.pcap")) for ts, data in pcapReader: print ts, len(d

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Roy Smith
In article , Oscar Benjamin wrote: > If someone tried to explain why their field couldn't use ð for the > circumference of a unit circle I would suggest that they adjust the > other parts of their notation not ð (there are other uses of ð. Pi is wrong: http://www.youtube.com/watch?v=jG7vhMMX

Re: Unicode Objects in Tuples

2013-10-11 Thread Stephen Tucker
A quick reply to all you contributors (by the way, I was not expecting to get so many responses so quickly - I am (as you probably realise) new to this kind of thing. I am stuck with Python 2.X because ESRI's ArcGIS system uses it - otherwise, yes, you're all right, I would be in Python 3.X like a

ANN: CUI text editor Kaa 0.0.4

2013-10-11 Thread Atsuo Ishimoto
Hi, I've just released Kaa 0.0.4 to PyPI. https://pypi.python.org/pypi/kaaedit/ Kaa is a easy yet powerful text editor for console user interface, providing numerous features like - Macro recording. - Undo/Redo. - Multiple windows/frames. - Syntax highlighting. - Open source software(MIT)

Re: Is this the room for an argument?

2013-10-11 Thread Roy Smith
In article <5223ac4a-783e-405d-84a4-239070b66...@googlegroups.com>, John Ladasky wrote: > On Thursday, October 10, 2013 5:07:11 PM UTC-7, Roy Smith wrote: > > I'd like an argument, please. > > 'Receptionist' (Rita Davies) - Yes, sir? > 'Man' (Michael Palin) - I'd like to have an argument please

Process pending Tk events from GObject main loop?

2013-10-11 Thread Skip Montanaro
I know I have things bassackwards, but trying to process Gtk events from Tkinter's main loop using after() isn't working. (I suspect our underlying C++ (ab)use of Gtk may require a Gtk main loop). I'd like to process Tk events periodically from a GObject main loop. I know I want to call gobject.idl

Re: I am never going to complain about Python again

2013-10-11 Thread Neil Cerutti
On 2013-10-11, Steven D'Aprano wrote: > On Thu, 10 Oct 2013 17:48:16 +, Neil Cerutti wrote: > >> >>> 5.0 == abs(3 + 4j) >> False > > Did you maybe accidentally rebind abs? If not, what version of > Python are you using? Honestly, I think I got my Python term and my Vim term mixed up. I Shall

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Jussi Piitulainen
Oscar Benjamin writes: > tried to explain why their field couldn't use π for the > circumference of a unit circle I would suggest that they adjust the > other parts of their notation not π (there are other uses of π. There's τ for the full circle; π is used for half the circumference. -- https

Re: closure = decorator?

2013-10-11 Thread Franck Ditter
In article <5257c3dd$0$29984$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Fri, 11 Oct 2013 10:14:29 +0300, Jussi Piitulainen wrote: > > > Roy Smith writes: > >> In article , > >> Piet van Oostrum wrote: > >> > >> > I usually say that a closure is a package, containing a fu

Re: closure = decorator?

2013-10-11 Thread Jussi Piitulainen
Steven D'Aprano writes: > On Fri, 11 Oct 2013 10:14:29 +0300, Jussi Piitulainen wrote: > > Roy Smith writes: > >> In article , > >> Piet van Oostrum wrote: > >> > >> > I usually say that a closure is a package, containing a > >> > function with some additional data it needs. The data usually > >>

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Oscar Benjamin
On 11 October 2013 10:35, David wrote: > On 11 October 2013 12:27, Steven D'Aprano > wrote: >> On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: >> >>> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: BTW, one of the earliest things that turned me on to Python was when I disc

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Nobody
On Thu, 10 Oct 2013 14:12:36 +, Grant Edwards wrote: > Nope. "i" is electical current (though it's more customary to use upper > case). "I" is steady-state current (either AC or DC), "i" is small-signal current. -- https://mail.python.org/mailman/listinfo/python-list

Re: I am never going to complain about Python again

2013-10-11 Thread Chris Angelico
On Fri, Oct 11, 2013 at 8:11 PM, Steven D'Aprano wrote: > If you implicitly decide to promote entities, then of course you can > promote y to a real then take the invoice. Either you're channelling Bugs Bunny or you're trying to sell me something... you mean "take the inverse", I assume, here :)

Re: Skipping decorators in unit tests

2013-10-11 Thread Gilles Lenfant
Cameron, Steven, Ben, Ned, Terry, Roy. Many thanks for this interesting discussion. I ended up... mixing some solutions provided by your hints : * Adding an "__original__" attribute to the wrapper func in the decorators of my own * Playing with "func_closure" to test functions/methods provided

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread David
On 11 October 2013 12:27, Steven D'Aprano wrote: > On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: > >> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >>> BTW, one of the earliest things that turned me on to Python was when I >>> discovered that it uses j as the imaginary unit, not

Re: Multi-threading in Python vs Java

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 17:53:02 +1100, Cameron Simpson wrote: > Other Python implementations may be more aggressive. I'd suppose Jypthon > could multithread like Java, but really I have no experience with them. Neither Jython nor IronPython have a GIL. > The standard answer with CPython is that if

Re: closure = decorator?

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 10:14:29 +0300, Jussi Piitulainen wrote: > Roy Smith writes: >> In article , >> Piet van Oostrum wrote: >> >> > I usually say that a closure is a package, containing a function with >> > some additional data it needs. The data usually is in the form of >> > name bindings. >>

Re: Unicode Objects in Tuples

2013-10-11 Thread Ned Batchelder
On 10/11/13 4:16 AM, Stephen Tucker wrote: I am using IDLE, Python 2.7.2 on Windows 7, 64-bit. I have four questions: 1. Why is it that print unicode_object displays non-ASCII characters in the unicode object correctly, whereas print (unicode_object, another_unicode_object) displays n

Re: I am never going to complain about Python again

2013-10-11 Thread Steven D'Aprano
On Fri, 11 Oct 2013 09:17:37 +0100, Joshua Landau wrote: > On 11 October 2013 03:08, Steven D'Aprano > wrote: >> Your mistake here seems to be that you're assuming that if two numbers >> are equal, they must be in the same domain, but that's not the case. >> (Perhaps you think that 0.0 == 0+0j sh

Re: Unicode Objects in Tuples

2013-10-11 Thread Peter Otten
Stephen Tucker wrote: > I am using IDLE, Python 2.7.2 on Windows 7, 64-bit. > > I have four questions: > > 1. Why is it that > print unicode_object > displays non-ASCII characters in the unicode object correctly, whereas > print (unicode_object, another_unicode_object) > displays non-A

Re: Multi-threading in Python vs Java

2013-10-11 Thread Chris Angelico
On Fri, Oct 11, 2013 at 7:41 PM, Peter Cacioppi wrote: > So, my hope is that the GIL restrictions won't be problematic here. That is > to say, I don't need **Python** code to ever run concurrently. I just need > Python to allow a different Python worker thread to execute when all the > other wo

Re: Multi-threading in Python vs Java

2013-10-11 Thread Peter Cacioppi
On Thursday, October 10, 2013 11:01:25 PM UTC-7, Peter Cacioppi wrote: > Could someone give me a brief thumbnail sketch of the difference between > multi-threaded programming in Java. > > > > I have a fairly sophisticated algorithm that I developed as both a single > threaded and multi-threade

Re: Skipping decorators in unit tests

2013-10-11 Thread Terry Reedy
On 10/11/2013 4:17 AM, Terry Reedy wrote: On 10/10/2013 11:13 PM, Cameron Simpson wrote: On 11Oct2013 02:55, Steven D'Aprano wrote: def undecorate(f): """Return the undecorated inner function from function f.""" return f.func_closure[0].cell_contents Whereas this feels like black

Re: Unicode Objects in Tuples

2013-10-11 Thread Ben Finney
Stephen Tucker writes: > I am using IDLE, Python 2.7.2 on Windows 7, 64-bit. Python 2 is not as good at Unicode as Python 3. In fact, one of the major reasons to switch to Python 3 is that it fixes Unicode behaviour that was worse in Python 2. > I have four questions: > > 1. Why is it that […]

Re: Skipping decorators in unit tests

2013-10-11 Thread Terry Reedy
On 10/11/2013 4:17 AM, Terry Reedy wrote: On 10/10/2013 11:13 PM, Cameron Simpson wrote: On 11Oct2013 02:55, Steven D'Aprano wrote: def undecorate(f): """Return the undecorated inner function from function f.""" return f.func_closure[0].cell_contents Whereas this feels like black

Re: Skipping decorators in unit tests

2013-10-11 Thread Terry Reedy
On 10/11/2013 12:36 AM, Steven D'Aprano wrote: I also like Terry Reedy's suggestion of having the decorator automatically add the unwrapped function to the wrapped function as an attribute: def decorate(func): @functools.wraps(func) def inner(arg): blah blah inner._unwra

Re: Skipping decorators in unit tests

2013-10-11 Thread Terry Reedy
On 10/10/2013 11:13 PM, Cameron Simpson wrote: On 11Oct2013 02:55, Steven D'Aprano wrote: def undecorate(f): """Return the undecorated inner function from function f.""" return f.func_closure[0].cell_contents Whereas this feels like black magic. Is this portable to any decorated

Re: I am never going to complain about Python again

2013-10-11 Thread Joshua Landau
On 11 October 2013 03:08, Steven D'Aprano wrote: > Your mistake here seems to be that you're assuming that if two numbers > are equal, they must be in the same domain, but that's not the case. > (Perhaps you think that 0.0 == 0+0j should return False?) It's certainly > not the case when it comes t

Unicode Objects in Tuples

2013-10-11 Thread Stephen Tucker
I am using IDLE, Python 2.7.2 on Windows 7, 64-bit. I have four questions: 1. Why is it that print unicode_object displays non-ASCII characters in the unicode object correctly, whereas print (unicode_object, another_unicode_object) displays non-ASCII characters in the unicode objects as

Re: closure = decorator?

2013-10-11 Thread Jussi Piitulainen
Roy Smith writes: > In article , > Piet van Oostrum wrote: > > > I usually say that a closure is a package, containing a function > > with some additional data it needs. The data usually is in the > > form of name bindings. > > That's pretty close to the way I think about it. The way it was > o