Re: [Tutor] Python books

2012-11-10 Thread Lowell Tackett
The Head First... series of books (O'Reilly Press) adopts a wonderful, 
intuitive work-along format; of particular interest [to you] would be Head 
First Python by Paul Barry.



From the virtual desk of Lowell Tackett  

 


 From: Ed Owens eowens0...@gmx.com
To: tutor@python.org 
Sent: Friday, November 9, 2012 8:18 PM
Subject: [Tutor] Python books
  
I've been trying to learn Python, writing a Blackjack program. Seems that's a 
common problem for learning.  I'm not in a class or school, just working on my 
own.  I've been working in Python 2.7, and considering moving up to 3.x.  My 
programming background is ancient, having done most of my programming in 
FORTRAN. I have been using free internet resources to learn, mostly Google 
searches on syntax, and their free courses.

I have the basic game done: dealing from a shoe of multiple decks, splits, 
betting, etc.  and started to work on the harder parts such as graphics of the 
table with cards, managing record keeping, and so on.  There seem to be a 
plethora of packages and options, many of them outside of the standard Python 
installation.  Plus, I'm still discovering how to do things with the standard 
library.  I need more structure and organization!

I have one book, Python Programming for the Absolute Beginner by Dawson, 
which is too plodding. Can you experts recommend a Python library?  I would 
like to have:

A command reference for the basic library.
A comprehensive How to course for the basic library.
Graphics in Python
Data Management in Python
Using the internet with Python
(maybe Real Time(ish) Python)
A comprehensive Learn Python course that puts all this together

I realize that this is outside of the help with this code request, but I 
would value your advice.

Ed O


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Ongoing problems with Pam's new computer

2012-02-09 Thread Lowell Tackett
Doggonit!  I was half-way thru a really cool Python solution, too!


From the virtual desk of Lowell Tackett  

 


 From: bob gailer bgai...@gmail.com
To: tutor@python.org 
Sent: Thursday, February 9, 2012 7:48 PM
Subject: Re: [Tutor] Ongoing problems with Pam's new computer
  
On 2/9/2012 6:56 PM, Steven D'Aprano wrote:
 bob gailer wrote:
 Today is the third time Pam (connecting to the web site for event 
 publication) has run into an inexplicable Access error.
 
 
 I don't think this has anything to do with learning Python.
 
 
You are right. I was surprised to discover I had entered the wrong email 
address. Sorry for any confusion or pollution.

-- Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with understanding classes

2011-05-22 Thread Lowell Tackett
Robert...I am similarly where you are stuck, a beginner with little insight, so 
my perspective might have some draw to it.  Try this on for size - while 
watching a friend stencil Christmas decorations on living room windows last 
year, it dawned on me that a class is quite simply - a stencil.

While using a Santa Claus stencil, I watched my friend employ different 
features in different places; a Santa Claus here, some reindeer there, a few 
pine bows in another spot, and each with different colored spray paint...and 
the light bulb came on.  Each different thing she stenciled was an instance 
of the class (stencil) Santa Claus.

For me, that was the magic moment.  Very unprofessional, I'm sure, but, hey, so 
what?!

From the virtual desk of Lowell Tackett  


--- On Sat, 5/21/11, Robert Sjöblom robert.sjob...@gmail.com wrote:


From: Robert Sjöblom robert.sjob...@gmail.com
Subject: [Tutor] Help with understanding classes
To: tutor@python.org tutor@python.org
Date: Saturday, May 21, 2011, 6:24 AM


I'm trying to wrap my head around classes and their attributes, but am having a 
hard time doing so. The websites and books that I have consulted haven't been 
much help; most of them assume prior programming/oop experience, something I 
lack. 

From what I understand it's a blueprint, so each time you instantiate it you 
run whatever's in the __self__ part is assigned to the instance. What I'm 
wondering is how to access and change attributes in the instance (whatever it 
might be; a list, a specific value, a string...).

I just can't seem to grasp the concept or syntax very well, and none of the 
sources I've found go to great lengths explaining them to someone as 
thick-headed as me. So if anyone could take the time to explain, or point me to 
sources to read, I'd be grateful

Thanks in advance, and best regards,
Robert S. 
Sent from my iPhone
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] has it gone quiet or is it just me?

2010-07-21 Thread Lowell Tackett
You folks are just so good at what you do here that you've answered everybody's 
questions.  Everyone's happy right now.
From the virtual desk of Lowell Tackett  



--- On Wed, 7/21/10, Alan Gauld alan.ga...@btinternet.com wrote:

 From: Alan Gauld alan.ga...@btinternet.com
 Subject: [Tutor] has it gone quiet or is it just me?
 To: tutor@python.org
 Date: Wednesday, July 21, 2010, 1:55 PM
 I haven't had any tutor messages in 2
 days.
 Do I have a problem or are things just very quiet
 suddenly?
 The archive isn't showing anything either which makes me
 suspicious.
 
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor
 


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] pydoc?

2010-06-18 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  


--- On Fri, 6/18/10, Andrew Martin amartin7...@gmail.com wrote:

From: Andrew Martin amartin7...@gmail.com
Subject: [Tutor] pydoc?
To: tutor@python.org
Date: Friday, June 18, 2010, 1:53 PM

Hey, everyone, I am new to programming and just downloaded Python 2.6 
onto my windows vista laptop. I am attempting to follow 4.11 of the 
tutorial called How
 to Think Like a Computer Scientist: Learning with Python v2nd Edition 
documentation (http://openbookproject.net/thinkcs/python/english2e/ch04.html).
 However, I am having some trouble. I am trying to use pydoc to search through 
the python libraries installed on my computer but keep getting an error 
involving the $ symbol. 

$ pydoc -g
SyntaxError: invalid syntax



Can anyone help me out?

Thanks

You're getting awfully close.  Again, assuming that you are in python; at the 
prompt type:

 pydoc modules

which will list all the module names, but...it's more than one screen and you 
can't go backwards, so you lose the first half.  So, type (instead):

 pydoc modules  made-upfilename

and you will create an ascii file (with the name you gave it) containing all 
the pydoc names in it.  The easiest way to open that file is:

 less made-upfilename

less is a bash command that opens files for reading.  As you'll see, it will 
allow you to scroll forward in the file (space bar) or backwards, with the b 
key.  To close that file, just type a q for quit.  And while your at it, 
while at bash's ($) the command line, type in man less w/o the quotes (that 
stands for manual for 'less'), and begin learning how the bash commands work, 
and how you can access great info as to how they work.

Good luck.



  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help

2010-06-17 Thread Lowell Tackett


From the virtual desk of Lowell Tackett  


--- On Thu, 6/17/10, Mark Lawrence breamore...@yahoo.co.uk wrote:

From: Mark Lawrence breamore...@yahoo.co.uk
Subject: Re: [Tutor] help
To: tutor@python.org
Date: Thursday, June 17, 2010, 8:30 AM

On 17/06/2010 08:28, KB SU wrote:
 help




 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor

Help, I need somebody,
Help, not just anybody,
Help, you know I need someone, help.

I'll leave you to find out the rests of the lyrics. :)

Mark Lawrence.

You're dating yourself!  (I was in 'Nam when that song came out.)

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] the binary math wall

2010-04-25 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Tue, 4/20/10, Steven D'Aprano st...@pearwood.info wrote:

 From: Steven D'Aprano st...@pearwood.info
 Subject: Re: [Tutor] the binary math wall
 To: tutor@python.org
 Date: Tuesday, April 20, 2010, 7:39 PM
 On Wed, 21 Apr 2010 02:58:06 am
 Lowell Tackett wrote:
  I'm running headlong into the dilemma of binary math
 representation, 
 with game-ending consequences, e.g.:
   0.15

 But if you really need D.MMSS floats, then something like
 this should be 
 a good start.:
 
 def dms2deg(f):
 Convert a floating point number formatted
 as D.MMSS 
 into degrees.
 
 mmss, d = math.modf(f)
 assert d == int(f)
 if mmss = 0.60:
 raise ValueError(
 'bad fractional part, expected
  .60 but got %f' % mmss)
 mmss *= 100
 m = round(mmss)
 if m = 60:
 raise ValueError('bad minutes,
 expected  60 but got %d' % m)
 s = round((mmss - m)*100, 8)
 if not 0 = s  60.0:
 raise ValueError('bad seconds,
 expected  60.0 but got %f' % s)
 return d + m/60.0 + s/3600.0
 
 
  dms2deg(18.15)
 18.25
  dms2deg(18.1515)
 18.2541666
 
 

Haven't gone away...I'm having a blast dissecting (parsing[?]-is that the right 
word?) your script snippet!  Got a big pot of coffee fueling the effort.

 
 Note though that this still fails with some valid input. I
 will leave 
 fixing it as an exercise (or I might work on it later, time
 
 permitting).

Got the hint...I'm gonna pick up this challenge.  This effort is taking me in 
endless tangents (all productive)-I'll be back sometime [soon] with my efforts 
and results.  Thanks for your [own] time and effort.

 
 
 -- 
 Steven D'Aprano
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor
 


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] the binary math wall

2010-04-21 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Wed, 4/21/10, Dave Angel da...@ieee.org wrote:

 From: Dave Angel da...@ieee.org
 Subject: Re: [Tutor] the binary math wall
 To: Lowell Tackett lowelltack...@yahoo.com
 Cc: tutor@python.org, Steven D'Aprano st...@pearwood.info
 Date: Wednesday, April 21, 2010, 6:46 AM
 
 
 Lowell Tackett wrote:
  --- On Tue, 4/20/10, Steven D'Aprano st...@pearwood.info
 wrote:
  

  From: Steven D'Aprano st...@pearwood.info
  snip
  
  The simplest, roughest way...hit them with a
  hammer:
  
  round(18.15*100) == 1815


  True
  
  
  ...when I tried...:
  
  Python 2.5.1 (r251:54863, Oct 14 2007, 12:51:35)
  [GCC 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)] on linux2
  Type help, copyright, credits or license for
 more information.

  round(18.15)*100 == 1815
  
  False

  snip
 But you typed it differently than Steven.  He
 had   round(18.15*100), and you used
 round(18.15)*100

As soon as I'd posted my answer I realized this mistake.

 
 Very different.   His point boils down to
 comparing integers, and when you have dubious values, round
 them to an integer before comparing.  I have my doubts,
 since in this case it would lead to bigger sloppiness than
 necessary.
 
 round(18.154 *100) == 1815
 
 probably isn't what you'd want.
 
 So let me ask again, are all angles a whole number of
 seconds?  Or can you make some assumption about how
 accurate they need to be when first input (like tenths of a
 second, or whatever)?  If so use an integer as
 follows:
 
 val =  rounddegrees*60)+minutes)*60) +
 seconds)*10)
 
 The 10 above is assuming that tenths of a second are your
 quantization.
 
 HTH
 DaveA
 
 

Recalling (from a brief foray into college Chem.) that a result could not be 
displayed with precision greater than the least precise component that bore 
[the result].  So, yes, I could accept my input as the arbitrator of accuracy.

A scenario:

Calculating the coordinates of a forward station from a given base station 
would require [perhaps] the bearing (an angle from north, say) and distance 
from hither to there.  Calculating the north coordinate would set up this 
relationship, e.g.:

cos(3° 22' 49.6) x 415.9207'(Hyp) = adjacent side(North)

My first requirement, and this is the struggle I (we) are now engaged in, is to 
convert my bearing angle (3° 22' 49.6) to decimal degrees, such that I can 
assign its' proper cosine value.  Now, I am multiplying these two very refined 
values (yes, the distance really is honed down to 10,000'ths of a foot-that's 
normal in surveying data); within the bowels of the computer's blackboard 
scratch-pad, I cannot allow errors to evolve and emerge.

Were I to accumulate many of these legs into perhaps a 15 mile 
traverse-accumulating little computer errors along the way-the end result could 
be catastrophically wrong.

(Recall that in the great India Survey in the 1800's, Waugh got the elevation 
of Mt. Everest wrong by almost 30' feet for just this exact same reason.)  In 
surveying, we have a saying, Measure with a micrometer, mark with chalk, cut 
with an axe.  Accuracy [in math] is a sacred tenet.

So, I am setting my self very high standards of accuracy, simply because those 
are the standards imposed by the project I am adapting, and I can require 
nothing less of my finished project.


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] the binary math wall

2010-04-21 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Wed, 4/21/10, Dave Angel da...@ieee.org wrote:

 From: Dave Angel da...@ieee.org
 Subject: Re: [Tutor] the binary math wall
 To: Lowell Tackett lowelltack...@yahoo.com
 Cc: tutor@python.org, Steven D'Aprano st...@pearwood.info
 Date: Wednesday, April 21, 2010, 12:31 PM
 Lowell Tackett wrote:
  From the virtual desk of Lowell Tackett  
  
  
*Whole buncha stuff snipped*
 
 Anyway, in your case binary floating point is
 irrelevant.  You've got to do your own error analysis
 of every step in the calculation to understand how much you
 can trust the result.  And it's unlikely the errors
 in the math package will be the limiting factor.
 
 DaveA
 
 

The sense of all this is beginning to emerge (perhaps).  Emile has just made a 
good point, simply convert all to whole values (using a subset algorithm that 
keeps track of the number of decimal slips that have accumulated-for later 
reconversion), crunch merrily away, and get good results.

Maybe that's valid, maybe not.  But I do know that this much is happening; I'm 
now beginning to quantify very novel and wide ranging ideas way outside the 
box I'd originally approached the challenge with.  That's the bigger value of 
this entire exercise, I think.  Naively thinking that the computer was benign 
and forgiving, I'd first opted for the most transparent and 'at hand' 
solutions...there was much to be learned.

I know a coupla things now...I'm gonna solve this dilemma, and largely with the 
help of all who've weighed in.   The solution may ultimately not be close to 
what has been suggested, but isn't that the fun of it all?

Secondly, there has accumulated [here] quite an array of novel (to me) thinking 
that I'm going to return to more and more as I tackle other, different 
projects, for the pedagogical value that will linger.


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] the binary math wall

2010-04-20 Thread Lowell Tackett
I'm running headlong into the dilemma of binary math representation, with 
game-ending consequences, e.g.:

 0.15
0.14999

Obviously, any attempts to manipulate this value, under the misguided 
assumption that it is truly 0.15 are ill-advised, with inevitable bad results.

the particular problem I'm attempting to corral is thus:

 math.modf(18.15)
(0.14858, 18.0)

with some intermediate scrunching, the above snippet morphs to:

 (math.modf(math.modf(18.15)[0]*100)[0])/.6
1.4298

The last line should be zero, and needs to be for me to continue this algorithm.

Any of Python's help-aids that I apply to sort things out, such as formatting 
(%), or modules like decimal do nothing more than powder up the display for 
visual consumption (turning it into a string).  The underlying float value 
remains corrupted, and any attempt to continue with the math adapts and 
re-incorporates the corruption.

What I'm shooting for, by the way, is an algorithm that converts a deg/min/sec 
formatted number to decimal degrees.  It [mostly] worked, until I stumbled upon 
the peculiar cases of 15 minutes and/or 45 minutes, which exposed the flaw.

What to do?  I dunno.  I'm throwing up my hands, and appealing to the Council.

(As an [unconnected] aside, I have submitted this query as best I know how, 
using plain text and the tu...@... address.  There is something that either 
I, or my yahoo.com mailer *or both* doesn't quite get about these mailings.  
But, I simply do my best, following advice I've been offered via this forum.  
Hope this --mostly-- works.)

From the virtual desk of Lowell Tackett  



  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] the binary math wall

2010-04-20 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Tue, 4/20/10, Luke Paireepinart rabidpoob...@gmail.com wrote:

 From: Luke Paireepinart rabidpoob...@gmail.com
 Subject: Re: [Tutor] the binary math wall
 To: Lowell Tackett lowelltack...@yahoo.com
 Cc: tutor Tutor@python.org
 Date: Tuesday, April 20, 2010, 1:20 PM
 On Tue, Apr 20, 2010 at 11:58 AM,
 Lowell Tackett
 lowelltack...@yahoo.com
 wrote:
  I'm running headlong into the dilemma of binary math
 representation, with game-ending consequences, e.g.:
 
  0.15
  0.14999
 
 
 Yes, floats are slightly inaccurate.
 
 But I think your problem is that your math is wrong.
 You are assuming...
 If your equations cannot handle this, then coerce the value
 to 1.
 if .999  i  1.1:
 i = 1
 
 And before you say but that is just a hack, no, that is
 the nature...
 But you really just need to adapt...
 
 May I suggest another approach though?
 
 Consider this:
  a = 18.15
  a
 18.149
  a = '18.15'
  degree, min = map(int, a.split('.'))
  degree
 18
  min
 15
 
 Supposing you get your input as a string.
 Basically the second you let your value end up stored as a
 float,
 there's no turning back...
 
 Eventually you will develop a distrust for floats...
 
 Hope that helps,
 -Luke
 

I was gonna go out jogging - and in a coupla hours check to see if anyone had 
tried to take this on; going out the door I decided to take a quick look.  
Ahem...

These responses just blow me away on a couple of levels.  I'm choosing 
Luke's offering as representative.  Within minutes some great folks had 
read, parsed, and re-structured my query.  My narrow focus yells out my 
inexperience...I was trying as hard as I could, with limited tools, to solve 
the issue.  That's fine.  But...the breadth and depth of the responses 
represent nothing short of a paradigm shift in my window into this world of 
hacking.

Ya'll have insights of a scale unimagined in the confines of my thinking box. 
 (Now, I gotta go out and jog just to clear my head!)  Then come back...and 
pull the blinds closed...and absorb; and come up for air in maybe a week or so. 
 And only then, be able to offer my thanks with an objective sense of how much 
I've been helped today...Wow!


  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] the binary math wall

2010-04-20 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Tue, 4/20/10, Steven D'Aprano st...@pearwood.info wrote:

 From: Steven D'Aprano st...@pearwood.info
 Subject: Re: [Tutor] the binary math wall
 To: tutor@python.org
 Date: Tuesday, April 20, 2010, 7:39 PM
 On Wed, 21 Apr 2010 02:58:06 am
 Lowell Tackett wrote:
  I'm running headlong into the dilemma of binary math
 representation, 
 with game-ending consequences, e.g.:
   0.15
 
  0.14999
 
  Obviously, any attempts to manipulate this value,
 under the misguided
  assumption that it is truly 0.15 are ill-advised,
 with inevitable
  bad results.
 
 That really depends on what sort of manipulation you are
 doing.
 
  x = 0.15
  x
 0.14999
  x*100 == 15
 True
 
 Seems pretty accurate to me.
 
 However:
 
  18.15*100 == 1815
 False
 
 
 The simplest, roughest way to fix these sorts of problems
 (at the risk 
 of creating *other* problems!) is to hit them with a
 hammer:
 
  round(18.15*100) == 1815
 True

Interestingly, this is the [above] result when I tried entered the same snippet:

Python 2.5.1 (r251:54863, Oct 14 2007, 12:51:35)
[GCC 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)] on linux2
Type help, copyright, credits or license for more information.
 round(18.15)*100 == 1815
False


But...I'm just offering that for its' curiosity value, not to contradict your 
comments or the case you are making.
 
 [...]
  What I'm shooting...is an algorithm
 that converts a
  deg/min/sec formatted number to decimal degrees. 
 It [mostly] worked...which exposed the flaw.
 
 I'm afraid that due to the nature of floating point, this
 is a hard 
 problem. Even the professionals at Hewlett-Packard's
 scientific 
 calculator division don't always get it right, and they are
 *extremely* 
 careful:
 
 http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=132690
 

Interesting that you raise the *hallowed* 48GX as a standard.  I have one (of 
the two I own) sitting next to me here, and have been using it as the bar 
against which to compare my computer.  Using the HMS+/-/- etc. functions, I 
get pretty darned accurate results.  (Wish I'd known in time that HP was gonna 
throw the 48's down the drain-I would own a lot more than two of them!)

 The best result I can suggest is, change the problem! Don't
 pass 
 degrees-minutes-seconds around using a floating point
 value, but as a 
 tuple with distinct (DEG, MIN, SEC) integer values. Or
 create a custom 
 class.
 
 But if you really need D.MMSS floats, then something like
 this should be 
 a good start.:
 
 def dms2deg(f):
 Convert a floating point number formatted
 as D.MMSS 
 into degrees.
 
 mmss, d = math.modf(f)
 assert d == int(f)
 if mmss = 0.60:
 raise ValueError(
 'bad fractional part, expected
  .60 but got %f' % mmss)
 mmss *= 100
 m = round(mmss)
 if m = 60:
 raise ValueError('bad minutes,
 expected  60 but got %d' % m)
 s = round((mmss - m)*100, 8)
 if not 0 = s  60.0:
 raise ValueError('bad seconds,
 expected  60.0 but got %f' % s)
 return d + m/60.0 + s/3600.0
 
 
  dms2deg(18.15)
 18.25
  dms2deg(18.1515)
 18.2541666
 
 
 which compares well to my HP-48GX:
 
 18.15 HMS-
 
 gives 18.25, and:
 
 18.1515 HMS-
 
 gives 18.254167.
 
 
 Note though that this still fails with some valid input. I
 will leave 
 fixing it as an exercise (or I might work on it later, time
 
 permitting).
 
 
 -- 
 Steven D'Aprano
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor
 

What you've provided with your comments is more of what I've received wholesale 
in this entire discourse--an incredible wealth of new insight and ways of 
looking at the problem.  Don't think you grasp how new I am at this, and how 
even what little I've tried to pull off-on my own-is way out at the edge of 
the box for me.  Someone wondered if performance was an issue that could 
effect my choices.  Well, no.  Basically, I want to manipulate [land] survey 
data - you know, coordinates and stuff - so the goal here is coding those 
things that will yield accurate number results.

I've been handed, in response, comments about the challenges going all the way 
back to the early days of Fortran, stuff I had no concept of.  This is all 
fantastic, and it's gonna take a long time for me to assimilate and absorb what 
has been offered.  Even your comment concerning creating a class--my reaction 
is Oh, oh--classes?  What'da I do NOW?!  But, I've been given a great deal to 
chew on, and the implications go way beyond the scope of my original query.

Did I get what I asked for when I posed my question?  I'd say so...about 10X!  
Now I gotta go to work and gain some good knowledge out of this mountain of 
advice that's been piled on my desk!

Thanks, all...


  
___
Tutor

Re: [Tutor] python magazine

2010-03-28 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Sat, 3/27/10, Dave Angel da...@ieee.org wrote:

 From: Dave Angel da...@ieee.org
 Subject: Re: [Tutor] python magazine
 To: Lowell Tackett lowelltack...@yahoo.com
 Cc: Benno Lang transmogribe...@gmail.com, tutor@python.org
 Date: Saturday, March 27, 2010, 6:12 AM
 
 
 Lowell Tackett wrote:
  From the virtual desk of Lowell Tackett  
  
  --- On Fri, 3/26/10, Benno Lang transmogribe...@gmail.com
 wrote:
  
  From: Benno Lang transmogribe...@gmail.com
  Subject: Re: [Tutor] python magazine
  To: Lowell Tackett lowelltack...@yahoo.com
  Cc: tutor@python.org,
 Bala subramanian bala.biophys...@gmail.com
  Date: Friday, March 26, 2010, 8:38 PM
  
  On 27 March 2010 00:33, Lowell Tackett lowelltack...@yahoo.com
 wrote:

  The Python Magazine people have now got a Twitter
 site--which includes a perhaps [telling] misspelling.
  
  Obviously that's why they're looking for a chief
 editor - maybe it's
  even a deliberate ploy.
  
  I'm not sure if this affects others, but to me your
 replies appear
  inside the quoted section of your mail, rather than
 beneath it. Would
  you mind writing plain text emails to avoid this
 issue?
  
  Thanks,
  benno
  
  Like this...?
  
  

 No, there's still a problem.  You'll notice in this
 message that there are  symbols in front of your lines
 and benno's, and  symbols in front of
 Lowell's.  (Some email readers will turn the  into
 vertical bar, but the effect is the same).  Your email
 program should be adding those upon a reply, so that your
 own message has one less  than the one to which you're
 replying.  Then everyone reading can see who wrote
 what, based on how many  or bars precede the
 respective lines.  Quotes from older messages have more
 of them.
 
 Are you using Reply-All in your email program?  Or
 are you constructing a new message with copy/paste?
 
 What email are you using?  Maybe it's a configuration
 setting somebody could help with.
 
 DaveA
 
 
Don't really know what I'm doing wrong (or right).  Just using the [email] 
tools that have been made available to me thru Yahoo mail and Firefox.  I began 
this text below your submission and signature, and I'm using plain text, as 
suggested by a previous comment.  Don't know what else I could embellish this 
effort with.


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python magazine

2010-03-26 Thread Lowell Tackett


From the virtual desk of Lowell Tackett  


--- On Fri, 3/26/10, Bala subramanian bala.biophys...@gmail.com wrote:

From: Bala subramanian bala.biophys...@gmail.com
Subject: [Tutor] python magazine
To: tutor@python.org
Date: Friday, March 26, 2010, 8:07 AM

Friends,
I am sorry if this query is not appropriate to this forum.

Is there any online magazine dedicated to python especially its features and 
How-to's that i can subscribe for.

Thanks,
Bala


-Inline Attachment Follows-

http://twitter.com/pymag

The Python Magazine people have now got a Twitter site--which includes a 
perhaps [telling] misspelling.



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python magazine

2010-03-26 Thread Lowell Tackett


From the virtual desk of Lowell Tackett  


--- On Fri, 3/26/10, John jo...@jfcomputer.com wrote:

From: John jo...@jfcomputer.com
Subject: Re: [Tutor] python magazine
To: tutor@python.org
Date: Friday, March 26, 2010, 2:32 PM

On Friday 26 March 2010 08:33:35 am Lowell Tackett wrote:
 From the virtual desk of Lowell Tackett 

 --- On Fri, 3/26/10, Bala subramanian bala.biophys...@gmail.com wrote:

 From: Bala subramanian bala.biophys...@gmail.com
 Subject: [Tutor] python magazine
 To: tutor@python.org
 Date: Friday, March 26, 2010, 8:07 AM

 Friends,
 I am sorry if this query is not appropriate to this forum.

 Is there any online magazine dedicated to python especially its features
 and How-to's that i can subscribe for.

 Thanks,
 Bala


 -Inline Attachment Follows-

 http://twitter.com/pymag

 The Python Magazine people have now got a Twitter site--which includes a
 perhaps [telling] misspelling.

Last updated Jun 2009???
Johnf

Look again...6:32 AM   Mar16th


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python magazine

2010-03-26 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  


--- On Fri, 3/26/10, Benno Lang transmogribe...@gmail.com wrote:

From: Benno Lang transmogribe...@gmail.com
Subject: Re: [Tutor] python magazine
To: Lowell Tackett lowelltack...@yahoo.com
Cc: tutor@python.org, Bala subramanian bala.biophys...@gmail.com
Date: Friday, March 26, 2010, 8:38 PM

On 27 March 2010 00:33, Lowell Tackett lowelltack...@yahoo.com wrote:
 The Python Magazine people have now got a Twitter site--which includes a 
 perhaps [telling] misspelling.
Obviously that's why they're looking for a chief editor - maybe it's
even a deliberate ploy.

I'm not sure if this affects others, but to me your replies appear
inside the quoted section of your mail, rather than beneath it. Would
you mind writing plain text emails to avoid this issue?

Thanks,
benno

Like this...?



  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What Editori?

2010-02-23 Thread Lowell Tackett
The environment [OS} of choice can do a lot to expand/enhance the capabilities 
of an editor.  I fell upon Vim from the beginning, and stayed with it for its' 
rich palate of features and adaptability (and of course, the often...and 
exhilarating oh, Vim can do that!).  But beyond that, the Linux platform I 
work within offers its own dimension.

Generally, I will split a [terminal] screen into two (or even 3) virtual 
screens with bash's 'screen' workhorse, and from there I have in front of me 
[perhaps] a; 1) script edit screen, 2) interactive screen, and 3) 
script-launching screen...all on the same physical monitor.

For me, that combination creates an awfully rich  deep working canvas.   The 
whole...is at least as great as the sum of its' parts.

From the virtual desk of Lowell Tackett  


--- On Tue, 2/23/10, Giorgio anothernetfel...@gmail.com wrote:

From: Giorgio anothernetfel...@gmail.com
Subject: [Tutor] What Editori?
To: tutor@python.org
Date: Tuesday, February 23, 2010, 11:24 AM

Hi All,
what text-editor do you use for python?
I've always used kate/nano on Linux and Notepad++/PSPad on Win. Today i've 
installed portablepython to my pendrive, and found pyscripter in that. It's 
nice!

Do you think it's a good editor? Do you know other names?
Giorgio

-- 
--
AnotherNetFellow
Email: anothernetfel...@gmail.com




-Inline Attachment Follows-

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question on import foobar vs from foobar import *

2010-01-09 Thread Lowell Tackett
If I might offer one small comment...

It seems to me that this argument also goes to a code readability issue; ergo, 
if you choose from foobar... as opposed to import foobar, then from that 
point on you only need employ foobar's methods in your code, and they are not 
alway easily recognizable.  i.e, by importing foobar, you will always prefix a 
method with its' parent module name, which [I think] makes the code more 
understandable.

From the virtual desk of Lowell Tackett  


--- On Sat, 1/9/10, Alan Gauld alan.ga...@btinternet.com wrote:

From: Alan Gauld alan.ga...@btinternet.com
Subject: Re: [Tutor] Question on import foobar vs from foobar import *
To: tutor@python.org
Date: Saturday, January 9, 2010, 10:21 AM


Rob Cherry pythontu...@lxrb.com wrote

 Extending on this advice somewhat - is it *ever* correct to import foobar.

Yes, it is *usually* correct to import foobar and rarely correct to from 
foobar.
The exception being if you only need one or two names from foobar, but
usually you need a lot more, in which case use import foobar.

To save typing you can give foobar a shorter name:

import foobar as fb

For some reason that convenience feature doesn't get mentioned
all that often but I use it a lot.

HTH,


-- Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] manipulting CSV files

2010-01-08 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Fri, 1/8/10, Kent Johnson ken...@tds.net wrote:

 From: Kent Johnson ken...@tds.net
 Subject: Re: [Tutor] manipulting CSV files
 To: Lowell Tackett lowelltack...@yahoo.com
 Cc: tutor Tutor@python.org
 Date: Friday, January 8, 2010, 8:11 AM
 On Thu, Jan 7, 2010 at 1:26 PM,
 Lowell Tackett lowelltack...@yahoo.com
 wrote:
  I found the Python documentation (on line} and came
 across--'csv.Dialect.skipinitialspace' 
 Try
 coord = csv.reader(open('true_coord', 'b'),
 skipinitialspace = True)
 
 Note you should open the file in binary mode.
 
 Kent
 
I'm guessing the 'b' in the above code line refers to your recommendation to 
enlist binary mode.  Here's what Python thought of it:

 coord = csv.reader(open('true_coord', 'b'), skipinitialspace = True)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: mode string must begin with one of 'r', 'w', 'a' or 'U', not 'b'

So, I put an 'r' in front of 'b', and it worked fine.

Now, perhaps you can you shed some light on this problem--I'm trying to do some 
simple arithmetic with two of the retrieved values, and get this error:

 coord = csv.reader(open('true_coord', 'rb'), skipinitialspace = True)
 for line in coord:
  if line[0] == '1001':
   print line

['1001', '342821.71900', '679492.08300', '0.0', '']
   print (int(line[1]) + int(line[2]))

Traceback (most recent call last):
  File stdin, line 3, in module
ValueError: invalid literal for int() with base 10: '342821.71900'

I tried:

   print (line[1]) + (line[2])

But of course it did nothing but cat the two sequences.



  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] manipulting CSV files

2010-01-08 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Fri, 1/8/10, Kent Johnson ken...@tds.net wrote:

 From: Kent Johnson ken...@tds.net
 Subject: Re: [Tutor] manipulting CSV files
 To: Lowell Tackett lowelltack...@yahoo.com
 Cc: tutor Tutor@python.org
 Date: Friday, January 8, 2010, 10:07 AM
 
 Well, it's right - that is not a valid integer. What do you
 want to do
 with it? You could convert it to a number with
 float(line[2]) or get
 just the integer part with int(line[2].split('.')[0]).
 
 Kent

Oh...

I hadn't grasped the subtle meaning of int(); thanks, that helps. So, here's 
the (happy) result:

 coord = csv.reader(open('true_coord', 'rb'), skipinitialspace = True)
 for line in coord:
  if line[0] == '1001':
   print [float(line[1]) + float(line[2])]

[1022313.801999]

Please keep in mind, as I'd mentioned earlier, all of this is fairly new 
concepts to me; from running an interpretive Python screen, to delving into the 
zen of computing, [even] to pasting stuff from there to here--there's about 4 
different Learn Python and Make New Friends books strewn around me and my 
computer desk right now, opened to different subjects (and the Joy of Google 
waiting on the internet) and with all that I want to develop to where I can 
create some pretty expansive scripts dealing with land surveying 
stuff--manipulating coordinates, inversing, traversing, bearings, etc., etc.

Ya'll are meeting me here pretty much on the proverbial First Step of the 
1000-mile journey, so all the help is very welcome and appreciated.  Thanks.

 


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] formatting*

2010-01-08 Thread Lowell Tackett

From the virtual desk of Lowell Tackett  



--- On Fri, 1/8/10, spir denis.s...@free.fr wrote:

 From: spir denis.s...@free.fr
 Subject: Re: [Tutor] formatting*
 To: tutor@python.org
 Date: Friday, January 8, 2010, 7:27 AM
 Lowell Tackett dixit:
 
 Yo, that's because you're viewing the source as plain text,...
 
 Denis
 
 
 la vita e estrany
 

In the meantime, posing this query took me somewhere I hadn't imagined...I got 
turned on to the 'Gmane' mailsite, which pretty much solved all my issues, plus 
presented a much nicer 'reading room'.  After rummaging around awhile I've got 
the site figured out enough to make good use of it (a tip of the hat to Alan 
Gauld for the reference to that great site).


  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] $PYTHONSTARTUP

2010-01-08 Thread Lowell Tackett
I'm not certain if this is more correctly a bash issue, but it seems logical to 
at least start here.  What I hope to do is set some standard commands (whenever 
I open an interactive python shell) as are outlined in the Python.org tutorial:

2.2.4. The Interactive Startup File¶
When you use Python interactively, it is frequently handy to have some standard
commands executed every time the interpreter is started.  You can do this by
setting an environment variable named PYTHONSTARTUP to the name of a
file containing your start-up commands.  This is similar to the .profile
feature of the Unix shells.
Toward this end, I created a file that I called 'mypythonrc' and expanded the 
$PYTHONSTARTUP [bash] environmental file (in my '.bashrc' file) to include 
it--then I [re]sourced my '~/.bashrc' file to include the new entry.  The 
validity of that step shows up here:

 Fri Jan 08:lowell:Coord]:$echo $PYTHONSTARTUP
/etc/pythonrc.py:/home/lowell/bash_function/mypythonrc

The details of the file 'mypythonrc' are here:

    1 #!/usr/bin/python
    2
    3 import csv
    4 import os
    5 filename = os.environ.get('PYTHONSTARTUP')
    6 if filename and os.path.isfile(filename):
    7 execfile(filename)

The results are...well, there are none.  The expectation [is] that whenever I 
open up an interactive Python shell the two modules 'csv' and 'os' will be 
pre-imported, and waiting for my use.  Ain't happenin'.

So, again...is this the right venue for my question, or does it hafta be 
settled over at one of the (I guess if I hafta, I hafta) Linux forums?

From the virtual desk of Lowell Tackett  



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] manipulting CSV files

2010-01-07 Thread Lowell Tackett
Displayed below is an extract from a CSV file that displays some [land 
surveying] coordinates:

1001, 342821.71900, 679492.08300,  0.0,
1002, 342838.55786, 679909.81375,  0.0,
1003, 342965.61860, 679911.34762,  0.0,
1004, 343012.82497, 680338.36624,  0.0,
1005, 342783.08155, 680347.62727,  0.0,
1006, 342623.01979, 679547.20429,  0.0,

I intend to use data such as this along with my Mandrake 10.1 OS and Python 
2.5.1 to create some apps that will manipulate coordinate data as I wish.  
Obviously, one of my first steps is to be able to discriminatingly access and 
use the available file data.  (As a reference point of knowledgeI am 
grasping this effort as a way to introduce myself to programming in general, 
and Python in particular.  Whatever I absorb/display/offer here will be for the 
first time ever, and each step will push my envelop.)

Had originally intended to unpack the data such as:

pt_no, north, east, elev = ('blah, blah')

until I ran across the csv module.  Had accomplished this:

 coord = csv.reader(open('true_coord'))
 for line in coord:
  print line

[' 1001', ' 342821.71900', ' 679492.08300', '  0.0', '   ']
[' 1002', ' 342838.55786', ' 679909.81375', '  0.0', '   ']
[' 1003', ' 342965.61860', ' 679911.34762', '  0.0', '   ']
[' 1004', ' 343012.82497', ' 680338.36624', '  0.0', '   ']
[' 1005', ' 342783.08155', ' 680347.62727', '  0.0', '   ']
[' 1006', ' 342623.01979', ' 679547.20429', '  0.0', '   ']


when I realized that the procedure had included leading white space.  
Attempting to remedy that, I found the Python documentation (on line} and came 
across--'csv.Dialect.skipinitialspace' which I believe is the answer to my 
dilemma.  However, my effort to implement that detail, based on interpreting 
the skimpy examples in the documentation:

 coord = csv.reader(open('true_coord'),csv.Dialect.skipinitialspace = True)

got me roundly shot down with:

  File stdin, line 1
SyntaxError: keyword can't be an expression

My seemingly endless stabs at attempting variations on that code line are going 
nowhere, so I lay my case before the Council of Coders.


From the virtual desk of Lowell Tackett  



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] formatting*

2010-01-07 Thread Lowell Tackett
*No, not in Python...in this Tutor format.  How do I include line breaks in 
text so the lines in the Tutor Archives wrap (as opposed to stretching halfway 
to Idaho)?

From the virtual desk of Lowell Tackett  



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] formatting*

2010-01-07 Thread Lowell Tackett
I'm using Mandrake 10.1 [Linux] OS to view the internet thru Firefox.  In my 
mailbox, everything is fine--my stuff formats well (and when it comes back to 
me as Tutor 'mail' it also formats correctly).

The problem is over at the Tutor Archives (mail.python.org/pipermail/tutor), 
i.e., the Tutor forum site.  That's where whatever I composed formats out with 
no line wrap, and a paragraph becomes a single line, stretching out however far 
it needs to.  In all the time I've been perusing the forum (before jumping in 
to participate) I have seen occasionally a contributor's offering will suffer 
the same fate.  Now my entries are doing so as well.  I don't know if everybody 
who goes to the forum site sees these format problems as I do (apparently 
not--from your response), but there they are on my screen.

Hope I've answered your questions with some degree of understandability.

From the virtual desk of Lowell Tackett  


--- On Thu, 1/7/10, Alan Gauld alan.ga...@btinternet.com wrote:

From: Alan Gauld alan.ga...@btinternet.com
Subject: Re: [Tutor] formatting*
To: tutor@python.org
Date: Thursday, January 7, 2010, 4:59 PM


Lowell Tackett lowelltack...@yahoo.com wrote 
 *No, not in Python...in this Tutor format. How do I include line breaks in 
 text so the lines in the Tutor Archives wrap (as opposed to stretching 
 halfway to Idaho)?

How are you viewing the messages?
I have never seen that problem. Are you using a web browser or a newsreader?
Which OS, which site?


-- Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] formatting*

2010-01-07 Thread Lowell Tackett
Well, not a lot of luck.  What I use is Yahoo mail (whatever that is---a 
thick client??), and thus far I can't find any tool bars that offer help.

An odd aside, however--I went into the Tutor Archives forum and pulled up the 
Page Source (HTML formatting template) and lo and behold all my paragraphs were 
correctly formatted (i.e. page-wrapped just as they had been when they left my 
mail notepad) and displayed correctly--on the source page.  So,who knows...(?)

From the virtual desk of Lowell Tackett  


--- On Thu, 1/7/10, ALAN GAULD alan.ga...@btinternet.com wrote:

From: ALAN GAULD alan.ga...@btinternet.com
Subject: Re: [Tutor] formatting*
To: Lowell Tackett lowelltack...@yahoo.com, tutor@python.org
Date: Thursday, January 7, 2010, 5:36 PM


 I'm using Mandrake 10.1 [Linux] OS to view the internet thru Firefox.  
 In my mailbox, everything is fine--my stuff formats well (and when it 
 comes back to me as Tutor 'mail' it also formats correctly).

 The problem is over at the Tutor Archives (mail.python.org/pipermail/tutor), 
 i.e., the Tutor forum site.  That's where whatever I composed formats 
 out with no line wrap, and a paragraph becomes a single line, 

Yes I see that. I don't use that archive I normally use gmane...

However that is probably down to whatever mail program you are 
using to post with. Is it a web client or a full blown thick client mail 
tool like Thunderbird?

Whichever, it probably has an option to automatically wrap sent text
and I suspect you have that turned off. A good value is usually 
around 70 or 80 chars.

FWIW I have the opposite problem using gmail, it consistently wraps 
my text prematurely leaving my paragraphs badly formatted. And I 
can't find where to change the setting!

HTH,

Alan G.


  




  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] formatting*

2010-01-07 Thread Lowell Tackett
Well, Ok then, I have switched to plain text to transmit this response.  I will 
follow it over to the archive forum to see how the difference works.

In the meantime...this back-and-forth dialog has at least made me aware of 
gmane, a website I had not been aware of.  Interesting place.  I was over 
there, looking around, and trying to figure it out.  Found some of this 
correspondence set there, pretty much in isolation.

It's a quirky place that I'm trying to figure out.  Only a few of the most 
current items seem to be available (unlike the Tutor Archive forum, where an 
entire month's submittals are all lined up and available for sequential 
reading).  Does one need to sign up in someway or another to make the entire 
site available?

Thanks for your help and input with all of this.
From the virtual desk of Lowell Tackett  


--- On Thu, 1/7/10, Alan Gauld alan.ga...@btinternet.com wrote:

From: Alan Gauld alan.ga...@btinternet.com
Subject: Re: [Tutor] formatting*
To: tutor@python.org
Date: Thursday, January 7, 2010, 7:25 PM


Lowell Tackett lowelltack...@yahoo.com wrote

 Well, not a lot of luck. What I use is Yahoo mail (whatever that is---a 
 thick client??),
 and thus far I can't find any tool bars that offer help.

A thick client is an application that runs on your desktop with built in 
intelligence.
A thin client is a GUI within a browser that has all the intelligence on a
server - typically a web app.

Yahoo is a thin client. As it happens I use it too.

You should find at the end of the subject line on outgoing messages
an option to switch to plain text. Select that and you should find your
line breaks are recognised. (HTML does not recognise your line
breaks and tries to leave formatting to the browser. The archive
page obviously gets confused by this! But using HTML to a mailing
list causes other problems too so its best to send as plain text)

HTH,

-- Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] way to see code execution in real-time?

2009-10-16 Thread Lowell Tackett
Try the pdb module--the python debugger.

From the virtual desk of Lowell Tackett  


--- On Fri, 10/16/09, Serdar Tumgoren zstumgo...@gmail.com wrote:

From: Serdar Tumgoren zstumgo...@gmail.com
Subject: [Tutor] way to see code execution in real-time?
To: Python Tutor Tutor@python.org
Date: Friday, October 16, 2009, 9:53 AM

Hello everybody,

I was wondering -- is there a way to watch a program execute by
piping a report of its actions to standard output or to a file?
Basically, I'd like to see the order that functions/methods are
executing as they happen, along with how long each one takes.

Is this something cProfile would do, or is there another tool built
for that purpose?

Thanks!
Serdar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



  ___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Organizing my code, should I use functions?

2009-04-22 Thread Lowell Tackett

Just a comment [that might nudge your insight] regarding functions.  From the 
'good-ol-days'--a function was called a subroutine.  They are the same thing.  
When my thinking starts to muddle (often and easily) that connection always 
helps.

From the virtual desk of Lowell Tackett  


--- On Wed, 4/22/09, Eduardo Vieira eduardo.su...@gmail.com wrote:

From: Eduardo Vieira eduardo.su...@gmail.com
Subject: [Tutor] Organizing my code, should I use functions?
To: tutor tutor@python.org
Date: Wednesday, April 22, 2009, 10:49 AM

Hello! I’m not a programmer and am a beginner with Python, I would
like suggestion about ways of tackling the task I had to do. I have
bee been using the xlrd package to get data from some spreadsheets
successfully.
I have developed a simple report from a script that compares number of
shipments recorded in 2 spreadsheets, with data from previous years
and current year, respectively.
Later on I was asked to include in the same report numbers from
another branch of our company. So, basically all the code logic was
the same, only two different files needed to be processed, and I
wondered how would I save time avoiding repeating code, creating extra
variables, etc. So, I simply decided to alter the code as little as
possible and use the import statement. It's working this way. Sounds
wise? I thought if I converted it to a function or a class would make
it more flexible, but my understanding of classes are too basic yet,
and am not sure if it's worth using it.
I have noticed that in lot's of python code example, people make
functions out of everything. I'm still too much attached to
procedural, not functional programming, if I understand the terms
correctly. I would appreciate any suggestions.

Here is the code:

## This script creates a report of shipments ## comparing the numbers
from the previous year with the current year.

import xlrd # Package to read Excel files import os import glob import
time import datetime import dbi import odbc




thismonth = time.strftime('%B', time.gmtime()) # Get's a string with
the name of the current month

hoje = time.strftime(%a, %b %d, %Y, time.gmtime())


# Two excel files to process with shipping information

thisyearFile = r'c:\Shipping Totals - 2009\Shipping Totals 2009 West.xls'
prevyearFile = r'c:\Shipping Totals\Shipping Totals - 2008\Shipping
Totals 2008 West.xls'



thisDay = time.gmtime()[:3]
prevyear = datetime.datetime.today() - datetime.timedelta(days=365)
aYearAgo = prevyear.timetuple()[:3]

## --- Code to find the right cell with today's shipments

book = xlrd.open_workbook(thisyearFile) # Opens excel file

dayexcel = xlrd.xldate.xldate_from_date_tuple(thisDay, book.datemode)
#Puts the date in the Excel format, like 3991.0


sh = book.sheet_by_name(thismonth) # The sheet which has the name of
the month: April, May, June, etc.

firstCol = sh.col_values(0) # Retrieves the first column

tperday = firstCol.index('TOTAL Per Day') # Finds the cell 'Total Per Day'

shipindex = tperday + 1 # The next cell after 'TOTAL Per Day', which
contains the info about shipments

# Looks for the column whose header is today's date for cols in range(sh.ncols):
   for valores in sh.col_values(cols):
   if valores == dayexcel: # If it finds the column with today's date
   todaysList = sh.col_values(cols)
   totals = sh.row_values(shipindex, end_colx=cols + 1) # sum
up to the current date
   break

# Crosses rows with column to find the right cell with the shipments
of today shippedToday = todaysList[shipindex]

totalShipments = sum([a for a in totals if type(a) == type(2.0)]) #
Sums all shipments


# Check previous year's shipments processing the file with last year's data

booktwo = xlrd.open_workbook(prevyearFile)

dayexcel = xlrd.xldate.xldate_from_date_tuple(aYearAgo, book.datemode)

sh = booktwo.sheet_by_name(thismonth)

firstCol = sh.col_values(0)



tperday = firstCol.index('TOTAL Per Day')

shipindex = tperday + 1

for cols in range(sh.ncols):
   for valores in sh.col_values(cols):
   if valores == dayexcel:
   lastyearsList = sh.col_values(cols)
   totals = sh.row_values(shipindex, end_colx=cols + 1) # sum
up to the current date
   break


shippedLastYear = lastyearsList[shipindex]


OldTotalShipments = sum([a for a in totals if type(a) == type(2.0)])


# Imports the information from the Eastern division. See code on the bottom

import bizreportereast as bz


report = 


= Shipments Alberta Warehouse =

- Shipments today: %d

- Shipments this month: %d

- Shipments this day, last year: %d

- Shipments this month, last year: %d


= Shipments Ontario Warehouse =

- Shipments today: %d

- Shipments this month: %d

- Shipments this day, last year: %d

- Shipments this month, last year: %d


 % (shippedToday, totalShipments, shippedLastYear,
OldTotalShipments, bz.shippedToday, bz.totalShipments,
bz.shippedLastYear, bz.OldTotalShipments)

print report

logfile = open('c

Re: [Tutor] Advice for my function, isPrime(n), please

2008-07-19 Thread Lowell Tackett


From the virtual desk of Lowell Tackett  



--- On Sat, 7/19/08, Dick Moores [EMAIL PROTECTED] wrote:

 From: Dick Moores [EMAIL PROTECTED]
 Subject: Re: [Tutor] Advice for my function, isPrime(n), please
 To: Python Tutor List tutor@python.org
 Date: Saturday, July 19, 2008, 8:23 AM
 At 04:44 AM 7/19/2008, Kent Johnson wrote:
 On Sat, Jul 19, 2008 at 5:03 AM, Dick Moores
 [EMAIL PROTECTED] wrote:
 
Readability counts.  --
  
   Personally I think my way is more readable.
 It says what it means
   without any fluff. IMO it is explicit,
 readable, concise and to the
   point.
  
   Well, readability is in the eye of the reader.
 Also, because I lived in
   Japan 30 years, I could throw a concise,
 explicit, and 
  to-the-point Japanese
   sentence at you that you wouldn't understand
 at all.
 
 Yes, and then if I complained that the sentence was not
 readable you
 would rightly conclude that the problem was with the
 reader, not the
 sentence.
 
 Maybe we're running my analogy into the failure it
 deserves.
 
 Your basic point is that  return x != 0  is standard,
 idiomatic 
 Pythonese and I'm wrong to complain. I should suck it
 up and study 
 harder. Point taken. I welcome this addition to my Python
 vocabulary.
 
 Dick
 
 Just a comment from the sidelines...this ongoing discourse, and its' humorous 
 diversions, has been a fun read-and made some good pedagogial points-in its' 
 own right.  Always a good thing to never take ones' self too seriously, isn't 
 it?!

Thanks for the intelligent wandering from strict tutorial protocol!
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


  

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Learning Python from books

2008-06-19 Thread Lowell Tackett
Python Programming [for the absolute beginner] by Michael Dawson is-in my 
humble opinion-a programming pedagogical pacesetter.

From the virtual desk of Lowell Tackett  



--- On Thu, 6/19/08, Zameer Manji [EMAIL PROTECTED] wrote:

 From: Zameer Manji [EMAIL PROTECTED]
 Subject: [Tutor] Learning Python from books
 To: Python Tutor mailing list tutor@python.org
 Date: Thursday, June 19, 2008, 2:56 PM
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA512
 
 Has anyone here attempted to learn Python from books ? I
 recently
 purchased Learning Python 3rd Edition
 (9780596513986) and if anyone
 here is a good bottom-up learner than it is the perfect
 book. The author
 goes over each feature in python, explaining it's
 syntax, usage and the
 pythonic way of using them in programs. It has
 really helped me
 understand some of the more powerful tools in python and I
 am sure it
 will make an excellent reference book in the future. With
 that said, has
 anyone else attempted to learn python from books and if so
 which one ?
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.7 (MingW32)
 
 iQEcBAEBCgAGBQJIWqvxAAoJEA759sZQuQ1BS+kIAK+6TWqesUQjEQygwsMI3seU
 ZWUkd4wlextCOXIH6mse4TMHdAU3+NHDo1V4QwSYxNTEjwpWFr1Kg2BE0zyMyxPD
 gs8Kaov6/DGQgyFFt5DRcKvkQ0M5St7I/PuP+n/eelMUK1culvXx3oycKBqh8D21
 R/g0SQ0M9pUDLuBEygbgjFw1WVsf/h8/zCc38qHQ+QOQvrVaEciV3I5JLyp3+u8g
 JyjzxjHSRHd4Ik4cnaeKa2OyFn5JaPXxPmrmPiE3WEWnJxLWucXAP/CEm7e9aamQ
 Fv4SYuVmOIGpbAqySgEpQH2yRsd+0qaNKSJq4hqjQ1/z2Bx6hM5LTqJAVjfZMW4=
 =9xVw
 -END PGP SIGNATURE-
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


  

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDE

2008-06-10 Thread Lowell Tackett


From the virtual desk of Lowell Tackettnbsp; 


--- On Tue, 6/10/08, W W lt;[EMAIL PROTECTED]gt; wrote:
From: W W lt;[EMAIL PROTECTED]gt;
Subject: Re: [Tutor] IDE
To: Sean Novak lt;[EMAIL PROTECTED]gt;
Cc: tutor@python.org
Date: Tuesday, June 10, 2008, 1:09 PM

1) I have two terminal windows open, one with an interactive python
prompt, and the other with vim...

How do you do that (as you describe above)?

-Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


  ___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] self-learning Python

2008-03-09 Thread Lowell Tackett


Julia [EMAIL PROTECTED] wrote: Emad Nawfal wrote:
  On Sun, Mar 9, 2008 at 8:16 AM, Julia [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
  To be honest I truly dislike the Dawson book. I wouldn't recommend
  it to anyone. It's lacks technical clarity, examples and has a messy
  index. I'm going to sell my example asap.
 
 I'm not sure what kind of clarity you want. To be sure Dawson is not
 nearly as precise and comprehensive as Learning Python, for example, but
 I think the more casual approach is better for a complete beginner.
 
 ISTM Dawson is written almost entirely as a series of extended examples,
 I'm really surprised that you say it lacks examples.

Yes, Dawson uses few examples. His examples might be extensive but there are 
still few examples. Compare the number of examples in Dawson book to the (in my 
opinion better) Beginning Python by Norton (Wrox). 
  The problem is that if you want to know how to use one specific technique 
then Dawsons great big examples are of limited use. In a book like Beginning 
Python I can find the same technique isolated and therefore better understand 
it.

   When I was a complete beginner I preferred Beginning Python over Dawson and 
I still do (I'm still a beginner). But that might just me be me :)
 
 
 
/Julia

There's an essential (in my opinion) principle of learning programming that 
doesn't seem to have made its' way into this conversation.  I'll preface my 
thoughts by saying that in-again, my opinion- Michael Dawson's book, Python 
Programming for the absolute beginner is more than a book...it's a hallowed 
tome.  A lot of learning is not only absorbing stuff, but what I call (and I'm 
certain it didn't originate with me) finger time.  That's simply spending 
time at the keyboard and vicariously interacting.  Things will come to you, but 
it needs hours and hours of fairly productive interaction.  Mr. Dawson's book 
provides that cycle of, 'do...feedback...oh, yea!' like nothing else available.

Of course, a person is gonna need to jump away and do independent stuff.  But 
this book provides concrete milestones from which to jump and apply concepts to 
independently thought up projects.

That, after having used Mr. Dawson's book, and appreciating the solid grounding 
it provided me, is my humble opinion.

Lowell T.


 ___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor



From the virtual desk of Lowell Tackett  

   
-
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] self-learning Python

2008-03-09 Thread Lowell Tackett


Julia [EMAIL PROTECTED] wrote: On Sun, Mar 9, 2008 at 5:00 PM, Lowell Tackett 
[EMAIL PROTECTED] wrote:
 



There's an essential (in my opinion) principle of learning 
programming...learning is not only absorbing stuff, but what I call (and I'm 
certain it didn't originate with me) finger time.Mr. Dawson's book 
provides that cycle of, 'do...feedback...oh, yea!' like nothing else available.
 
Of course, a person is gonna need to jump away...this book provides concrete 
milestones from which to jump...

Lowell T.


 ___
Tutor maillist  -   Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor 
  That was a really interesting post Lowell. Great feedback! I've thought about 
something like this but I haven't been sure how to express it (English isn't my 
mother tongue). You also set a better tone then I used in my first reply. I 
apologize for it.

   What you are talking about is very important. Succeeding and making 
something work is a thrill and it will motivate one try even harder the next 
time. 

   For me Beginning Python provided a better ground for this learning 
experience because I got to try many variations of the many important parts of 
Python. I wrote the code from the examples and I saw it work. With Dawson there 
where some really extensive examples but I didn't really understand how the 
isolated parts worked. There where many more oh, this is cool thoughts with 
Beginning Python. I also believe that by using a more technical book I gained 
an experience with the programming methology (e.g. coding and debugging code). 

   What I am claiming is that the productive experience is greater with 
Beginning Python than with Dawson. Don't be afraid of the big and more 
technical books. They are big, but big means there's more fun inside. 
   
   /Julia


Ya know what?...if we all had the same opinions and perspective, this forum 
wouldn't exist!  We wouldn't need it (well, yea, I am kinda overlooking the 
pedagogical value).  Actually it was [in part] your provocative comments that 
inspired my response (but also, I harbor very strong loyalty to Mr. Dawson's 
book).  Please!! no apologies necessary.  I am in fact inspired to look at your 
arguments more closely and see what valuable slant I may have boxed myself out 
of (sometimes, tunnel-vision tends to creep in.)

  


From the virtual desk of Lowell Tackett  

   
-
Never miss a thing.   Make Yahoo your homepage.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor