advanced-features-functions/script.rst
changeset 457 68813d8d80fb
parent 456 be96dc6c9743
parent 410 226b6e789da5
equal deleted inserted replaced
456:be96dc6c9743 457:68813d8d80fb
   168  
   168  
   169 
   169 
   170   welcome()
   170   welcome()
   171  
   171  
   172 
   172 
   173 Let us now learn what keyword arguments are. 
   173 Let us now learn what keyword arguments or named arguments are. We
       
   174 shall refer to them as keyword arguments, henceforth. 
   174 
   175 
   175 {{{ show a slide with examples using keyword arguments. }}}
   176 {{{ show a slide with examples using keyword arguments. }}}
   176 
   177 
   177 .. #[[Anoop: slide is missing]]
   178 .. #[[Anoop: slide is missing]]
   178 
   179 
   183   plot(y, sin(y), 'g', linewidth = 2)
   184   plot(y, sin(y), 'g', linewidth = 2)
   184 
   185 
   185   annotate('local max', xy = (1.5, 1))
   186   annotate('local max', xy = (1.5, 1))
   186 
   187 
   187   pie(science.values(), labels = science.keys())
   188   pie(science.values(), labels = science.keys())
   188 
       
   189 .. #[[Anoop: I think it will better to introduce keyword arguments as
       
   190    keyword/named arguments, as the keyword term was quite confusing
       
   191    for me, so can be for someone who already know certain
       
   192    jargon's/concepts, also it would be good to tell them that these
       
   193    are different from keywords in programming languages, explicit is
       
   194    better than implicit, and probably you could also tell them that
       
   195    from now on we will refer to it as just keyword arguments]]
       
   196 
   189 
   197 When you are calling functions in Python, you don't need to remember
   190 When you are calling functions in Python, you don't need to remember
   198 the order in which to pass the arguments. Instead, you can use the
   191 the order in which to pass the arguments. Instead, you can use the
   199 name of the argument to pass it a value. This slide shows a few
   192 name of the argument to pass it a value. This slide shows a few
   200 function calls that use keyword arguments. ``loc``, ``linewidth``,
   193 function calls that use keyword arguments. ``loc``, ``linewidth``,
   248   Math functions - abs, sin, ....
   241   Math functions - abs, sin, ....
   249 
   242 
   250 .. #[punch: Need to decide, exactly what to put here. Reviewer comments
   243 .. #[punch: Need to decide, exactly what to put here. Reviewer comments
   251 ..  welcome.] 
   244 ..  welcome.] 
   252   
   245   
   253 
       
   254 {{{ switch to slide showing classes of functions in pylab, scipy }}}
   246 {{{ switch to slide showing classes of functions in pylab, scipy }}}
   255 
   247 
   256 .. #[[Anoop: slide missing]]
   248 .. #[[Anoop: slide missing]]
   257 
   249 
   258 Apart from the standard library there are other libraries like ``pylab``,
   250 Apart from the standard library there are other libraries like ``pylab``,