Re: Combing Medusa's Hair... (Design Pattern)

2010-12-14 Thread kirby urner
On Tue, Dec 14, 2010 at 8:10 PM, Kushal Kumaran
kushal.kumaran+pyt...@gmail.com wrote:

 snip 


 In this design pattern, you have something like a dry cleaner's,
 where people submit jobs at the counter, and go away right
 away with a ticket (Python returns -- but keeps running).  When
 they come back is more up to them.  Work has been done in
 the meantime (or not, if the queue is backed up).


 Isn't this the way people use queuing systems (ActiveMQ and the like)?
  Or simply multiprocessing + Queue.

 --
 regards,
 kushal


Yeah, that's probably right.  This is more like a pedagogical
metaphor, a mnemonic.  As the name for a design pattern,
it should probably be confined to Python examples, as that's
where the wordplay on Medusa makes some sense, and
not just because her hair was all snakes.

http://bytes.com/topic/python/answers/26771-twisted-medusa-zope

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Packages at Python.org

2010-12-01 Thread kirby urner
Good to hear from you sir.

I've enjoying working with your modules and am getting some good results.

I sent you a note off-list wondering how actively you might be supporting
this valuable utility.

Encouraging to find you here so quickly.

Kirby


On Wed, Dec 1, 2010 at 2:32 PM, Ethan Furman et...@stoneleaf.us wrote:

 kirby.ur...@gmail.com wrote:


 With Microsoft abandoning Visual FoxPro come 2015, we have 100K
 developers
 jumping ship (rough guess), perhaps to dot NET, but not necessarily.**

 This page is potentially getting a lot of hits (I'm not privy to the
 analytics):

 http://packages.python.org/dbf/


 The dbf package does not yet support index files.  Normal indexes won't be
 too hard to add in, but I have been unable to find the algorithms used to
 create/work with compact index files.

 Does anybody know where I might find those?

 ~Ethan~  (author of said package)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] [ANNC] pynguin-0.7 (python turtle graphics application)

2010-04-11 Thread kirby urner
2010/4/11 Lee Harr miss...@hotmail.com:

 Pynguin is a python-based turtle graphics application.
     It combines an editor, interactive interpreter, and
     graphics display area.


I like the idea of using turtles to plot graphs.  Replacing graphing
calculators with Python is easier when there are simple plot functions
available (yes, I know about matplotlib, Sage...)

Curious how much of the Standard Library turtle model gets used here.
Is the turtle stuff all rewritten from scratch.

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] odd drawing problem with turtle.py

2010-02-01 Thread kirby urner
On Mon, Feb 1, 2010 at 3:27 AM, Brian Blais bbl...@bryant.edu wro


 I don't see where you've defined a Turtle class to instantiate sir.


 Turtle is given in turtle.py.  I should have subclassed it, but I was being
 lazy.  :)

 thanks for the fast replies!




 bb





No obvious need to subclass.

You weren't being lazy, I was being sloppy.

I'm glad Vern caught my error right away.

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] odd drawing problem with turtle.py

2010-01-31 Thread kirby urner
I don't see where you've defined a Turtle class to instantiate sir.

Perhaps rename Circle to Turtle and rewrite the circle-drawing expression as:

 c=Turtle(randint(-350,350),randint(-250,250),10,red)

You are making progress with a wrapper class for the Standard Library turtle.

That's a well-known design pattern and a good way to get extra features
sometimes.

Kirby

On Sun, Jan 31, 2010 at 4:27 PM, Brian Blais bbl...@bryant.edu wrote:
 I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 - 24. 9.
 2009.  The following script draws 5 circles, which it is supposed to, but
 then doesn't draw the second turtle which is supposed to simply move
 forward.  Any ideas?
 from turtle import *
 from numpy.random import randint
 resetscreen()
 class Circle(object):
     def __init__(self,x,y,r,color):
         self.x=x
         self.y=y
         self.r=r
         self.color=color

         self.turtle=Turtle(visible=False)
         self.turtle.tracer(False)
         self.draw()

     def draw(self):
         self.turtle.penup()
         self.turtle.setposition(self.x,self.y)
         self.turtle.setheading(0)
         self.turtle.backward(self.r)
         self.turtle.pendown()
         self.turtle.fill(True)
         self.turtle.pencolor(black)
         self.turtle.fillcolor(self.color)
         self.turtle.circle(self.r)
         self.turtle.fill(False)
         self.turtle.penup()

 for i in range(5):
     c=Circle(randint(-350,350),randint(-250,250),10,red)


 T=Turtle()
 T.forward(100)
 T.forward(100)







 thanks,

 bb
 --
 Brian Blais
 bbl...@bryant.edu
 http://web.bryant.edu/~bblais
 http://bblais.blogspot.com/



 ___
 Edu-sig mailing list
 edu-...@python.org
 http://mail.python.org/mailman/listinfo/edu-sig


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] odd drawing problem with turtle.py

2010-01-31 Thread kirby urner
On Sun, Jan 31, 2010 at 8:07 PM, Vern Ceder vce...@canterburyschool.org wrote:
 kirby urner wrote:

 I don't see where you've defined a Turtle class to instantiate sir.

 The Turtle class is part of the turtle library, so that's not an issue.


Hey, good point Vern, not firing on all cylinders over here.

So I just commented out the Circle loop, went straight to the Turtle
part at the end.

It works OK for me, even without the visible=True.

I'm on Python 2.6 on Win7 and I took out the numpy randint in favor of
random randint.

turtle.py in lib_tk:  # Version 1.0.1 - 24. 9. 2009

I'm maybe not the right beta tester though, as after I uncomment the
circle loop, I just get an hour-glass on my Tk canvas and no drawing,
no error message either, even with visible=True in the init.

Not sure what that's about yet...

Hey, I just found out about piratepad.net, another shared white board solution.
Was helping a dude in Indonesia debug a VPython script just a moment ago,
with variable names in Indonesian (Latin-1 spellings at least).

I've appended what we're working on.

[ on second thought, I'll spare ya ]

Kirby
        self.turtle=Turtle(visible=False)

Does visibility *and* pen need to be controlled?  Sorry for
the basic question, but seems if pen is up...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] some turtle questions

2010-01-25 Thread kirby urner
Hi Brian --

If you wanna go to a lot of work, but not a huge amount, write wrapper class
for the Standard Library turtle that intercepts its commands and updates an
on-board data structure, representing pixels x pixels, specifying self
position, keep color info stashed per each one.  That's a lot of data,
depending on screen resolution.  Consider a thick line option if you have
one, make your turtle wide body.  Or stay with thin.

So then if you go turtle.forward(10) you will send it to your self-made
forward method.  Stop and smell the pixels, see what color was stashed
there, either by another turtle (! -- shared data structure) or by this
turtle, or maybe it's still the default untrammeled color.

You can add new methods, like glide or explode that translate to the
underlying turtle somehow -- use your imagination.

Kirby



On Sun, Jan 24, 2010 at 7:29 AM, Brian Blais bbl...@bryant.edu wrote:

 Hello,

 I am trying to think of things to do with the turtle module with my
 students, and I have some ideas where I am not sure whether the turtle
 module can do it.

 1) is there a way to determine the current screen pixel color?  I am
 thinking about having the turtle go forward until it reaches an object, say
 a red circle.  I can probably do this by making circle objects (drawn with
 turtles themselves) which know their own position, and check against this
 info.  But I thought it might be useful also for the turtle to know.

 2) is there a way to put a limit on the extent the turtle can travel?  it
 seems I can keep moving off of the screen.  Is there a way to make it so
 that a forward(50) command, at the edge, either raises an exception (at the
 wall) or simply doesn't move the turtle because of the limit?


 thanks!


 bb

  --
 Brian Blais
 bbl...@bryant.edu
 http://web.bryant.edu/~bblais
 http://bblais.blogspot.com/




 ___
 Edu-sig mailing list
 edu-...@python.org
 http://mail.python.org/mailman/listinfo/edu-sig


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] teaching python using turtle module

2009-12-01 Thread kirby urner
Gregor FYI:

You'll find me linking to one Gregor in Vienna in this blog post, just
beneath an archival photo of work by Alexander Graham Bell.[1]

http://worldgame.blogspot.com/2009/12/meeting-with-sam.html

... providing more context and spin for this rhombic triancontahedron
thread, all that much strong thanks to you.

Kirby

[1] Eber, Dorothy Harley. Genius At Work. about AGB is one of my fave
syllabus entries, obscure and fun.

On Mon, Nov 30, 2009 at 4:52 PM, kirby urner kirby.ur...@gmail.com wrote:
 On Mon, Nov 30, 2009 at 4:31 PM, Gregor Lingl gregor.li...@aon.at wrote:

  fascinating code 


 Hoping, you will find this a bit interesting,
 best regards

 Gregor


 Really enlightening, both mathematically and from a coding point of
 view.  I hadn't used turtle.py enough yet to know about the built-in
 context turtle if you want to just say forward and forgo
 specifying a target.  That's a nice Logo-ish touch.

 Your take on the T is most excellent.

 With your permission, I'd be happy to add both versions with
 attribution to my online version of tmod.py for the benefit of future
 students, and/or I could simply link to this post in the edu-sig
 archives (why not both?).

 Kirby


 --
 from mars import math
 http://www.wikieducator.org/Digital_Math




-- 
 from mars import math
http://www.wikieducator.org/Digital_Math
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] teaching python using turtle module

2009-11-30 Thread kirby urner
I'm glad turtle graphics intersected my thinking re extended precision
decimals (Decimal type) on edu-sig just now.

I've updated my tmods.py to contain a turtle rendering the plane-net of a T-mod:

http://www.4dsolutions.net/ocn/python/tmod.py (runnable source)
http://www.flickr.com/photos/17157...@n00/4147429781/  (GUI view)

Here's the graphical output:

http://www.flickr.com/photos/17157...@n00/4148139184/in/photostream/
(Python 3.1)

If you actually wanna fold the T, you need to snip off the cap and
reverse it, per this diagram:

http://www.rwgrayprojects.com/synergetics/s09/figs/f86515.html

120 of them, 60 folded left, 60 folded right, all of volume 1/24, make
the volume 5 rhombic triacontahedron.

http://www.rwgrayprojects.com/synergetics/s09/figs/f86419.html

If you blow up the volume by 3/2, to 7.5, the radius becomes phi /
sqrt(2) -- what we're showing with Decimals.

The reason this seems unfamiliar is the unit of volume is the
tetrahedron formed by any four equi-radiused balls in inter-tangency.

I'm spinning this as Martian Math these days, yakking on
math-thinking-l about it, learned it from Bucky Fuller, Dave Koski et
al.

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] teaching python using turtle module

2009-11-30 Thread kirby urner
On Mon, Nov 30, 2009 at 4:31 PM, Gregor Lingl gregor.li...@aon.at wrote:

 fascinating code 


 Hoping, you will find this a bit interesting,
 best regards

 Gregor


Really enlightening, both mathematically and from a coding point of
view.  I hadn't used turtle.py enough yet to know about the built-in
context turtle if you want to just say forward and forgo
specifying a target.  That's a nice Logo-ish touch.

Your take on the T is most excellent.

With your permission, I'd be happy to add both versions with
attribution to my online version of tmod.py for the benefit of future
students, and/or I could simply link to this post in the edu-sig
archives (why not both?).

Kirby


-- 
 from mars import math
http://www.wikieducator.org/Digital_Math
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] teaching python using turtle module

2009-11-29 Thread kirby urner
On Sun, Nov 29, 2009 at 2:51 PM, Edward Cherlin echer...@gmail.com wrote:

 snip 

 Drunkard's Walk.


If our think tank (isepp.org) could have gotten permission, we'd have
used that Monopoly guy (looks kinda like Planters peanut guy) randomly
walking on like some chess board with a lamp post (reminds of Narnia).
 We don't have that kind of dough though, so just do this conceptually
(conceptual art).

 Are there any other situations, using turtle, that these
 structures would be natural?

 Recent versions of TA contain stack instructions: push, pop, read,
 clear. Your students might find it interesting to program Forth
 instructions in TA or Python. This has practical applications in
 implementing and porting virtual machines such as Parrot and the VMs
 in Smalltalk and I-APL.

 There is plenty more where this came from. You would also be welcome
 to adapt the Python source code for TA tiles to your environment.


I recall Alan Kay communicating Seymour Papert's sense that having an
explicit receiver was an OK development.  What he meant by that, in
Smalltalk terms, is that the original Logo had what I'd call a
context turtle in that FORWARD or RIGHT were w/r to a given Turtle
one didn't need to mention explicitly, like what else could one mean?

With Python and other object oriented implementations, one first gives
birth to a turtle, creates an instance, as in:

 someturtle = Turtle()

That's binding a name to a turtle object (giving some turtle object a
name) and then controlling said turtle through the API using dot
notation against the name, e.g. someturtle.forward(10) or
someturtle.right(90).

What you get from this is, of course, the possibility of multiple
turtles, each with its own pen color, visibility, other properties of
self-hood.

This gets showcased in the default demo (in Windows, just double click
on turtle.py in the Lib subdirectory):
http://www.flickr.com/photos/17157...@n00/4145780784/
(using Gregor's 3.1 code just minutes ago)

IronPython also has access to the .NET turtle library:
http://www.flickr.com/photos/mfoord/3104991233/
(not my computer)

I suppose I'm only bringing this up to (a) name drop about being in a
meeting with Alan Kay (with Guido and Mark Shuttleworth among others)
and (b) to remind readers that Logo and turtle art, or the art of
programming with turtles, are orthogonal axes.

Logo as a language has also been extended considerably, as has the
richness of the environment.  Some of these are commercial,
proprietary offerings.

Some of these feature spatial turtles in a turtle tank i.e. each
turtle is more like a biplane in a WWI dogfight (Snoopy vs. Red
Baron), with all those extra degrees of freedom (roll, pitch, yaw).

Python's turtle module is not, repeat not, an implementation of Logo
in the Python language.  It's an implementation of turtle graphics on
a Tk canvas in the Python language.

You'll also find a turtle module in wxPython such as in PythonCard by
Kevin Altis.
http://pythoncard.sourceforge.net/samples/turtle.html

I think Gregor is right to see turtle.py as an easy way to implement
an Objects First approach, consistent with a more generic approach to
math concepts (vectors, polynomials, polyhedra) as objects (types),
extending the OO rubric.

We teach maths as extensible type systems that advance through the
invention of new types, not just as systems evolving through a
progression of proved theorems from fixed axioms.

Kirby


 thanks,
 Brian Blais
 --
 Brian Blais
 bbl...@bryant.edu
 http://web.bryant.edu/~bblais



 ___
 Edu-sig mailing list
 edu-...@python.org
 http://mail.python.org/mailman/listinfo/edu-sig





 --
 Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
 Silent Thunder is my name, and Children are my nation.
 The Cosmos is my dwelling place, the Truth my destination.
 http://www.earthtreasury.org/
 ___
 Edu-sig mailing list
 edu-...@python.org
 http://mail.python.org/mailman/listinfo/edu-sig




-- 
 from mars import math
http://www.wikieducator.org/Martian_Math
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question: if var1 == var2:

2008-11-29 Thread kirby urner
It's the  newline after each word that's messing you up.

var = tree\n
...

or

if item.strip() == var:
...

etc.

Kirby

On Fri, Nov 28, 2008 at 7:47 PM,  [EMAIL PROTECTED] wrote:
 Hi All,

 I dont understand why the following code never finds tree.
 I could not find the answer in the Python tutorials.
 Here is the code, test43.in, and runtime:

 #!/usr/bin/python

 fname = open(test43.in)
 var = 'tree'

 for item in fname:
print item: , item,
if item == var:
print found tree: , item,
 [EMAIL PROTECTED] work]$
 [EMAIL PROTECTED] work]$
 [EMAIL PROTECTED] work]$ cat test43.in
 car
 tree
 house
 pool
 dog
 cat
 wax
 candy bar
 [EMAIL PROTECTED] work]$ python test43.py
 item:  car
 item:  tree
 item:  house
 item:  pool
 item:  dog
 item:  cat
 item:  wax
 item:  candy bar

 Thanks, [EMAIL PROTECTED]

 --
 http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html

--
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] do as a keyword

2007-12-12 Thread kirby urner
 I find that when teaching beginning programmers, they usually think in
 until terms, and not while terms.


If really beginning, an overview of this whole idea of control structures
makes sense, such as this wikipedia article:
http://en.wikipedia.org/wiki/Control_flow

Then explain how Python is very minimalist in its approach, unlike
some languages, which try to provide all kinds of control structure
semantics, including multiple case loops (do... case... case...)
which Python famously does not natively have either.

 they find the while logic to be unintuitive, and I often find myself
 feeling the same way: crafting it with the until logic, and then reversing
 it.

I wouldn't make intuitive the guiding light in all cases, as it's
often just code for conditioned reflex or what we're used to.
Usually beginners outgrow their initial discomfort, like when
learning to drive stick instead of automatic or whatever.

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: fclient project seeking co-coders

2007-10-28 Thread kirby urner
Another Urner, that's interesting.  Not many of us.

Kirby Urner
Portland, Oregon
USA


On 10/28/07, Jürgen Urner [EMAIL PROTECTED] wrote:

 Hello all,

 I Just recently registered a project fclient to sourceforge.net
 [http://sourceforge.net/projects/fclient]. fclient is intended to
 become desktop client for the freenet [freenetproject.org]
 network written in python and Qt4.

 fclient is very alpha, in fact only parts of the freenet client
 protocol
 are curently implementated and loads of work ahead. But I would
 appreciate very much finding interested co-coders to take part in the
 project.

 Me, I am no professional coder, but an enthusiast with one or the
 other year
 of python (and Qt) experience. If interested in the project (and
 freenet), feel free
 to drop a mail to the users mailing list at the project page.


 Have fun, Juergen

 --
 http://mail.python.org/mailman/listinfo/python-announce-list

 Support the Python Software Foundation:
 http://www.python.org/psf/donations.html

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: New mailing list mirrors

2007-06-10 Thread kirby urner
Thanks tomer, I joined both through Google.

Kirby moe Urner
4dsolutions.net/ocn/cp4e.html
myspace.com/4dstudios
[EMAIL PROTECTED]

(moe rhymes with Minister of Education was my thinking -- a portfolio
I sometimes grab for a gig, but always put back where I found it).

On 6/10/07, sebulba [EMAIL PROTECTED] wrote:
 Hi all,

 I created two new google groups to mirror the activity of python-dev
 and python-3000:
 * http://groups.google.com/group/python-3000
 * http://groups.google.com/group/python-dev2

 There are many mirrors out there, but none of them lets you post
 to a thread. With google groups you can just hit reply on the
 message you want to reply to, and that's it. No need to send an
 email to the group (although you still need to register your email
 with python mailing list).

 Supports searching, tree-view, list-view, fixed/proportional font,
 tracking
 of read/unread messages, etc. Enjoy.


 -tomer

 --
 http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread kirby urner
 questions about others' experience 

 Is it no big deal either way?


thanks,

Brian Blais

Hi Brian --

Lego Mindstorms is popular in my neck of the woods
(Silicon Forest -- Oregon), starting in middle school.
I helped coach a team a few years ago.  There's a
tournament aspect, with the teams coming together
around challenges.  I frankly don't know if nqc is a
permitted option -- it might be.

On the Python side, I volunteered one day a week
for about 8 weeks (then for a 2nd 8 weeks, with another
group), teaching Python in a Portland public school
to 8th graders.  I didn't feel they were floundering or
having any real trouble keeping up.  I wasn't focusing
on robotics or controlling an avatar or anything i.e.
this experience was not designed to feed the
Mindstorms teams.

Given the Mindstorms groups tend to be after school,
staffed by volunteer parents, the students attracted
to them tend to be self selected on the basis of prior
experience, self confidance around programming or
whatever.

My daughter has a kit since Christmas (she's in 7th
grade) but hasn't joined a team because she's protective
of her time, wants to play and do homework.  Plus it's
really only the Sony Aibo she cares about and I've never
been able to afford one (her dad is not a money god
unfortunately).

I haven't pushed hard to teach her Python either, though
I'm hoping she'll guinea pig (or hedge hog) some of my
curriculum materials down the road (we were discussing
that yesterday -- she could start by watching a few of my
screencasts about Python, high rez versions).

I think a typical scenario might be to join a team or
form one, using the usual equipment, including Robolab,
and then finding, within that group, a couple interested
students who might be wanting to try a Linux/Python option.
If you have other parents, they'd be candidate learners.
If you attract some high schoolers, them too.

I think middle school is sort of on the edge of where
you'd start, and it's important to have a dynamic where
the kids step forward at that level, don't feel pressured.
Some type quite well (given all the instant messaging),
others not, and lack of typing skills *is* a barrier to entry.

Depending on the size of your original pool, you may
well catalyze a few promising careers.

The public school I mentioned is currently moving to a
Scratch - Alice track, still with the Mindstorms robotics
option on the side, as an after school activity.

I just talked to the computer teacher yesterday and he
was reporting some rumor that future versions of Alice will
center around the same Sims as in Sims, which my daughter
plays with *a lot* (we also bought Civ City Rome yesterday,
coincidentally, and she built Rome in a day).

Arthur, a long time member of this list, had many strong
reservations about Alice, which tended to become moot
after Alice stopped being written in Python.  I think he
would have preferred like my Saturday Academy class,
where I also teach Python, but using a very bare bones
mathematical approach, no thick layer of someone else's
design (just IDLE + VPython mostly these days, plus
I admit to pre writing some py files -- we don't reinvent all
of mathematics, me neither).  I get a few middle schoolers
in these classes, but only a couple, and usually already
about two standard deviations in the college level direction.

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Edu-sig] minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread kirby urner
On 3/10/07, Andreas Raab [EMAIL PROTECTED] wrote:
 kirby urner wrote:
  I just talked to the computer teacher yesterday and he
  was reporting some rumor that future versions of Alice will
  center around the same Sims as in Sims, which my daughter
  plays with *a lot* (we also bought Civ City Rome yesterday,
  coincidentally, and she built Rome in a day).

 More than rumor apparently:

   http://www.cmu.edu/cmnews/extra/060310_alice.html

 Cheers,
   - Andreas

Hey thanks!  Fowarding to my daughter FYI.

Kirby
-- 
http://mail.python.org/mailman/listinfo/python-list