Re: [Tutor] any cons to using a module of functions?

2012-02-03 Thread Peter Otten
Che M wrote: > > I have a bunch of functions that do various utility-type tasks in an > application (such as prettifying date strings, etc.), and they are used in > many modules. Much of the time, I have just been lazily copying and > pasting the functions into whichever modules need them. I re

Re: [Tutor] any cons to using a module of functions?

2012-02-03 Thread Alan Gauld
On 03/02/12 05:05, Che M wrote: is very bad form and I should refactor, and so I am beginning to put these functions in their own module so that I can import the module and its functions when I need it; they will all be in one place and only only place. While that's tempting it is better if yo

[Tutor] Issue with a shapefile (ArcGIS) library (pyshp) "unpack requires a string argument of length 8"

2012-02-03 Thread Simeon Tesfaye
Hello everyone, I am having a bit of trouble here with my code, which uses a shapefile library, named pyshp, to import, edit, and save GIS files within Python. So, I open up my shapefile (data is polylines, meaning, not points or polygons) "shapefile=shapefile.Reader("file.shp") shps=shapefile.s

Re: [Tutor] Issue with a shapefile (ArcGIS) library (pyshp) "unpack requires a string argument of length 8"

2012-02-03 Thread Nate Lastname
On Fri, Feb 3, 2012 at 10:46 AM, Simeon Tesfaye < simeon.tesf...@eaudeparis.fr> wrote: > Hello everyone, > > I am having a bit of trouble here with my code, which uses a shapefile > library, named pyshp, to import, edit, and save GIS files within Python. > So, I open up my shapefile (data is poly

Re: [Tutor] Issue with a shapefile (ArcGIS) library (pyshp) "unpack requires a string argument of length 8"

2012-02-03 Thread Dave Angel
On 02/03/2012 10:46 AM, Simeon Tesfaye wrote: Hello everyone, Two thoughts, but realize I don't know anything about pyshp. I am having a bit of trouble here with my code, which uses a shapefile library, named pyshp, to import, edit, and save GIS files within Python. So, I open up my shapefile

[Tutor] (no subject)

2012-02-03 Thread Debashish Saha
what is the basic difference between numpy and pylab? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Comparing numpy and pylab

2012-02-03 Thread Peter Otten
Debashish Saha wrote: Welcome! > what is the basic difference between numpy and pylab? You can find out yourself. Start Python's interactive interpreter and type help("pylab"): >>> help("pylab") ... This is a procedural interface to the matplotlib object-oriented plotting library.

Re: [Tutor] (no subject)

2012-02-03 Thread Blockheads Oi Oi
On 03/02/2012 20:32, Debashish Saha wrote: what is the basic difference between numpy and pylab? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor http://catb.org/es

[Tutor] __getattribute__

2012-02-03 Thread Stayvoid
Hi! Could you provide some examples (easy and hard ones) and comments on the topic? I'm trying to understand how this thing works. Cheers. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mai

Re: [Tutor] __getattribute__

2012-02-03 Thread Alan Gauld
On 04/02/12 00:30, Stayvoid wrote: Could you provide some examples (easy and hard ones) and comments on the topic? I'm trying to understand how this thing works. Commenting on the topic... It's not one most beginners(*) should be worrying about you rarely need to use it. But its slightly easi

Re: [Tutor] __getattribute__

2012-02-03 Thread Steven D'Aprano
Stayvoid wrote: Hi! Could you provide some examples (easy and hard ones) and comments on the topic? I'm trying to understand how this thing works. When you do an attribute lookup on an object, say obj.attr, Python uses something like a search path to find the attribute: it tries various thing

Re: [Tutor] __getattribute__

2012-02-03 Thread Steven D'Aprano
Alan Gauld wrote: On 04/02/12 00:30, Stayvoid wrote: Could you provide some examples (easy and hard ones) and comments on the topic? I'm trying to understand how this thing works. Commenting on the topic... It's not one most beginners(*) should be worrying about you rarely need to use it. B

[Tutor] Importing libraries

2012-02-03 Thread Michael Lewis
Why don't I have to import str or list to access their attributes like I do with the math or random or any other library? -- Michael J. Lewis mjole...@gmail.com 415.815.7257 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

[Tutor] SEE THE QUESTION AT THE BOTTOM

2012-02-03 Thread Debashish Saha
INPUT: *for n in range(2, 1000):* *for x in range(2, n):* *if n % x == 0:* *print n, 'equals', x, '*', n/x* *break* *else:* *# loop fell through without finding a factor* *print n, 'is a prime number'* OUTPUT: 2 is a prime number

Re: [Tutor] SEE THE QUESTION AT THE BOTTOM

2012-02-03 Thread Steve Willoughby
On 03-Feb-12 21:38, Debashish Saha wrote: BUT I COULD NOT UNDERSTAND HOW THE COMMAND ELSE CAN WORK,THOUGH IT IS IN THE OUTSIDE OF THE FOR LOOP IN WHICH IF COMMAND LIES. The part that's confusing you is that it is not outside the for loop. It is PART of the for loop syntax. The loop construct