Re: Is there a concerted effort afoot to improve the Python Wiki?

2009-09-20 Thread kirby
On Sep 20, 5:52 pm, [email protected] wrote:
> I've noticed over the past few weeks a huge increase in the frequency of
> edits in the Python wiki.  Many of those are due to Carl Trachte's work on
> non-English pages about Python.  There are plenty of other pages going under
> the knife as well though.  Is there some community movement people are aware
> of to wrangle the wiki into better shape?
>
> Thanks,
>
> Skip

Yes, as Rami says, there are moves afoot.  I've been working with
Carl, who is no longer with [email protected] -- something of a
hornets nest is you ask me.  We're hoping to go open archive so it's
not such a Chamber of Whispers.

Here's an excerpt from the archive (subscribers only) for your
edificiation.  You'll find more at this Wiki page, which starts with
the PSF version of the Diversity statement, developed independently of
the private Aahz list initiative.

http://wiki.python.org/moin/DiversityStatementDiscussion (I distance
myself from this page, except for the PSF statement, as too punitive
and threatening, also amateurish).

I should put my cards on the table that I'm a "Quaker animist" and
think training monkeys to write "Hello world" in Python might be a
good way to improve user group diversity.


-- Forwarded message --
From: kirby urner 
Date: Tue, Sep 15, 2009 at 11:36 AM
Subject: Fwd: [PSF-Members] All-positive diversity statement
To: [email protected]

<< snip >>

Python is *not* just for humans at the end of the day (that's if you
wanna talk diversity for real).



http://www.youtube.com/watch?v=c2hRrcvxRFE



Not a direct quote from PSF version (polished it some):



==

How about something like:

Diversity Statement:

Python is free and open source and is therefore deliberately placed in
the public commons for all humans to use, other species if they gain
this ability.

If you're a racist, bigoted pig from hell whom nobody loves, and you
choose to use Python, you're welcome.

If anyone says you have no right to use Python, because of all the
evil nonsense you pump out in the world, or because you're
"untouchable"
(for some reason), they're wrong.

You may be in prison for other offenses, but using Python will never
be one of them  Using Python is not a crime.  Just use it.

That being said, the PSF does protect against counterfeits so if you
change the source in any way and try to conceal this, while pretending
you're sharing the "real" Python, expect repercussions.  That's an
offense.  Expect retaliation.





Send your comments, suggestions for revisions directly to
[email protected]

(never mind the error message -- everyone gets those)



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


Re: output from external commands

2005-10-24 Thread darren kirby
quoth the James Colannino:
> Hey everyone.  First off, I'm new to the list.  I had had a little bit
> of experience with Perl before discovering Python.  The more Python I
> learn, the more I love it :)  I just have a quick question to ask.  I
> know that this is probably a simple question, but I've been googling
> around, and partly because I'm not sure exactly what to search for, I've
> been unsuccessful at finding an answer.  What I'd like to do is be able
> to take the output of an external command and assign it as an array of
> strings.  So, for example, in Perl I could do something like:
>
> @files = `ls`;
>
> So I guess I'm looking for something similiar to the backticks in Perl.
> Forgive me if I've asked something that's a bit basic for this list.
> Any help would be greatly appreciated :)  Thanks very much in advance.

If all you want is filenames this will work:
>>> import glob
>>> files = ["%s" % f for f in glob.glob("*")]

Else use os.popen to iterate over lines of output:
>>> import os
>>> for line in os.popen("ls -l").readlines():
>>> . . . process(line)

Or check out subprocess if you have 2.4..

> James
>
> --
> My blog: http://www.crazydrclaw.com/
> My homepage: http://james.colannino.org/

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgpPYTSvHOmSy.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

[OT] Re: output from external commands

2005-10-24 Thread darren kirby
quoth the Fredrik Lundh:
> (using either on the output from glob.glob is just plain silly, of course)

Silly? Sure. os.listdir() is more on point. Never said I was the smartest. 
However, I will defend my post by pointing out that at the time it was the 
only one that actually included code that did what the OP wanted.

Recall I wrote:
"If all you want is filenames this will work:"
not:
"This is how you should do it"

And I invite you to prove me wrong ... it does work.

As a novice, I do appreciate getting set strait when I code something dumb, 
but going off about the efficiency of "%s % foo" over "str(foo)" hardly helps 
the OP, and is not very pertinant to my glob faux pas either. An explanation 
of why glob is silly would perhaps teach me better than just stating it as 
fact. 

It is things like this that make me wary of posting to this list, either to 
help another, or with my own q's. All I  usually want is help with a specific 
problem, not a critique involving  how brain-dead my code is. I'm a beginner, 
of course my code is going to be brain-dead ;)

I thought the idea was "make it work first, then optimize"? In any event, I 
will refrain from trying to help people here until I get over this silly 
stage I seem to be stuck in... it just doesn't seem worth it.

I am not trying to sound like a whiner here, I just wish you experts would go 
easy on us novices...

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgprtsZtFVPaz.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs Linux [was: p2exe using wine/cxoffice]

2005-10-26 Thread darren kirby
quoth the Tim Golden:
> As it happens, (and I suspect I'll have to don my flameproof suit here),
> I prefer the Windows command line to bash/readline for day-to-day use,
> including in Python. Why? Because it does what I can't for the life of
> me get readline to do: you can type the first few letters of a
> previously-entered command and press F8. This brings up (going backwards
>
> with further presses) the last command which starts like that. And
> *then*
> you can just down-arrow to retrieve the commands which followed it.
> If someone can tell me how to do this with bash/readline I will be
> indebted to them and it will increase my chances of switching to Linux
> a bit! (Although not at work where I have no choice!)

Try ctrl-r in bash, then type your first few letters...

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgpWqBHmbFD3S.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

page faults when spawning subprocesses

2005-11-09 Thread Dave Kirby
I am working on a network management program written in python that has
multiple threads (typically 20+) spawning subprocesses which are used
to communicate with other systems on the network.  This runs fine for a
while, but eventually slows down to a crawl.  Running sar shows that
when it is running slowly there is an exceptionally large number of
minor page faults - there are continuously 14000 faults/sec, with a
variation of about +/-100.  There are no pages swapped to disk, these
are purely in-memory faults.

I have a hypothesis about what is happening, but have not been able to
prove or disprove it:
the theory is that when a subprocess is spawned, there is a small
window between the call to fork and the call to exec where the parent's
memory is shared between the two processes.  Linux marks the memory as
copy-on-write, so if the parent process then accesses memory during
that window a minor page fault is generated and the page is copied.
Normally this is not a problem, but with a large number of threads all
spawning subprocesses there is a chance of a another process being
spawned during that window and the whole of memory is copied.  This
slows everything else down so the probability of another collision
increases, and the whole thing snowballs.  This could also happen if
something else tries to write to large areas of memory (maybe the
python garbage collector?).

This is running on a Sun V40 64 bit SMP with Fedora Core 3.   The same
code has been run on intel systems and the problem has not been seen -
this could be because the problem is specific to that hardware or
because the intel systems are not fast enough for a collision to occur.

My questions are:

1) is the theory plausible/likely?

2) what could I do to prove/disprove it?

3) has anyone else seen this problem?

4) are there any other situations that could be causing a continuous
stream of minor page faults?

5) WTF can I do about it?

Dave Kirby
   (dave.x.kirby at
gmail dot
com)

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


exception KeyboardInterrupt and os.system command

2005-11-27 Thread darren kirby
Hello all.

I have a python script here which is just a wrapper for 2 or more system 
commands. I would estimate the program spends at least 95.5% of 'real' time 
running the system commands.

I want to trap the [crtl-c] key combo and exit (somewhat) gracefully if the 
user decides to abort the program. I am using os.system for the system call, 
and I have wrapped the entire main loop in a try: except KeyboardInterrupt 
statement to try to attain these ends.

As it is though, if the program is currently in the system command, only that 
system command is terminated, and the next loop of my program starts.

Is there a way to make this work? ie: terminate the entire script? Will popen 
do this? I don't really want to use popen because all I need is for the 
system command to run, and check the exit status. Also, popen will pooch the 
output of the system commands (which I want to be printed to the console) 
because the system commands (faad, mpg123, and oggenc) have buffered output 
which won't properly be displayed if I simply print each line of the file 
object returned by popen. 

I don't want to use subprocess because I can't expect my users to have 2.4 
installed...

OS is Linux, if it matters.

If you need to see the code it is here:
http://badcomputer.org/unix/dir2ogg/dir2ogg.bot

Although, this code is the program as it stands, not the code I am testing.

Thanks,
-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgpBKWYaruFLt.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: exception KeyboardInterrupt and os.system command

2005-11-28 Thread darren kirby
Thanks for the tips everyone, although it turns out this is not a python 
problem at all. After several tests with mpg123 both direct on the cli, and 
wrapped in an os.system() call, I see it is _always_ returning 0 exit status 
whether I interrupt it or not. I went to the mpg123 website to see if I could 
find a reason for this behavior, and the site tells me the package is 
unmaintained, and has security flaws which will not be fixed.

So I guess I will find a new mp3 decoder...

-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgprr1YweK46i.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Favorite flavor of Linux? (for python or anything else)

2005-12-04 Thread darren kirby
quoth the Mike Meyer:
> A lot of the
> rough edges of Gentoo have been dealt with in FreeBSD. For instance,
> you can update from source, but you can also get binary updates.

You can sort of do this with Gentoo. Check out the "--usepkg", "--getbinpkg" 
and "--buildpkg" emerge options. The only problem is that I don't think there 
are many (any?) official repositories of binary packages, and if there are, 
they don't have the full array of all packages available from portage. I 
haven't checked in a while though, so this may be different now.

In any event, it is an excellant timesaver if you have a network of similar 
systems. emerge from source on your staging server, build a bin package, and 
push it to the rest of the systems.

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org/
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgprAoS9mLaTO.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Challenge ahead [NEW] for riddle lovers

2005-04-29 Thread darren kirby
quoth the Shane Hathaway:
> pythonchallenge wrote:
> > For the riddles' lovers among you, you are most invited to take part
> > in the Python Challenge, the first python programming riddle on the net.
> >
> > You are invited to take part in it at:
> > http://www.pythonchallenge.com
>
> That was pretty fun.  Good for a Friday.  Too bad it comes to an abrupt
> "temporary end".
>
> Shane
>
> P.S. I hope I didn't hammer your server on step 3.  I was missing the
> mark. :-)

You're not the only one. This is where I am currently stuck. It's starting to 
hurt my head.

There are 478 results in the form *BBBsBBB* but the thing said 'exactly' 
right, well there are 10 results in the form *sBBBsBBBs*
None of them seem to work...

I quit ;)
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgpi12dSB8kSg.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Twisted vs POS (Plain-old sockets)

2006-09-03 Thread Darren Kirby
Hey all,I have a (FOSS) project here that I am about to start that requires TCP networking support, and in fact, will require me to design and implement a (text based) protocol from scratch.I have been playing with Twisted today and managed to get a simple 
client/server talking to each other. However, the twisted framework does seem very complex, and includes many, many, features I will never need. The docs seem a little lacking (or perhaps just confusing) as well. Twisted's good 
points are that it will save me from having to write many things from scratch, asynchronous networking being the biggie.I guess I am wondering if given the fact I need a custom protocol, and need to talk TCP/IP should I stick with twisted or just use plain old sockets and 
build it myself? Is there a third option I should consider? Have others found themselves in this situation? Thoughts? Comments? I am really just fishing for opinions here...If it makes a difference: Depending on performance parts of this app may well 
end up as a prototype for a final (...alternative?) C++ implementation.Thanks for consideration, -d-- darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Twisted vs POS (Plain-old sockets)

2006-09-04 Thread Darren Kirby
On 9/3/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On Sun, 3 Sep 2006 00:19:17 -0700, Darren Kirby <[EMAIL PROTECTED]> wrote:
> >Hey all,
> >
> >I have a (FOSS) project here that I am about to start that requires TCP
> >networking support, and in fact, will require me to design and implement a
> >(text based) protocol from scratch.
>
> I'm sorry.

Don't be sorry, I am doing this for fun and to learn...

>
> If there are features you don't need, then don't use them.  What does their
> existence cost you?  Are you going to use the sunaudio module from the
> standard library?  If not, is this an argument in favor of using C++ instead
> of Python?

Well, the question I have is if it is worth digging through all the
complexity (in the code itself and docs) for the few nuggets I do
need... I am well aware I do not need to use everything...

> As for documentation, many people say it is lacking, but perhaps one person
> in a thousand points out _how_ or _where_ it is lacking.  Unfortunately it
> is difficult to improve things (or even determine if they really are lacking)
> with this level of feedback.

I am certainly not trying to dump on twisted. As for what is lacking,
the many methods I looked up that say simply "Not Documented" would be
the biggest problem

> Keep in mind that in addition to the online documentation, there is a Twisted
> book, an extremely helpful twisted mailing list (with years of archives
> online), and an IRC channel populated at nearly all hours of the day with
> people who can answer Twisted questions.

I am aware of the book, and if I decide to go the twisted route I
would certainly purchase it. However, not that I am overly swayed by
amazon reviews, but the consistent majority of them have said that the
book is big on specifics (as in, explaining the example code and not
much else), and small on the 'big-picture' so to speak. If this is
true I might as well stay with the docs.

>
> Talking to the TCP/IP stack is surprisingly difficult to get right.  Since
> it is extremely unlikely that you actually _care_ about all of the random,
> stupid differences between different TCP implementations, you should use
> Twisted, since it does its best to hide these differences and instead
> present a uniform API.

Fair enough...

> If you use bare sockets, you will need to learn many of these quirks yourself,
> frequently through a bug report from a user, since many of them are
> undocumented.

True, though keep in mind this is as much of a learning exercise for
me as it is to get an app out the door quick.

>
> Twisted is great.  It will speed up your development time and reduce the
> amount of defects you need to deal with.  It will
>

OK, I will stick with twisted and see if I can't figure it out, and
perhaps play with asyncore and see for myself what will work. Please
note I was really just looking for some anecdotes from experienced
programmers that may have found themselves in my situation, and the
solutions they chose...

> Hope this helps,

Sure it did, thanks for taking the time to respond, also thanks to
Guido and Istvan,

> Jean-Paul

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stock quotes

2006-09-14 Thread Darren Kirby
On 9/13/06, Donlingerfelt <[EMAIL PROTECTED]> wrote:
> I would like to download stock quotes from the web, store them, do
> calculations and sort the results.  However I am fairly new and don't have a
> clue how to parse the results of a web page download.   I can get to the
> site, but do not know how to request the certain data  need.  Does anyone
> know how to do this?  I would really appreciate it.  Thanks.

Some have already directed to webscraping tools, but you don't need to
go that route if you can settle for using finance.yahoo.com, as you
can ask for the data in a particular format ie: plain text, csv etc...

I have also written some code that does this. As an added bonus it
also does currency conversion. Maybe the code will help get you
started:
http://badcomputer.org/unix/code/stock.html

HTH
-d
-- 
http://badcomputer.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread darren kirby
quoth the Ganesan Rajagopal:
> I am stuck on level 3. I've tried every re that I can think of. Some body
> give me a clue.
>
> Ganesan
>
> --
> Ganesan Rajagopal

>>> t = /text of page source.../
>>> re.findall('[a-z][A-Z]{3}[a-z]{1}[A-Z]{3}[a-z]', t)

You should get ten results. Consider all ten together to get your solution...

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgp8pPHoyZC6s.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread darren kirby
quoth the Reinhold Birkenfeld:

>
> Somehow writing '[a-z]{1}' is strange...
>
> Reinhold

>>> t = /text of page source.../
>>> re.findall('[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]', t)

Sorry dude! When it comes to logic puzzles I am easily frustrated, and that 
leads to unclear thinking...

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgppGkifujJIs.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Language documentation ( was Re: Computing Industry shams)

2005-05-10 Thread Lawrence Kirby
On Tue, 10 May 2005 04:58:48 -0700, alex goldman wrote:

> Sean Burke wrote:

...

>> No, you're just confused about the optimization metric.
>> In regexes, "greedy" match optimizes for the longest match,
>> not the fastest.
>> 
>> And this is common regex terminology - man perlre and you will
>> find discussion of "greedy" vs. "stingy" matching.
> 
> Read what you quoted again. Everyone (Xah, vermicule, myself) was talking
> about "greedy" as it's used in graph search and optimization algorithms.

However the original quote was in the context of regular expressions, so
discussion of the terminology used in regular expressions is far more
relevant than the terminology used in graph search and optimisation
algorithms.

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


Re: Language documentation ( was Re: Computing Industry shams)

2005-05-10 Thread Lawrence Kirby
On Tue, 10 May 2005 06:52:18 -0700, alex goldman wrote:

> Lawrence Kirby wrote:

...

>> However the original quote was in the context of regular expressions, so
>> discussion of the terminology used in regular expressions is far more
>> relevant than the terminology used in graph search and optimisation
>> algorithms.
> 
> I replied to "And from memory, that is the sort of thing done in Computing
> 101 and in  Data Structures and Algorithms 101", and I fully explained what
> I meant by "greedy" as well. There was no ambiguity.

My response talks about relevance, not ambiguity.

Lawrence

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


Re: Formatting Time

2005-06-03 Thread darren kirby
quoth the Ognjen Bezanov:
> I never thought id need help with such a thing as time formatting
> (admittadly i never did it before) but ok, i guess there is a first for
> everything.
>
> I have a float variable representing seconds, and i want to format it
> like this:
>
> 0:00:00  (h:mm:ss)
>
> Now search as I might i am finding this quite elusive, i had a look at
> the time module but that seems overly complicated for this. Anyone got
> any simple solutions to doing this? cheers!

def printTime(seconds):
hours = seconds / 3600
seconds = seconds - (hours * 3600)
minutes = seconds / 60
seconds = seconds - (minutes * 60)
print "%i:%s:%s" % (hours, str(minutes).zfill(2), str(seconds).zfill(2))

I am certainly no pro at python but this seems to do it for me. I am sure 
someone could write it much more elegantly. I am still a little confused as 
to how you have a float that represents seconds? This will only work if 
'seconds' is an int ( al la ' 44342865') but maybe it could help you?

-d

-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972


pgp6I7q4f3fVW.pgp
Description: PGP signature
-- 
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: Can a low-level programmer learn OOP?

2007-07-14 Thread darren kirby
quoth the Wayne Brehaut:

> (I started with Royal McBee LGP 30 machine language (hex input) in
> 1958, and their ACT IV assembler later! Then FORTRAN IV in 1965. By
> 1967 I too was using (Burroughs) Algol-60, and 10 years later upgraded
> to (DEC-10) Simula-67.)
>
> Going---going---

Mel? Is that you?

http://www.pbm.com/~lindahl/mel.html

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help - python can't find file

2007-05-21 Thread darren kirby
quoth the enquiring mind:

> - but now I get a error message 21 saying file or directory doesn't
> exist.

You must be in the same directory (in konsole) as the python script for this 
to work, else enter the relative path to the file:

Assuming you are in your home directory (this is where a new konsole will 
start you), and the py scripts are in a directory 'pythondir': 

$ cd pythondir
$ python myscript.py

or:

$ python pythondir/myscript.py

You could also chmod the script to be executable and run it as a regular 
command ...however... I don't mean this to sound like RTFM but I do think 
that you could use some reading on Linux CLI usage. You say you have some 
Linux books?

I say this as my reading of your message indicates your problems lie with 
misunderstanding the shell/paths etc, not with Python itself...

-d  
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading (and writing?) audio file tags

2007-05-24 Thread darren kirby
quoth the Paul Moore:
> I'd like to write some scripts to analyze and manipulate my music
> files. The files themselves are in MP3 and FLAC format (mostly MP3,
> but FLAC where I ripped original CDs and wanted a lossless format).
> I've no idea what form of tags are used in the files (ID3v1, ID3v2,
> OGG, APE, ...)

Flac files use Vorbis comments, the same that Ogg Vorbis files use. As for 
MP3, they use ID3v2 or ID3v1, or both.

Anyway, what you want is Mutagen. It handles both Flac and Mp3 tags, as well 
as many others: http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen

> I just used whatever the program that set them up used. 
> I'm completely confused by the various tag formats that exist - there
> seems to be little standardisation, and quite a few compatibility
> pitfalls. For example, I have files with tags using accented
> characters - I suspect that this causes some tools to switch format
> (because I've seen what looked like corrupt data at times, which
> turned out to be the program displaying the "wrong format" of tag).
>
> I've seen various Python libraries that talk about ID3 tag reading -
> but I'm not clear if they read other tag formats (many applications
> which call themselves "ID3 readers" actually handle multiple formats,
> but I don't know if that's true for (Python) libraries. Also, there
> seem to be few libraries that will *write* tags.

ID3 = MP3 only. A lot of people call _all_ tags 'id3' tags to save having to 
say 'Flac tags, and Vorbis tags, and Ape tags' etcthese people are the 
source of your confusion. 

> Is there a good "music file tag handling" library for Python that's
> worth looking at? I use Windows, so it would have to be for that
> platform, and although I have a compiler, I don't really want to spend
> a lot of time collecting and porting/building support libraries, so
> I'd be looking for a binary distribution.

>From the read me: "Mutagen works on Python 2.3+ and has no dependencies 
outside the CPython standard library" so it should work on Windows I think. 
It is just pure Python so there you go...

> In the absence of something suitable, I'll probably go back to dumping
> the tags via a generic "MP3 tag reader" program, then manipulate them
> as a text file, then try to do some sort of bulk reload.
>
> Thanks,
> Paul.

-d

-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PHP5 programmer learning Python

2007-05-27 Thread darren kirby
quoth the romiro:
> Hi all,
...
> Anyway, my first question was if anyone knows of a tutorial that
> focuses on PHP -> Python learning, in such that there might be a block
> of PHP code alongside an example of how to do the same thing in
> Python.  One example of something I've already mapped a comparison to
> thanks to standard tutorials is a PHP numeric indexed array being
> similar to a list and a PHP associative array being similar to a
> dictionary.  Of course finding such of a tutorial isn't a deal breaker
> by any means, but I figured that having it available would be a boon
> for me to actually make some headway in my Python learning adventure.

Not a tutorial, and the code is not alongside each other, but the PLEAC [1] 
website may serve as a decent code comparison between PHP and Python. 
As for a tutorial, if you are already experienced you will probably want to 
check out "Dive into Python. [2]

Have fun,
-d

[1] http://pleac.sourceforge.net/
[2] http://diveintopython.org/toc/index.html

-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


My 'time' module is broken, unsure of cause

2007-08-23 Thread darren kirby
Hi all,

I have a strange error here and I am unsure how to further investigate it:

Python 2.4.4 (#1, Aug 23 2007, 10:51:29)
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
40:42:0
>>> now = time.time()
Traceback (most recent call last):
  File "", line 1, in ?
AttributeError: 'module' object has no attribute 'time'

Notice the '40:42:0' that always gets output. I searched Gentoo's bugzilla but 
can not see anything relevant. I rebuilt python but the behavior recurs. I am 
unsure if the issue is with Python, Gentoo, or perhaps with the underlying 
lib (presumably glibc) that Python uses for the time module. This is working 
fine on another machine (also 2.4.4, GCC 3.4.6,  Gentoo Hardened).

Anyone seen this? Any hints for me to track this issue down? Any further 
information I could provide?

Thanks for consideration,
-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My 'time' module is broken, unsure of cause

2007-08-23 Thread darren kirby
quoth the   Calderone:

>
> [EMAIL PROTECTED]:~$ echo "print '40:42:0'" > time.py
> [EMAIL PROTECTED]:~$ python
> Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import time
>
> 40:42:0
>
> >>> time.time()
>
> Traceback (most recent call last):
>   File "", line 1, in ?
> AttributeError: 'module' object has no attribute 'time'
>
> >>> print time.__file__
>
> time.py
>
> >>> ^D
>
> [EMAIL PROTECTED]:~$ rm time.py
> [EMAIL PROTECTED]:~$ rm time.pyc
> [EMAIL PROTECTED]:~$ python
> Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import time
> >>> time.time()
>
> 1187890226.9293921
>
> >>> print time.__file__
>
> /usr/lib/python2.4/lib-dynload/time.so
>
>
> Jean-Paul

Ahh, so it was pebkac. Thanks Jean-Paul, I can be thick sometimes...

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: passing command line arguments

2007-09-07 Thread darren kirby
quoth the Brian McCann:
> Hi,
>
> when I run the script show_args2.py
>
> # ./show_args2.py 1 2 3
>
> I get the following error
>
> Traceback (most recent call last):
>   File "./show_args2.py", line 4, in ?
> print 'The arguments of %s are "%s"' %s \
> NameError: name 's' is not defined
>
>
> #
> <mailto:[EMAIL PROTECTED]>
> this is the script
>  #!/usr/bin/python
> import sys, string
> print 'The arguments of %s are "%s"' %s \
> (sys.argv[0], string.join(sys.argv[1:]))

You don't want the 's' on the last format operator. Try:

 print 'The arguments of %s are "%s"' % \
 (sys.argv[0], string.join(sys.argv[1:]))

> any help would be greatly appreciated
>
> -Brian

-d
-- 
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
-- 
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


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: [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: 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] teaching python using turtle module

2009-11-29 Thread kirby urner
On Sun, Nov 29, 2009 at 2:51 PM, Edward Cherlin  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
>> [email protected]
>> http://web.bryant.edu/~bblais
>>
>>
>>
>> ___
>> Edu-sig mailing list
>> [email protected]
>> 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
> [email protected]
> 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: [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  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-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  wrote:
> On Mon, Nov 30, 2009 at 4:31 PM, Gregor Lingl  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] 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  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
> [email protected]
> http://web.bryant.edu/~bblais
> http://bblais.blogspot.com/
>
>
>
>
> ___
> Edu-sig mailing list
> [email protected]
> 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
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  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
> [email protected]
> http://web.bryant.edu/~bblais
> http://bblais.blogspot.com/
>
>
>
> ___
> Edu-sig mailing list
> [email protected]
> 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  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] odd drawing problem with turtle.py

2010-02-01 Thread kirby urner
On Mon, Feb 1, 2010 at 3:27 AM, Brian Blais  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: 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  wrote:

> [email protected] 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: Combing Medusa's Hair... (Design Pattern)

2010-12-14 Thread kirby urner
On Tue, Dec 14, 2010 at 8:10 PM, Kushal Kumaran
 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: [Edu-sig] [ANNC] pynguin-0.7 (python turtle graphics application)

2010-04-11 Thread kirby urner
2010/4/11 Lee Harr :
>
> 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