Re: [Tutor] masking library files

2014-04-09 Thread ugajin
Please write in plain English if you want to be understood. -Original Message- From: Dave Angel To: tutor@python.org Sent: Thu, 10 Apr 2014 2:00 Subject: Re: [Tutor] masking library files uga...@talktalk.net Wrote in message: > ___ > T

Re: [Tutor] masking library files

2014-04-09 Thread Dave Angel
uga...@talktalk.net Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > A message left in invisible ink. Please post in text form, not html,

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Dave Angel
Jared Nielsen Wrote in message: > Hi Pythons, > Could someone explain the difference between expressions and statements? > I know that expressions are statements that produce a value. > I'm unclear on functions and especially strings. > Are any of the following expressions? > > print(42) > print(

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Ben Finney
Jared Nielsen writes: > Could someone explain the difference between expressions and > statements? For general programming terminology, the Wikipedia articles tend to be good. https://en.wikipedia.org/wiki/Expression_%28computer_science%29> https://en.wikipedia.org/wiki/Statement_%28computer_sc

Re: [Tutor] Python Help

2014-04-09 Thread Chris Calloway
On 4/9/2014 3:59 PM, Adam Grierson wrote: I'm using 3D climate data (ending in “.nc”). The cube contains time, longitude and latitude. I would like to look at the average output over the last 20 years. The time field spans back hundreds of years and I only know how to collapse the entire field in

Re: [Tutor] Python Help

2014-04-09 Thread Alan Gauld
On 09/04/14 20:59, Adam Grierson wrote: I'm using 3D climate data (ending in “.nc”). The cube contains time, longitude and latitude. I would like to look at the average output over the last 20 years. The time field spans back hundreds of years and I only know how to collapse the entire field int

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Alan Gauld
On 09/04/14 17:49, Jared Nielsen wrote: Hi Pythons, Could someone explain the difference between expressions and statements? I know that expressions are statements that produce a value. Yep, that's it. I'm unclear on functions and especially strings. Unclear in what way? Both functions and

[Tutor] Python Help

2014-04-09 Thread Adam Grierson
Hi I'm using 3D climate data (ending in “.nc”). The cube contains time, longitude and latitude. I would like to look at the average output over the last 20 years. The time field spans back hundreds of years and I only know how to collapse the entire field into a mean value. How can I tell py

[Tutor] 2014 PyCamps

2014-04-09 Thread Chris Calloway
Need some in-person and structured Python tutoring? PyCamp is an ultra-low-cost, five-day, intensive Python boot camp program by a user group for user groups. PyCamp has taught Python fundamentals to thousands of beginners for nine years while sponsoring Python regional conferences, symposia,

Re: [Tutor] difference between expressions and statements

2014-04-09 Thread Danny Yoo
> Could someone explain the difference between expressions and statements? > > I know that expressions are statements that produce a value. Yes, that's pretty much it. If you can point your finger at the thing and say that it produces a value, it's an expression. > Are any of the following expr

[Tutor] difference between expressions and statements

2014-04-09 Thread Jared Nielsen
Hi Pythons, Could someone explain the difference between expressions and statements? I know that expressions are statements that produce a value. I'm unclear on functions and especially strings. Are any of the following expressions? print(42) print("spam") spam = 42 print(spam) Is the first examp

Re: [Tutor] When to use classes

2014-04-09 Thread Cameron Simpson
On 08Apr2014 22:58, Ni hung wrote: > I am learning programming using python. I think of solving a problem using > functions and for this reason all/most of my code consists of functions and > no classes. I have some understanding of classes/Object Oriented > Programming. I can write simple classe

Re: [Tutor] masking library files

2014-04-09 Thread Alan Gauld
On 09/04/14 15:17, uga...@talktalk.net wrote: Is it common for files saved to a working directory to 'mask' library files located in the Python framework? Python looks in the local directory first so if you name a module with the name of one of the standard modules Python will, quite reasonabl

Re: [Tutor] masking library files

2014-04-09 Thread Mark Lawrence
On 09/04/2014 15:17, uga...@talktalk.net wrote: Is it common for files saved to a working directory to 'mask' library files located in the Python framework? -A Yes. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence ---

Re: [Tutor] Delete unwanted rows

2014-04-09 Thread Mark Lawrence
On 09/04/2014 15:14, Peter Otten wrote: Alexis Prime wrote: However, pandas is a specialist topic and if you expect to work more with it you may want to learn the proper idiomatic way to do it. You should then ask again on a mailing list that is frequented by the pandas experts -- python-tutor i

[Tutor] masking library files

2014-04-09 Thread ugajin
Is it common for files saved to a working directory to 'mask' library files located in the Python framework? -A ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Delete unwanted rows

2014-04-09 Thread Peter Otten
Alexis Prime wrote: > Hello, > > My question is whether I should write a loop or a function to delete rows. > > I'm using pandas. But you may be able to help me as my question is about > the reasoning behind programming. > > I have a pandas dataframe that looks like this, covering all countries

Re: [Tutor] Delete unwanted rows

2014-04-09 Thread Mark Lawrence
On 09/04/2014 10:23, Alexis Prime wrote: Hello, My question is whether I should write a loop or a function to delete rows. I'm using pandas. But you may be able to help me as my question is about the reasoning behind programming. I have a pandas dataframe that looks like this, covering all cou

[Tutor] Delete unwanted rows

2014-04-09 Thread Alexis Prime
Hello, My question is whether I should write a loop or a function to delete rows. I'm using pandas. But you may be able to help me as my question is about the reasoning behind programming. I have a pandas dataframe that looks like this, covering all countries in the world, for over 200 rows and

Re: [Tutor] When to use classes

2014-04-09 Thread Dave Angel
Ni hung Wrote in message: (Please post in text format, not html. It doesn't matter for your particular message, but several things can go wrong, where some or most of us do not see what you meant to post) > I am learning programming using python. I think of solving a > problem using functi

Re: [Tutor] When to use classes

2014-04-09 Thread Alan Gauld
On 09/04/14 06:58, Ni hung wrote: functions and no classes. I have some understanding of classes/Object Oriented Programming. I can write simple classes but I do not understand when to use classes. If you are just learning it may be that the programs you have written are too small to make cl

Re: [Tutor] dictionary keys

2014-04-09 Thread Alex Kleider
On 2014-04-08 23:55, Peter Otten wrote: You can create and sort the list in a single step: l = sorted(myDict) Thank you again; this is a new idiom for me. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https:

Re: [Tutor] question about strip() and list comprehension

2014-04-09 Thread Peter Otten
Steven D'Aprano wrote: > On Tue, Apr 08, 2014 at 02:38:13PM -0600, Jared Nielsen wrote: >> Hello, >> Could someone explain why and how this list comprehension with strip() >> works? >> >> f = open('file.txt') >> t = [t for t in f.readlines() if t.strip()] >> f.close() >> print "".join(t) >> >> I

[Tutor] When to use classes

2014-04-09 Thread Ni hung
Hi I am learning programming using python. I think of solving a problem using functions and for this reason all/most of my code consists of functions and no classes. I have some understanding of classes/Object Oriented Programming. I can write simple classes but I do not understand when to use cl

Re: [Tutor] question about strip() and list comprehension

2014-04-09 Thread Jared Nielsen
Thanks Danny! That was an awesome explanation. On Tue, Apr 8, 2014 at 7:05 PM, Danny Yoo wrote: > >> if line.strip() >> >> Is that stripping the line of white space at the same time that it is >> testing it? >> >> > > Two features about Python: > > 1. Strings are immutable, so the above is com

Re: [Tutor] question about strip() and list comprehension

2014-04-09 Thread Jared Nielsen
Thank Danny, That's much more clear. But I still don't understand what's happening with: if line.strip() Is that stripping the line of white space at the same time that it is testing it? On Tue, Apr 8, 2014 at 3:44 PM, Danny Yoo wrote: > > Could someone explain why and how this list comprehen