Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Python - a truly dynamic language

In Python everything is an object - and that includes functions which are objects which contain blocks of code. And this means that you can define different functions of the same name depending on a condition, and you can replace a function with another one too, if you want to.

This really is valid:

ontop = int(raw_input("Enter 1 if summat ontop "))
 
if ontop == 1:
  def tanksize(basedim):
    vlume = basedim * (basedim+1) * (basedim+2)
    return vlume
else:
  def tanksize(basedim):
    vlume = basedim * (basedim+2)
    return vlume
 
for k in range(10):
  more = tanksize(k)
  print "more is ", more
 
def tanksize(basedim):
  vlume = basedim * (basedim+4)
  return vlume
 
for k in range(10):
  more = tanksize(k)
  print "more is now", more

Would you write code like that? Probably not - but you could well write a piece of code that embeds within another application as required, and overrides default (preloaded) code. A number of commercial applications use Python for their tailoring, and this is the mechanism they often use to provide hooks for extra code for the minority of users who want to change certain algorithms.

Illustration - delegates write a program using the topics I have just covered in my lecture on a programming course (this course on site in Germany)

(written 2009-01-30, updated 2010-06-23)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y199 - Python - Fast Start
  [3519] Python - current versions and implementations (CPython, Jython, IronPython etc) - (2011-11-13)
  [4707] Some gems from an introduction to Python - (2016-10-29)
  [4709] Some gems from Intermediate Python - (2016-10-30)
  [4712] A reminder of the key issues to consider in moving from Python 2 to Python 3 - (2016-10-30)
  [4713] Equality (in Python) - (2016-10-30)

Y106 - Object Oriented Python
  [477] Class, static and unbound variables - (2005-10-25)
  [834] Python makes University Challenge - (2006-08-15)
  [900] Python - function v method - (2006-10-20)
  [1306] Python class rattling around - (2007-08-16)
  [1348] Screw it or Glue it? Access to Object variables - a warning - (2007-09-12)
  [1925] Introduction to Object Oriented Programming - (2008-12-06)
  [2169] When should I use OO techniques? - (2009-05-11)
  [2604] Tips for writing a test program (Ruby / Python / Java) - (2010-01-29)
  [3085] Object Oriented Programming for Structured Programmers - conversion training - (2010-12-14)
  [3399] From fish, loaves and apples to money, plastic cards and BACS (Perl references explained) - (2011-08-20)
  [3436] Moving from scripting to Object Orientation in Python - (2011-09-13)
  [3673] Object oriented or structured - a comparison in Python. Also writing clean regular expressions - (2012-03-26)
  [3878] From Structured to Object Oriented Programming. - (2012-10-02)
  [3947] this or self - what are they, and what is the difference? (Python) - (2012-12-08)
  [4021] Spike solution, refactored and reusable, Python - Example - (2013-02-28)
  [4028] Really Simple Class and Inheritance example in Python - (2013-03-04)
  [4129] Simple OO demonstration in C++, comparison to Python - (2013-07-01)
  [4448] What is the difference between a function and a method? - (2015-03-04)
  [4591] From single block to structure and object oriented programming - (2015-12-02)
  [4650] Why populate object with values as you construct them? - (2016-02-18)
  [4721] When to check an object type - Python isinstance example - (2016-11-03)

Y050 - Python - General
  [16] Python training - (2004-08-16)
  [2020] Learning Python - many new example programs - (2009-01-31)
  [2227] Learning PHP, Ruby, Lua and Python - upcoming courses - (2009-06-11)
  [2285] Great new diagrams for our notes ... Python releases - (2009-07-13)
  [2367] Learning to program - how to jump the first hurdles - (2009-08-20)
  [2394] Two days of demonstration scripts in Python - (2009-09-05)
  [2504] Learning to program in ... - (2009-11-15)
  [2778] Learning to program in Python 2 ... and / or in Python 3 - (2010-05-24)
  [2822] Python training courses for use with ESRI ArcMap software - (2010-06-23)
  [3076] Python through the Snow - (2010-12-01)
  [3463] Busy weekend of contrasts. - (2011-10-03)
  [3489] Python courses and Private courses - gently updating our product to keep it ahead of the game - (2011-10-20)
  [3798] When you should use Object Orientation even in a short program - Python example - (2012-07-06)
  [3816] Want to escape the Olympics? Learn to program in the countryside! - (2012-07-23)
  [3902] Shell - Grep - Sed - Awk - Perl - Python - which to use when? - (2012-10-22)
  [3903] Python Programming class for delegates who have already self-taught the basics - (2012-10-25)
  [3911] How well do you know Perl and / or Python? - (2012-11-04)
  [3935] Whether you have programmed before or not, we can teach you Python - (2012-11-25)
  [4236] Using Python to analyse last years forum logs. Good coding practise discussion. - (2014-01-01)
  [4295] A longer Python ... training course - (2014-09-16)
  [4408] Additional Python courses added to our schedule - (2015-01-29)
  [4434] Public training courses - upcoming dates - (2015-02-21)
  [4558] Well House Consultants - Python courses / what's special. - (2015-10-28)
  [4656] Identifying the first and last records in a sequence - (2016-02-26)


Back to
Apache httpd and Apache Tomcat miscellany
Previous and next
or
Horse's mouth home
Forward to
UnboundLocalError - Python Message
Some other Articles
Short health and safety course
Baby Caleb and Fortune City in your web logs?
UnboundLocalError - Python Message
Python - a truly dynamic language
Apache httpd and Apache Tomcat miscellany
Service Excellence Awards
First Class
wxPython - Introduction and sample
The Wiltshire Police
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2021: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2017_Pyt ... guage.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb