Re: [Tutor] For-else... Any other handy constructs hiding in Python?

2016-06-28 Thread Fred Stluka

(Re-sending to list instead of just to Alex.)

Alex,

Are you aware of these?
- try ... finally
- try ... except ... else
- continue
- break
- with
- @decorator
- x = a if b else c
   -- Like the ternary operator a?b:c in other languages
- x = a or b
  -- Assigns a, defaulting to b if a is false, unlike other
   languages that might assign True or False
  -- Short than the equivalent: x = a if a else b

Any other cool tricks out there, anyone?
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 6/24/16 9:07 AM, Alex Hall wrote:

Hey all,
I was looking at how to make my different jobs retry themselves, and found
the for-else construct. I know loops, comprehensions, ifs, and the like,
but I never knew for-else was available. Are there other constructs that I
may have missed--shortcuts or seemingly odd pairings of control statements
like this? Python has a lot of really cool shortcuts and features, like
get/hasattr, the yield keyword, or comprehensions. I always like finding
more to add to the toolbox.



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


Re: [Tutor] Learning Objectives?

2017-02-28 Thread Fred Stluka
   On 2/27/17 9:57 AM, leam hall wrote:

 On Mon, Feb 27, 2017 at 9:28 AM, Alan Gauld via Tutor [1]
 wrote:


 On 27/02/17 10:44, Leam Hall wrote:

 Is there a list of Python skill progression, like "Intermediates should
 know  and Advanced should know ?" Trying to map out
 a well rounded study list.

 I'm not aware of such a list, and I'm not sure it's of much value.
 Better to just learn what you need and use it. When you need
 to learn more, learn it. The worst thing you can do is study an
 arbitrary list of topics that don't have any relevance to
 the problems you need to solve!

 ...

 When I was coming up as a Linux guy I took the old SAGE guidelines and
 studied each "level" in turn. It was useful for making me a well-rounded
 admin and helped me put off some higher end stuff I wasn't really ready
 for.

 ...



   I agree with Leam.  If anyone has such a list, I think many of us
   would be interested to see it.

   Personally, I'd already been a programmer for 30 years when I
   first started using Python and Django.  I learned them in bits and
   pieces, as needed for a 4 year project.  I never took time to read
   a comprehensive book on either topic.  Also, they both evolved
   quite a bit during those 4 years, with many new and changed
   features.  So it's possible that I've completely overlooked some
   relatively basic features.

   If there were such a list, I'd quickly scan the "basic" section to
   what I may have missed.  Then, I'd scan the more advanced
   sections to what else exists.

   It would also be useful when teaching Python to someone else,
   to have some guidance about which language constructs are
   used most often.

   As a quick straw man, here's a syllabus I started whipping up
   recently for a Python and Django class I was asked to teach.
   - [2]http://bristle.com/Courses/PythonDjangoIntro/syllabus.html

   It has 5 main sections:
   - Python
   - Django
   - Possible Advanced Python Topics
   - Possible Advanced Django Topics
   - Possible Related Topics

   The class would be ten weeks, with 6 hours of lecture and 4
   hours of lab per week, so I'd hope to cover all of the 1st 2
   sections, and perhaps some/all of the last 3 sections.

   Feel free to comment on errors, omissions, misplaced items, etc.

   Enjoy!
   --Fred

   --

   Fred Stluka -- [3]mailto:f...@bristle.com -- [4]http://bristle.com/~fred/
   Bristle Software, Inc -- [5]http://bristle.com -- Glad to be of service!
   Open Source: Without walls and fences, we need no Windows or Gates.

   --

References

   Visible links
   1. mailto:tutor@python.org
   2. http://bristle.com/Courses/PythonDjangoIntro/syllabus.html
   3. mailto:f...@bristle.com
   4. http://bristle.com/~fred/
   5. http://bristle.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor