Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread eryksun
On Mon, Jan 27, 2014 at 9:07 AM, Mark Lawrence wrote: > On 27/01/2014 09:53, spir wrote: >> >> Note: your example is strongly obscured by using weird and rare features >> that don't bring any helpful point to the actual problematic concepts >> you apparently want to deal with. >> > > Nothing weird

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread eryksun
On Mon, Jan 27, 2014 at 2:01 PM, Danny Yoo wrote: > And variable binding itself can even have a slightly > different meaning, depending on whether the surrounding context is a > function definition or not, establishing a local or global variable > binding. Whew! Name binding is local unless you

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread Danny Yoo
> Apparently a[0]=b[0] does not qualify as "symbolic assignment" in this case. > a[0] is not a reference to b[0]. I think I see the essential distinction. > Experience will complete the picture for me. Yes. The distinction is something that is blurred by Python's syntax. The "=" is a conceptual

Re: [Tutor] Multi Layered Graphs

2014-01-27 Thread Albert-Jan Roskam
-- On Sun, Jan 26, 2014 11:23 PM CET Ankit Arora wrote: >I'm working on a project which involves network graphs. Is there a library >that can help me do this: > >I want to create multi-layered graphs i.e. graphs which contain a set >number of vertices but multiple 'lay

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread Denis Heidtmann
Thanks for the responses. The distinction between replacement and modification seems to capture the essential aspect and helps to clarify the issue for me. spir: Quite the opposite, in python "symbolic assignment" (where the right side also is a symbol) never copies, in fact never creates a new v

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread Mark Lawrence
On 27/01/2014 09:53, spir wrote: On 01/27/2014 07:16 AM, Denis Heidtmann wrote: Running python 2.7 in linux Below are two extremes. Can I get some guidance on this? Thanks, -Denis H a=zeros((2,3),dtype=int) b=a a[:,0]=[1,2] a array([[1, 0, 0], [2, 0, 0]]) b array([[1, 0, 0],

Re: [Tutor] Multi Layered Graphs

2014-01-27 Thread spir
On 01/26/2014 11:23 PM, Ankit Arora wrote: I'm working on a project which involves network graphs. Is there a library that can help me do this: I want to create multi-layered graphs i.e. graphs which contain a set number of vertices but multiple 'layers' of edges i.e. same set of vertices repres

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread Peter Otten
Denis Heidtmann wrote: > Running python 2.7 in linux > > Below are two extremes. Can I get some guidance on this? a=zeros((2,3),dtype=int) b=a a[:,0]=[1,2] a > array([[1, 0, 0], >[2, 0, 0]]) b > array([[1, 0, 0], >[2, 0, 0]]) a=2 a > 2 b >

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread spir
On 01/27/2014 07:16 AM, Denis Heidtmann wrote: Running python 2.7 in linux Below are two extremes. Can I get some guidance on this? Thanks, -Denis H a=zeros((2,3),dtype=int) b=a a[:,0]=[1,2] a array([[1, 0, 0], [2, 0, 0]]) b array([[1, 0, 0], [2, 0, 0]]) a=2 a 2 b arra

Re: [Tutor] When is = a copy and when is it an alias

2014-01-27 Thread Steven D'Aprano
Hi Denis, and welcome! On Sun, Jan 26, 2014 at 10:16:25PM -0800, Denis Heidtmann wrote: > Running python 2.7 in linux > > Below are two extremes. Can I get some guidance on this? In Python, = is ALWAYS an alias, never a copy, unless you explicitly do something to make a copy. For example, wit

Re: [Tutor] Python tutoring

2014-01-27 Thread Steven D'Aprano
On Sun, Jan 26, 2014 at 10:44:56PM -0500, marcus douglas wrote: > Hello, my name is Marcus Douglas and I'm a student at College of > Central Florida, I'm contacting you because this is my first year > programming and I'm seriously seeking some HELP...ASAP... Hello Marcus, and welcome! We hope

[Tutor] When is = a copy and when is it an alias

2014-01-27 Thread Denis Heidtmann
Running python 2.7 in linux Below are two extremes. Can I get some guidance on this? Thanks, -Denis H >>> a=zeros((2,3),dtype=int) >>> b=a >>> a[:,0]=[1,2] >>> a array([[1, 0, 0], [2, 0, 0]]) >>> b array([[1, 0, 0], [2, 0, 0]]) >>> a=2 >>> a 2 >>> b array([[1, 0, 0], [2, 0,

[Tutor] Python tutoring

2014-01-27 Thread marcus douglas
Hello, my name is Marcus Douglas and I'm a student at College of Central Florida, I'm contacting you because this is my first year programming and I'm seriously seeking some HELP...ASAP...ThanksMarcus Douglas __