Re: C pointers/Python

2005-03-21 Thread Marcin Mika
agreed.
you might say i was trying to translate his C code "word for word",
rather than properly "pythonizing" the entire chunk of code as a whole.

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


Re: C pointers/Python

2005-03-21 Thread Marcin Mika

> Can i do something like this?
>
> if code == CODE1:
> data = 0x0
> While True:
>  len = len - 1
>  if len == -1:
>  break
>  buffer = data

certainly not!
there are many things wrong with that.
first of all, as was pointed out already: this is highly un-pythonic.
secondly, its completely wrong. if you bind 'buffer' to another object,
then you have no chance of modifying its original contents. thats why i
stated in my previous post that IF you insist on persuing the
"un-pythonic" path then your function argument 'buffer' _must_ be a
mutable object which you must operate on through its methods, but you
CANNOT modify it with: buffer=data.
doing that will only re-bind 'buffer', it will never change anything
outside the function.

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


Re: Python for a 10-14 years old?

2005-03-23 Thread Marcin Mika
you may want to introduce her to programming competitions, which will
provide her with a very strong foundation of algorithm design and
programming techniques.
http://oldweb.uwp.edu/academic/mathematics/usaco/


> I am blessed with a *very* gifted nine-years old daughter for whom I
> have recently installed an old GNU/Linux Mandrake 7.2 on an equally
old
> Pentium Pro box.  She is enjoying it tremendously and has no problems
> understanding simple desktop operations and the file system basics
> (Needless to say - she has already mastered the 30 or so games I
> installed for her).
>
> Now, I would like to teach her programming basics using Python
(because
> I believe it is best suited for this purpose and, yes, also because
it
> is my favorite language).  The only tutorial I have found so far is
> "How to Think Like a Computer Scientist - Learning with Python"
which,
> while very good indeed, is geared towards adult newbie students.
>
> Is there something out there like "Python for kids" which would
explain
> *basic* programming concepts in a way which is accessible and
> entertaining for kids aged 10-14 (that about where her brain is right
> now) and which would allow them to "play around" and have fun solving
> small problems?
> 
> Many thanks in advance,
> 
> TN

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