Re: [Tutor] urllib confusion

2014-11-23 Thread Cameron Simpson
On 21Nov2014 15:57, Clayton Kirkwood wrote: Got a general problem with url work. I’ve struggled through a lot of code which uses urllib.[parse,request]* and urllib2. First q: I read someplace in urllib documentation which makes it sound like either urllib or urllib2 modules are being deprecated

Re: [Tutor] multiprocessing question

2014-11-23 Thread Cameron Simpson
On 23Nov2014 22:30, Albert-Jan Roskam wrote: I created some code to get records from a potentially giant .csv file. This implements a __getitem__ method that gets records from a memory-mapped csv file. In order for this to work, I need to build a lookup table that maps line numbers to line st

Re: [Tutor] yes, I am being lazy...

2014-11-23 Thread Clayton Kirkwood
>-Original Message- >From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On >Behalf Of Steven D'Aprano >Sent: Sunday, November 23, 2014 4:16 PM >To: tutor@python.org >Subject: Re: [Tutor] yes, I am being lazy... > >On Sun, Nov 23, 2014 at 03:37:12PM -0800, Clayton Kirkwood wr

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Cameron Simpson
On 23Nov2014 10:15, Mitch Raful wrote: Thanks for the replies. No worries. My concern was as the for loop keeps sending objects into the do_something() function which uses the same reference name other_object and that the previously instantiated other_objected would be mutated if the functio

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Danny Yoo
On Nov 23, 2014 8:48 AM, "Mitch Raful" wrote: > > Thanks for the replies. My concern was as the for loop keeps sending objects into the do_something() function which uses the same reference name other_object and that the previously instantiated other_objected would be mutated if the function was

Re: [Tutor] yes, I am being lazy...

2014-11-23 Thread Steven D'Aprano
On Sun, Nov 23, 2014 at 03:37:12PM -0800, Clayton Kirkwood wrote: [...] > >Installed c:\python33\lib\site-packages\requests-2.4.3-py3.3.egg > >Processing dependencies for requests==2.4.3 Finished processing > >dependencies for requests==2.4.3 > >- > >Could you paste what your output

Re: [Tutor] yes, I am being lazy...

2014-11-23 Thread Clayton Kirkwood
>-Original Message- >From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On >Behalf Of Walter Prins >Sent: Sunday, November 23, 2014 2:25 PM >Cc: python mail list >Subject: Re: [Tutor] yes, I am being lazy... > >Hi, > >On 23 November 2014 at 20:50, Clayton Kirkwood >wrote: >

[Tutor] multiprocessing question

2014-11-23 Thread Albert-Jan Roskam
Hi I created some code to get records from a potentially giant .csv file. This implements a __getitem__ method that gets records from a memory-mapped csv file. In order for this to work, I need to build a lookup table that maps line numbers to line starts/ends. This works, BUT building the lo

Re: [Tutor] yes, I am being lazy...

2014-11-23 Thread Walter Prins
Hi, On 23 November 2014 at 20:50, Clayton Kirkwood wrote: > >From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > >Behalf Of Steven D'Aprano > >That's because it's not right. > > > >You're supposed to run setup.py. From the Windows command line, you run > >something like: > > > >

Re: [Tutor] yes, I am being lazy...

2014-11-23 Thread Clayton Kirkwood
>-Original Message- >From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On >Behalf Of Steven D'Aprano >Sent: Sunday, November 23, 2014 4:32 AM >To: tutor@python.org >Subject: Re: [Tutor] yes, I am being lazy... > >On Sat, Nov 22, 2014 at 08:28:42PM -0800, Clayton Kirkwood wr

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Mitch Raful
On Sun, Nov 23, 2014 at 11:07 AM, Dave Angel wrote: > Please don't top-post. Trim the quoted portion to the parts you're > responding to, and put your response immediately after (each) section you're > commenting on. > I this the correct formatting and in plain text? > Also, you're posting in

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Dave Angel
On 11/23/2014 01:05 PM, Mitch Raful wrote: On Sun, Nov 23, 2014 at 11:07 AM, Dave Angel wrote: Please don't top-post. Trim the quoted portion to the parts you're responding to, and put your response immediately after (each) section you're commenting on. I this the correct formatting and i

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Mitch Raful
Thanks for the replies. My concern was as the for loop keeps sending objects into the do_something() function which uses the same reference name other_object and that the previously instantiated other_objected would be mutated if the function wasn't finished. Or do all languages keep each call t

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Dave Angel
Please don't top-post. Trim the quoted portion to the parts you're responding to, and put your response immediately after (each) section you're commenting on. Also, you're posting in html. That's not always a problem, but it often is, depending on the vagaries of your email program. Just te

Re: [Tutor] Michael Dawson Chapter 6 Challenge 4

2014-11-23 Thread Dave Angel
On 11/23/2014 07:04 AM, John Feleppa wrote: Dear all, Has anyone solved the fourth challenge in Chapter 6 of Michael Dawson's book, 'Python Programming for the absolute beginner'? The challenge: 'Write a new *computer_move()* function for the Tic-Tac-Toe game to plug the hole in the computer's

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Dave Angel
On 11/22/2014 09:28 PM, Mitch Raful wrote: If I have code similar to this: for object in objects: do_something(object) def do_something(obj): other_object = Class( obj.property) other_object.method( arg1, arg2) do_stuff here with other_object if problem: p

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Alan Gauld
On 23/11/14 02:28, Mitch Raful wrote: If I have code similar to this: for object in objects: do_something(object) def do_something(obj): other_object = Class( obj.property) other_object.method( arg1, arg2) do_stuff here with other_object if problem: print(

Re: [Tutor] yes, I am being lazy...

2014-11-23 Thread Steven D'Aprano
On Sat, Nov 22, 2014 at 08:28:42PM -0800, Clayton Kirkwood wrote: > I have had my first experience in downloading and trying to lay-in several > new modules. I downloaded requests and urllib3, unpacked them (on a windows > system) and extracted them from the zip. I don't understand how setup.py >

[Tutor] Michael Dawson Chapter 6 Challenge 4

2014-11-23 Thread John Feleppa
Dear all, Has anyone solved the fourth challenge in Chapter 6 of Michael Dawson's book, 'Python Programming for the absolute beginner'? The challenge: 'Write a new *computer_move()* function for the Tic-Tac-Toe game to plug the hole in the computer's strategy. See if you can create an opponent t

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Steven D'Aprano
On Sat, Nov 22, 2014 at 09:28:35PM -0500, Mitch Raful wrote: > If I have code similar to this: > > for object in objects: > do_something(object) > > def do_something(obj): > other_object = Class( obj.property) > other_object.method( arg1, arg2) > > do_stuff here with other_obje

[Tutor] How python keeps track of objects

2014-11-23 Thread Mitch Raful
If I have code similar to this: for object in objects: do_something(object) def do_something(obj): other_object = Class( obj.property) other_object.method( arg1, arg2) do_stuff here with other_object if problem: print( obj.property ) My concern is that the for l