[Tutor] Applications/examples of some advanced Py features, please !

Gonçalo Rodrigues op73418@mail.telepac.pt
Sat Jan 4 11:36:16 2003


This is a multi-part message in MIME format.

------=_NextPart_000_001A_01C2B410.49B68510
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I will just comment on the functional stuff and reserve my comment on =
the interfaces stuff to another post.

I haven't got any specific use cases for you. But one advice that I got =
and that helped me a lot was just to browse the code in the Python =
standard library. The code there is high quality and you are bound to =
find several use cases for lambda, although much less for nested scopes =
since they are a relatively recent addition to the language.=20

If you want to learn more on functional programming, David Mertz has 3 =
articles about it in the IBM developer works site. Just google for them.

With my best regards
G. Rodrigues
  ----- Original Message -----=20
  From: Aztech Guy=20
  To: tutor@python.org=20
  Sent: Friday, January 03, 2003 9:44 PM
  Subject: [Tutor] Applications/examples of some advanced Py features, =
please !




  Hi Python gurus,

  Can anyone please give some examples / applications of the use of the =
following advanced (advanced to me, at least :-) features of Python :

  1. lambda

  2. nested functions - a little info was given by Danny in reply to my =
earlier post on local-static variables, but I would like more.

  3. Thoughts on implementing Interfaces in Py - a la Java interfaces.

  I am, and will be doing more, on reading the docs and googling for =
this, but would anyway appreciate inputs from those who know this stuff.

  I have a specific reason for the above questions- apart from general =
interest, of course -> I am planning to write a game-playing program in =
Py which will have features somewhat AI - ish. I don't have any =
background in AI; nor much in functional programming. I do understand =
recursion though. I suspect that some of the above 3 points will help me =
to write my app in a better way. though not sure, of course. Hence the =
request for examples.

  For all of the above 3 points, I'm interested in :

   - code examples of their use

   - in what way their use makes code simpler, or maybe makes code =
possible that could not be written otherwise ('possible' in practical =
terms - I'm - vaguely - aware of the fact that all languages are =
supposed to be theoretically 'Turing-equivalent' or some such term - but =
what I mean is that if something is going to take a huge amount more =
code in some other language, or jumping through hoops, then I don't call =
it practically equivalent).

  Thanks !

  Az


------=_NextPart_000_001A_01C2B410.49B68510
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV>I will just comment on the functional stuff and reserve my comment =
on the=20
interfaces stuff to another post.<BR><BR>I haven't got any specific use =
cases=20
for you. But one advice that I got and that helped me a lot was just to =
browse=20
the code in the Python standard library. The code there is high quality =
and you=20
are bound to find several use cases for lambda, although much less for =
nested=20
scopes since they are a relatively recent addition to the language. =
</DIV>
<DIV><BR>If you want to learn more on functional programming, David =
Mertz has 3=20
articles about it in the IBM developer works site. Just google for=20
them.<BR><BR>With my best regards<BR>G. Rodrigues</DIV></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Daztech1200@yahoo.com =
href=3D"mailto:aztech1200@yahoo.com">Aztech=20
  Guy</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A title=3Dtutor@python.org =

  href=3D"mailto:tutor@python.org">tutor@python.org</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, January 03, 2003 =
9:44=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Tutor] =
Applications/examples of=20
  some advanced Py features, please !</DIV>
  <DIV><BR></DIV>
  <P>&nbsp;</P>
  <P>Hi Python gurus,</P>
  <P>Can anyone please give some examples /&nbsp;applications of the use =
of the=20
  following advanced (advanced to me, at least :-) features of Python =
:</P>
  <P>1. lambda</P>
  <P>2. nested functions -&nbsp;a little info was given by Danny in =
reply to my=20
  earlier post on local-static variables, but I would like =
more.</P></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <P>3. Thoughts on implementing Interfaces in Py - a la Java=20
interfaces.</P></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <P>I am, and will be doing more, on reading the docs and googling for =
this,=20
  but would anyway appreciate inputs from those who know this stuff.</P>
  <P>I have a specific reason for the above questions- apart from =
general=20
  interest, of course -&gt; I am planning to write a game-playing =
program in Py=20
  which will have features somewhat AI - ish. I don't have any =
background in AI;=20
  nor much in functional programming. I do understand recursion though. =
I=20
  suspect that some of the above 3 points will help me to write my app =
in a=20
  better way. though not sure, of course. Hence the request for =
examples.</P>
  <P>For all of the above 3 points, I'm interested in :</P>
  <P>&nbsp;- code examples of their use</P>
  <P>&nbsp;- in what way their use makes code simpler, or maybe makes =
code=20
  possible that could not be written otherwise ('possible' in practical =
terms -=20
  I'm - vaguely - aware of the fact that all languages are supposed to =
be=20
  theoretically 'Turing-equivalent' or some such term - but what I mean =
is that=20
  if something is going to take a huge amount more code in some other =
language,=20
  or jumping through hoops, then I don't call it practically=20
equivalent).</P></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <P>Thanks !</P>
  <P>Az</P></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_001A_01C2B410.49B68510--