Re: Deep vs. shallow copy?

2014-03-13 Thread Mark Lawrence
On 14/03/2014 00:22, Chris Angelico wrote: Trollbridge: you have to pay a troll to cross. And you mustn't be afraid of the Black Night? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viru

Re: Balanced trees

2014-03-13 Thread Steven D'Aprano
On Thu, 13 Mar 2014 20:12:41 -0700, Dan Stromberg wrote: > Sorting the same (slightly tweaked) data inside of a tight loop is > rarely a good idea - despite the fact that the "sort" itself tends to be > O(n) with Python's rather awesome builtin sorting algorithm. This is > because sorting inside

Re: Deep vs. shallow copy?

2014-03-13 Thread Steven D'Aprano
On Thu, 13 Mar 2014 19:57:53 -0700, Rustom Mody wrote: > I believe that you, Marko (and I) are saying exactly the same thing: I believe that you and I are saying practically the same thing. > Wear language-lawyer hat: > Python has no procedures -- just functions which may return None Almost. F

Re: Balanced trees

2014-03-13 Thread Dan Stromberg
On Thu, Mar 13, 2014 at 4:57 PM, Steven D'Aprano wrote: > On Mon, 10 Mar 2014 19:34:48 +0200, Marko Rauhamaa wrote: > >>> With a high level language like Python, using the provided hash table >>> will almost always cream any hand-built tree, no matter how >>> advantageous the data is to the tree.

Re: Deep vs. shallow copy?

2014-03-13 Thread Rustom Mody
On Friday, March 14, 2014 5:11:03 AM UTC+5:30, Steven D'Aprano wrote: > On Thu, 13 Mar 2014 14:27:48 +0200, Marko Rauhamaa wrote: > > Roy Smith : > >> Steven D'Aprano wrote: > >>> Because Python doesn't have true procedures > >> What do you mean by "true procedure"? Are you just talking about >

Re: Deep vs. shallow copy?

2014-03-13 Thread Steven D'Aprano
On Fri, 14 Mar 2014 11:22:43 +1100, Chris Angelico wrote: > Trollbridge: you have to pay a troll to cross. Heh :-) But seriously, there is a distinction to be made between returning from a sub-routine, and returning from a sub-routine with a return result. There may be alternative methods of e

Re: Deep vs. shallow copy?

2014-03-13 Thread Steven D'Aprano
On Fri, 14 Mar 2014 10:55:44 +1100, Chris Angelico wrote: > On Fri, Mar 14, 2014 at 10:41 AM, Steven D'Aprano > wrote: >> Are you trolling again? >> >> I'm sure that you know quite well that Python doesn't have a procedure >> type. It uses a single keyword, def, for creating both functions and >>

Re: pickle.dump (obj, conn)

2014-03-13 Thread Ian Kelly
On Thu, Mar 13, 2014 at 4:36 PM, Pedro Izecksohn wrote: > Shouldn't pickle.dump (obj, conn) raise an Exception if conn is a TCP > connection that was closed by the remote host? Can you be more specific about what you are doing, what you expect the result to be, and what the actual result is? h

pickle.dump (obj, conn)

2014-03-13 Thread Pedro Izecksohn
  Shouldn't pickle.dump (obj, conn) raise an Exception if conn is a TCP connection that was closed by the remote host? -- https://mail.python.org/mailman/listinfo/python-list

Re: which async framework?

2014-03-13 Thread Tim Chase
On 2014-03-14 00:25, Chris Withers wrote: > I've been pleasantly surprised by the succinct, well reasoned and > respectful replies from each of the communities! As one who doesn't lurk on the other lists, is there a nice executive summary of their responses? -tkc -- https://mail.python.org/m

Re: which async framework?

2014-03-13 Thread Chris Withers
On 11/03/2014 19:41, Terry Reedy wrote: I suspect I'll just end up cross-posting to the various mailing lists, Bad idea. Post separately if you must. > which I hope won't cause too much offence or kick off any flame wars. It would do both. Ye of little faith :-P I've been pleasantly surp

Re: Deep vs. shallow copy?

2014-03-13 Thread Chris Angelico
On Fri, Mar 14, 2014 at 11:08 AM, Ian Kelly wrote: > On Thu, Mar 13, 2014 at 5:55 PM, Chris Angelico wrote: >> I'm going to troll for a moment and give you a function that has no >> return value. >> >> def procedure(): >> raise Exception > import dis dis.dis(procedure) > 2

Re: Deep vs. shallow copy?

2014-03-13 Thread Ian Kelly
On Thu, Mar 13, 2014 at 5:55 PM, Chris Angelico wrote: > I'm going to troll for a moment and give you a function that has no > return value. > > def procedure(): > raise Exception >>> import dis >>> dis.dis(procedure) 2 0 LOAD_GLOBAL 0 (Exception) 3 RAIS

Re: Balanced trees

2014-03-13 Thread Steven D'Aprano
On Mon, 10 Mar 2014 19:34:48 +0200, Marko Rauhamaa wrote: >> With a high level language like Python, using the provided hash table >> will almost always cream any hand-built tree, no matter how >> advantageous the data is to the tree. > > The main thing is there are use cases where order is essen

Re: Deep vs. shallow copy?

2014-03-13 Thread Chris Angelico
On Fri, Mar 14, 2014 at 10:41 AM, Steven D'Aprano wrote: > Are you trolling again? > > I'm sure that you know quite well that Python doesn't have a procedure > type. It uses a single keyword, def, for creating both functions and > functions-that-return-None. I'm going to troll for a moment and gi

Re: Deep vs. shallow copy?

2014-03-13 Thread Steven D'Aprano
On Thu, 13 Mar 2014 14:27:48 +0200, Marko Rauhamaa wrote: > Roy Smith : > >> Steven D'Aprano wrote: >> >>> Because Python doesn't have true procedures >> >> What do you mean by "true procedure"? Are you just talking about >> subroutines that don't return any value, i.e. fortran's SUBROUTINE vs.

Re: Deep vs. shallow copy?

2014-03-13 Thread Steven D'Aprano
On Thu, 13 Mar 2014 07:44:27 -0400, Roy Smith wrote: > In article <5320e8c9$0$29994$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> Because Python doesn't have true procedures > > What do you mean by "true procedure"? Are you just talking about > subroutines that don't retu

asyncio question

2014-03-13 Thread Joseph L. Casale
I have a portion of code I need to speed up, there are 3 api calls to an external system where the first enumerates a large collection of objects I then loop through and perform two additional api calls each. The first call is instant, the second and third per object are very slow. Currently aft

Re: Balanced trees

2014-03-13 Thread Ian Kelly
On Mon, Mar 10, 2014 at 11:34 AM, Marko Rauhamaa wrote: > The main thing is there are use cases where order is essential. That's > why I have had to implement the AVL tree in Python myself. No biggie, > but a C implementation would probably be much faster. Also, a standard > version would likely b

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread Chris Angelico
On Fri, Mar 14, 2014 at 4:22 AM, wrote: > DUAL is an Oracle thing. It used to have two rows, in order to be used > to duplicate results by doing a cartesian join to it. At some point, > that was removed, but the name stuck. > > Most other servers allow SELECT without FROM. Yeah, I usually use Po

Re: Deep vs. shallow copy?

2014-03-13 Thread random832
On Thu, Mar 13, 2014, at 11:28, Rustom Mody wrote: > Heh! I was hesitating to put that line at all: For one thing its a > hackneyed truth in the non-FP community. For another, in practical > Haskell, use of frank recursion is regarded as as sign of programming > immaturity: And IIRC Lisp and Schem

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread random832
On Thu, Mar 13, 2014, at 13:01, Chris Angelico wrote: > On Fri, Mar 14, 2014 at 1:43 AM, John Gordon wrote: > >> select foo() as value from dual > > > > That will get the return value into an SQL variable, but the OP wanted > > to know how to fetch it from python code. > > In theory, that should

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread Chris Angelico
On Fri, Mar 14, 2014 at 1:43 AM, John Gordon wrote: >> select foo() as value from dual > > That will get the return value into an SQL variable, but the OP wanted > to know how to fetch it from python code. In theory, that should produce a one-row-one-column SELECT result, which can then be retrie

Re: Deep vs. shallow copy?

2014-03-13 Thread Rustom Mody
On Thursday, March 13, 2014 5:08:22 PM UTC+5:30, Ian wrote: > On 13/03/2014 03:09, Rustom Mody wrote: > > Call the action-world the 'imperative' world. > > Call the value-world the 'functional' world ('declarative' would be > > better but 'functional' is too entrenched). > > [Following table meant

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread Skip Montanaro
Thanks for the responses. We eventually figured out there appears to be a bug in the latest version of the python-sybase module (at least in 0.40, probably in 0.39 as well). It was actually detecting CS_STATUS_RESULT coming from the server and responding appropriately, however it was assigning the

Re: TypeError: can't multiply sequence by non-int of type 'tuple'

2014-03-13 Thread simiasaro
On Friday, February 21, 2014 1:31:53 AM UTC-5, Jaydeep Patil wrote: > HI, > > > > I have a tuple. I need to make sqaure of elements of tuple and after that i > want add all suared tuple elements for total. When i trying to do it, below > error came. > > > > > > Code: > > seriesxlist1 = (

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread John Gordon
In Petite Abeille writes: > Alternatively=85 if it=92s really a function=85 wrap it in a select = > statement=85 such as: > select foo() as value from dual That will get the return value into an SQL variable, but the OP wanted to know how to fetch it from python code. -- John Gordon

Re: What does gc.get_objects() return?

2014-03-13 Thread Jurko Gospodnetić
Hi. On 13.3.2014. 3:54, Terry Reedy wrote: On 3/12/2014 3:34 PM, Jurko Gospodnetić wrote: I was wondering if someone could explain gc.get_objects() in a bit more detail to me. Does it return a list of 'all objects known to Python'? Only some of them? Which does it return? Which it doe

Re: What does gc.get_objects() return?

2014-03-13 Thread Jurko Gospodnetić
Hi. On 12.3.2014. 23:40, Ian Kelly wrote: Or is it? a = 1,2,3 gc.is_tracked(a) True gc.collect() 0 gc.is_tracked(a) False Ufff.. nice one :-D Best regards, Jurko Gospodnetić -- https://mail.python.org/mailman/listinfo/python-list

Re: Deep vs. shallow copy?

2014-03-13 Thread Marko Rauhamaa
Roy Smith : > Steven D'Aprano wrote: > >> Because Python doesn't have true procedures > > What do you mean by "true procedure"? Are you just talking about > subroutines that don't return any value, i.e. fortran's SUBROUTINE vs. > FUNCTION? Ah, the "no true procedure" argument: - No true proce

Re: Deep vs. shallow copy?

2014-03-13 Thread Roy Smith
In article <5320e8c9$0$29994$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Because Python doesn't have true procedures What do you mean by "true procedure"? Are you just talking about subroutines that don't return any value, i.e. fortran's SUBROUTINE vs. FUNCTION? -- https:/

Re: Deep vs. shallow copy?

2014-03-13 Thread Ian
On 13/03/2014 03:09, Rustom Mody wrote: Call the action-world the 'imperative' world. Call the value-world the 'functional' world ('declarative' would be better but 'functional' is too entrenched). [Following table meant to be read with fixed (courier) font] | | Imperati

[ANN] PyWeek 18 will run in May (11th to 18th)

2014-03-13 Thread Richard Jones
Hi all, The Python Game Programming Challenge will run its 18th challenge from the 11th to the 18th of May. The PyWeek challenge: 1. Invites entrants to write a game in one week from scratch either as an individual or in a team, 2. Is intended to be challenging and fun, 3. W