Re: Can Python function return multiple data?

2015-06-05 Thread Dave Farrance
Rustom Mody wrote: >On Saturday, June 6, 2015 at 10:20:49 AM UTC+5:30, Steven D'Aprano wrote: >> On Sat, 6 Jun 2015 01:20 pm, Rustom Mody wrote: >> > As a parallel here is Dijkstra making fun of AI-ers use of the word >> > 'intelligent' >> > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD0

Re: How to inverse a particle emitter

2015-06-05 Thread Chris Angelico
On Sat, Jun 6, 2015 at 10:10 AM, Dennis Lee Bieber wrote: > That is in the same class as the "lunar lander" game on my college > mainframe... > > It did not do validity checking of inputs, with the result that one > could do > > -10 lbs thrust at 180 degrees > > and GAIN fuel while

Re: Can Python function return multiple data?

2015-06-05 Thread Chris Angelico
On Sat, Jun 6, 2015 at 3:28 PM, Rustom Mody wrote: > You just repeated what Chris said, replacing 'immutable' with 'same' > There was a list: [1,2,3] > At some point that list is found to be(come) [1,2,3,4] > They dont look same to me. "I'm going shopping, can you get me the shopping list please?

Re: Can Python function return multiple data?

2015-06-05 Thread Rustom Mody
On Saturday, June 6, 2015 at 10:20:49 AM UTC+5:30, Steven D'Aprano wrote: > On Sat, 6 Jun 2015 01:20 pm, Rustom Mody wrote: > > As a parallel here is Dijkstra making fun of AI-ers use of the word > > 'intelligent' > > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD618.html > > Nice

Re: Can Python function return multiple data?

2015-06-05 Thread Rustom Mody
On Saturday, June 6, 2015 at 8:58:13 AM UTC+5:30, rand...@fastmail.us wrote: > On Fri, Jun 5, 2015, at 23:20, Rustom Mody wrote: > > The word immutuable happens to have existed in English before python. > > I also happen to have used it before I knew of python > > The two meanings do not match > >

Re: Can Python function return multiple data?

2015-06-05 Thread Chris Angelico
On Sat, Jun 6, 2015 at 2:50 PM, Steven D'Aprano wrote: > This does not happen: > > mylist = [] > mytuple = (None, 1, mylist) > mylist.append(0) > => raises an exception > > The *tuple* is immutable, not the list. What you could have is a "FrozenList" (by analogy with frozenset), s

Re: Can Python function return multiple data?

2015-06-05 Thread Steven D'Aprano
On Sat, 6 Jun 2015 01:20 pm, Rustom Mody wrote: > On Saturday, June 6, 2015 at 3:30:23 AM UTC+5:30, Chris Angelico wrote: >> Congrats! You just proved that an object can itself be immutable, but >> can contain references to mutables. Ain't that awesome? >> >> Did you have a point? > > [Under as

Re: Can Python function return multiple data?

2015-06-05 Thread Chris Angelico
On Sat, Jun 6, 2015 at 1:28 PM, wrote: > On Fri, Jun 5, 2015, at 23:20, Rustom Mody wrote: >> The word immutuable happens to have existed in English before python. >> I also happen to have used it before I knew of python >> The two meanings do not match >> I am surprised >> Is that surprising? >

Re: Can Python function return multiple data?

2015-06-05 Thread random832
On Fri, Jun 5, 2015, at 23:20, Rustom Mody wrote: > The word immutuable happens to have existed in English before python. > I also happen to have used it before I knew of python > The two meanings do not match > I am surprised > Is that surprising? They don't match only if you consider the objects

Re: Can Python function return multiple data?

2015-06-05 Thread Rustom Mody
On Saturday, June 6, 2015 at 3:30:23 AM UTC+5:30, Chris Angelico wrote: > On Fri, Jun 5, 2015 at 11:29 PM, Rustom Mody wrote: > > On Friday, June 5, 2015 at 4:36:35 PM UTC+5:30, Steven D'Aprano wrote: > >> On Fri, 5 Jun 2015 01:16 pm, Rustom Mody wrote: > >> > The abstract platonic immutable list i

Re: Get html DOM tree by only basic builtin moudles

2015-06-05 Thread Wesley
> On Fri, Jun 5, 2015 at 12:10 PM, Wesley wrote: > > Hi Laura, > > Sure, I got special requirement that just parse html file into DOM tree, > > by only general basic modules, and based on my DOM tree structure, draft an > > bitmap. > > > > So, could you give me an direction how to get the DO

Re: Can Python function return multiple data?

2015-06-05 Thread Chris Angelico
On Fri, Jun 5, 2015 at 11:29 PM, Rustom Mody wrote: > On Friday, June 5, 2015 at 4:36:35 PM UTC+5:30, Steven D'Aprano wrote: >> On Fri, 5 Jun 2015 01:16 pm, Rustom Mody wrote: >> > The abstract platonic immutable list is non-existent in python >> >> Just pretend that "immutable list" is spelled "t

Re: Get html DOM tree by only basic builtin moudles

2015-06-05 Thread Ian Kelly
On Fri, Jun 5, 2015 at 12:10 PM, Wesley wrote: > Hi Laura, > Sure, I got special requirement that just parse html file into DOM tree, by > only general basic modules, and based on my DOM tree structure, draft an > bitmap. > > So, could you give me an direction how to get the DOM tree? > Curr

Re: Can Python function return multiple data?

2015-06-05 Thread sohcahtoa82
On Wednesday, June 3, 2015 at 2:57:00 PM UTC-7, Mark Lawrence wrote: > On 03/06/2015 22:35, Chris Angelico wrote: > > On Wed, Jun 3, 2015 at 11:56 PM, Thomas Rachel > > > > wrote: > >> Am 03.06.2015 um 01:56 schrieb Chris Angelico: > >> > >>> and it's pretty convenient. In C, the nearest equivalen

Re: Get html DOM tree by only basic builtin moudles

2015-06-05 Thread Wesley
Hi Laura, Sure, I got special requirement that just parse html file into DOM tree, by only general basic modules, and based on my DOM tree structure, draft an bitmap. So, could you give me an direction how to get the DOM tree? Currently, I just think out to use something like stack, I mean, m

Re: Python.exe has stopped working

2015-06-05 Thread Stephen Hansen
On Fri, Jun 5, 2015, at 02:03 AM, Alexis Dubois wrote: > Anyone else for an idea on that? Sorry, I have no idea. Have you tried asking on the PyQT mailing list where there is likely more of a concentration of PyQT expertise? http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Stephen Han

Re: How to inverse a particle emitter

2015-06-05 Thread alister
On Thu, 04 Jun 2015 16:15:20 -0700, stephenppraneel7 wrote: > hey, i really need help, im a straight up beginner in scripting and i > need to figure out how to make an inverted particle emitter using python > in maya Some very goo pointers from the Python team https://www.youtube.com/watch?v=tNf

Re: Sorting in reverse is not the same as sorting then reversing

2015-06-05 Thread Skip Montanaro
On Fri, Jun 5, 2015 at 9:50 AM, Stefan Behnel wrote: > [Stable sorting is] a general property of Python's sort algorithm. And at times an extremely valuable property. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Sorting in reverse is not the same as sorting then reversing

2015-06-05 Thread Peter Otten
Steven D'Aprano wrote: > Sorting in reverse does not give the same result as sorting then > reversing. > > It's easiest to see with a key function: > > > py> a = ['fox', 'dog', 'DOG', 'cat', 'ape'] > py> b = a[:] > py> a.sort(key=str.lower, reverse=True) > py> b.sort(key=str.lower) > py> b.reve

Re: Sorting in reverse is not the same as sorting then reversing

2015-06-05 Thread Stefan Behnel
Steven D'Aprano schrieb am 05.06.2015 um 16:07: > Sorting in reverse does not give the same result as sorting then reversing. > > It's easiest to see with a key function: > > py> a = ['fox', 'dog', 'DOG', 'cat', 'ape'] > py> b = a[:] > py> a.sort(key=str.lower, reverse=True) > py> b.sort(key=str.

Re: How to inverse a particle emitter

2015-06-05 Thread Grant Edwards
On 2015-06-04, stephenpprane...@gmail.com wrote: > hey, i really need help, im a straight up beginner in scripting and i > need to figure out how to make an inverted particle emitter using > python in maya 1) Build a particle emitter 2) Turn it upside down -- Grant Edwards grant

Re: So what's happening here?

2015-06-05 Thread Nobody
On Fri, 05 Jun 2015 13:11:13 +, Paul Appleby wrote: > (I'd have thought that id(a[1]) and id(b[1]) would be the same if they > were the same element via different "views", but the id's seem to change > according to rules that I can't fathom.) First, a[1] and b[1] aren't views, they're scalars

Sorting in reverse is not the same as sorting then reversing

2015-06-05 Thread Steven D'Aprano
Sorting in reverse does not give the same result as sorting then reversing. It's easiest to see with a key function: py> a = ['fox', 'dog', 'DOG', 'cat', 'ape'] py> b = a[:] py> a.sort(key=str.lower, reverse=True) py> b.sort(key=str.lower) py> b.reverse() py> a ['fox', 'dog', 'DOG', 'cat', 'ape'

Re: So what's happening here?

2015-06-05 Thread Gary Herron
On 06/05/2015 06:39 AM, Todd wrote: On Fri, Jun 5, 2015 at 3:23 PM, Gary Herron > wrote: On 06/05/2015 06:11 AM, Paul Appleby wrote: On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: Numpy arrays are not lists, they are numpy arrays

Re: So what's happening here?

2015-06-05 Thread Steven D'Aprano
On Fri, 5 Jun 2015 11:11 pm, Paul Appleby wrote: > On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: > >> Numpy arrays are not lists, they are numpy arrays. They are two >> different data types with different behaviors. In lists, slicing is a >> copy. In numpy arrays, it is a view (a data structu

Re: So what's happening here?

2015-06-05 Thread Todd
On Fri, Jun 5, 2015 at 3:23 PM, Gary Herron wrote: > On 06/05/2015 06:11 AM, Paul Appleby wrote: > >> On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: >> >> Numpy arrays are not lists, they are numpy arrays. They are two >>> different data types with different behaviors. In lists, slicing is a >

Re: Can Python function return multiple data?

2015-06-05 Thread Marko Rauhamaa
random...@fastmail.us: > The normal human-readable representation of a reference is an arrow on > a diagram, pointing from a box that represents the variable to a box > that represents the object. But I can't exactly put that in a > text-based email. An *lvalue* is anything that can be assigned t

Re: So what's happening here?

2015-06-05 Thread Gary Herron
On 06/05/2015 06:11 AM, Paul Appleby wrote: On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: Numpy arrays are not lists, they are numpy arrays. They are two different data types with different behaviors. In lists, slicing is a copy. In numpy arrays, it is a view (a data structure representing

Re: Can Python function return multiple data?

2015-06-05 Thread Rustom Mody
On Friday, June 5, 2015 at 4:36:35 PM UTC+5:30, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 01:16 pm, Rustom Mody wrote: > > The abstract platonic immutable list is non-existent in python > > Just pretend that "immutable list" is spelled "tuple". Ok lets say I make no fuss about the need to 'pret

Re: So what's happening here?

2015-06-05 Thread Todd
On Fri, Jun 5, 2015 at 3:11 PM, Paul Appleby wrote: > On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: > > > Numpy arrays are not lists, they are numpy arrays. They are two > > different data types with different behaviors. In lists, slicing is a > > copy. In numpy arrays, it is a view (a data s

GCJ Watersheds

2015-06-05 Thread neng . zhou
I just posted a program in Picat for the GCJ Watersheds problem. I am wondering how many lines a Python program would require. https://groups.google.com/forum/#!topic/picat-lang/1QC3KWwfyA8 Cheers, Neng-Fa -- https://mail.python.org/mailman/listinfo/python-list

Re: So what's happening here?

2015-06-05 Thread Paul Appleby
On Fri, 05 Jun 2015 14:55:11 +0200, Todd wrote: > Numpy arrays are not lists, they are numpy arrays. They are two > different data types with different behaviors. In lists, slicing is a > copy. In numpy arrays, it is a view (a data structure representing some > part of another data structure).

Re: So what's happening here?

2015-06-05 Thread Peter Otten
Paul Appleby wrote: > I saw somewhere on the net that you can copy a list with slicing. So > what's happening when I try it with a numpy array? > a = numpy.array([1,2,3]) b = a[:] a is b > False b[1] = 9 a > array([1, 9, 3]) Copy or view -- have a look under the hood: >

Re: So what's happening here?

2015-06-05 Thread Todd
On Fri, Jun 5, 2015 at 2:46 PM, Paul Appleby wrote: > I saw somewhere on the net that you can copy a list with slicing. So > what's happening when I try it with a numpy array? > > >>> a = numpy.array([1,2,3]) > >>> b = a[:] > >>> a is b > False > >>> b[1] = 9 > >>> a > array([1, 9, 3]) > > Numpy

Re: So what's happening here?

2015-06-05 Thread Larry Martell
On Fri, Jun 5, 2015 at 8:46 AM, Paul Appleby wrote: > I saw somewhere on the net that you can copy a list with slicing. So > what's happening when I try it with a numpy array? > a = numpy.array([1,2,3]) b = a[:] a is b > False b[1] = 9 a > array([1, 9, 3]) is is identity

Re: So what's happening here?

2015-06-05 Thread Fabien
On 06/05/2015 02:46 PM, Paul Appleby wrote: I saw somewhere on the net that you can copy a list with slicing. So what's happening when I try it with a numpy array? Python lists and numpy arrays are NOT the same thing. This is one of the reasons why numpy was developed in the first place. Numpy

So what's happening here?

2015-06-05 Thread Paul Appleby
I saw somewhere on the net that you can copy a list with slicing. So what's happening when I try it with a numpy array? >>> a = numpy.array([1,2,3]) >>> b = a[:] >>> a is b False >>> b[1] = 9 >>> a array([1, 9, 3]) -- https://mail.python.org/mailman/listinfo/python-list

Re: Can Python function return multiple data?

2015-06-05 Thread random832
On Thu, Jun 4, 2015, at 22:37, Steven D'Aprano wrote: > That's not a reference to the value. That's a string that describes the > object. Well, of course. None of these things are strings. The normal human-readable representation of a reference is an arrow on a diagram, pointing from a box that

Re: Can Python function return multiple data?

2015-06-05 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> Grant Edwards writes: >> >> [...] >>> Or to be a bit obtuse: Python parameters are passed by value, but all >>> values are references. >> >> Exactly, that's a perfect description. There's is no need for a new >> name. As a corollary, all names (inc

Re: Can Python function return multiple data?

2015-06-05 Thread Steven D'Aprano
On Fri, 5 Jun 2015 01:16 pm, Rustom Mody wrote: > Consider the C canonical linked-list example (of some type T): > > struct node > { >T elem; >struct node *next; > }; > > Is the list in C to be identified with 'struct node'? Lists in C are not first class values. There is no one thing w

Re: How to inverse a particle emitter

2015-06-05 Thread Laura Creighton
In a message of Thu, 04 Jun 2015 16:15:20 -0700, stephenpprane...@gmail.com wri tes: >hey, i really need help, im a straight up beginner in scripting and i need to >figure out how to make an inverted particle emitter using python in maya >-- >https://mail.python.org/mailman/listinfo/python-list Y

Re: Can Python function return multiple data?

2015-06-05 Thread BartC
On 05/06/2015 02:48, Steven D'Aprano wrote: On Fri, 5 Jun 2015 11:40 am, Mark Lawrence wrote: On 05/06/2015 01:16, BartC wrote: On 05/06/2015 00:13, Steven D'Aprano wrote: On Fri, 5 Jun 2015 06:52 am, BartC wrote: On 04/06/2015 18:11, Steven D'Aprano wrote: If there is any language where

Re: Can Python function return multiple data?

2015-06-05 Thread BartC
On 04/06/2015 15:37, Grant Edwards wrote: On 2015-06-04, Marko Rauhamaa wrote: Steven D'Aprano : But you still find a few people here and there who have been exposed to Java foolishness, and will argue that Python is "pass by value, where the value is an implementation dependent reference to

Re: Can Python function return multiple data?

2015-06-05 Thread Marko Rauhamaa
Alain Ketterlin : > Grant Edwards writes: > > [...] >> Or to be a bit obtuse: Python parameters are passed by value, but all >> values are references. > > Exactly, that's a perfect description. There's is no need for a new > name. As a corollary, all names (including "variables" and object > attr

Re: Python.exe has stopped working

2015-06-05 Thread Christian Gollwitzer
Am 05.06.15 um 11:03 schrieb Alexis Dubois: Anyone else for an idea on that? Well, it is a crash on exit. Looks like a memory error inside of PyQT. If you've got the time, you could run it inside of a debugger, or better, a memory checker like AppVerifier to find the culprit. These things are

Re: Python.exe has stopped working

2015-06-05 Thread Alexis Dubois
Anyone else for an idea on that? -- https://mail.python.org/mailman/listinfo/python-list

Re: Find in ipython3

2015-06-05 Thread Cecil Westerhof
Op Thursday 4 Jun 2015 22:13 CEST schreef random: > On Tue, Jun 2, 2015, at 12:13, Cecil Westerhof wrote: >> I am thinking about using ipython3 instead of bash. When I want to >> find a file I can do the following: >> !find ~ -iname '*python*.pdf' >> but is there a python way? > > Python really is

Re: Can Python function return multiple data?

2015-06-05 Thread Alain Ketterlin
Grant Edwards writes: [...] > Or to be a bit obtuse: Python parameters are passed by value, but all > values are references. Exactly, that's a perfect description. There's is no need for a new name. As a corollary, all names (including "variables" and object attributes) are references. -- Alain

Re: Can Python function return multiple data?

2015-06-05 Thread Alain Ketterlin
Steven D'Aprano writes: > On Fri, 5 Jun 2015 04:17 am, Alain Ketterlin wrote: > >> Steven D'Aprano writes: >> >> [...] >>> But you still find a few people here and there who have been exposed to >>> Java foolishness, and will argue that Python is "pass by value, where the >>> value is an implem