[Tutor] Learning a Language

Michael Langford mlangford.cs03 at gtalumni.org
Sun Sep 23 19:59:56 CEST 2007


First off, please don't pick a random message and reply to it. Please send
an email directly to tutor at python.org if you have a new conversation topic.
Some people's mail readers group emails together by what email you hit reply
on, so it will put your email with messages it doesn't really belong with.

That said: You're in luck, python is PERFECT for you. Javascript is quite a
bit harder than python to do, especially for many sorts of project. I'd also
say python has a lower barrier to entry than Java as well.

I'm primarily a programmer, so I used Dive into Python to get started (4
years ago). Now this is a short PDF for programmers on python, but its still
a good, short intro to people who aren't. http://www.diveintopython.org

I've also went through some of "Learning Python". A new edition is coming
out in about 10 days, and I'd suggest you'd get it and go through the
exercises. Don't read them, actually type them in (don't copy and paste),
and then fiddle with them to do something different with them. My wife (who
does marketing for a living, and doesn't program except for the occasional
VBA script) is starting this book (using the old one until the new one comes
in): http://snipurl.com/learningpython

Another approach, one that I use from time to time to pick up a topic, is to
snarf down the course exercises of a college course that is posted on the
web. For instance, Georgia Tech's intro to programming course is on the web
for all to see at:
http://www-static.cc.gatech.edu/classes/AY2008/cs1301_fall/homework.html

It may be easier to go through a past semester (as it will have all the
homeworks up there for you to do):
http://www-static.cc.gatech.edu/classes/AY2007/cs1301_spring/

One nice thing about going through the course work is that they're trying to
teach programming, and just happen to be using python. That approach means
you'll get the most important, general skills out of it. (That course or
harder ones is required for all undergrads at that institution, so I expect
you'll be able to do its coursework).

     --Michael

-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.TierOneDesign.com/
Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com

On 9/23/07, Daniel Kavic <macsareback at mac.com> wrote:
>
> Ok I have been a multimedia major for a few years now. I have tried
> javascript and that was bad, Java is just too difficult, so I joined
> this mailing list a while back. I have been frustrated because I just
> don't get entirely how OOProgramming works and how to actually write
> the stuff correctly. I have a hard time programming and I wish I
> could be better at knowing at least one language. I need a really
> good book or something to explain this to me. I am not the best in math
> On Sep 22, 2007, at 12:46 PM, Kent Johnson wrote:
>
> > Ricardo Aráoz wrote:
> >> Kent Johnson wrote:
> >
> >>> What version of Python are you using? When I try this program it
> >>> prints
> >>
> >> Py 0.9.5
> >> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
> >> (Intel)] on win32
> >>
> >> I thought it might be you were trying the class with the list init
> >> call
> >> but I tried it and works the same way.
> >> Was using PyAlaMode, tried it using IDLE and it works like yours,
> >> probably a bug of PyAlaMode.
> >
> > My guess is PyAlaMode is trying to introspect the objects in some way
> > and that is causing the extra access (to non-existent attributes).
> >
> >>> class CallCounter(object):
> >>>      def __init__(self, delegate):
> >>>          self._delegate = delegate
> >>>          self.calls = 0
> >>>      def __getattr__(self, name):
> >>>          value = getattr(self._delegate, name)
> >>>          if callable(value):
> >>>              self.calls += 1
> >>>          return value
> >>>
> >>> a = CallCounter(list())
> >>
> >> Sadly :
> >>>>> a = CallCounter(list())
> >>>>> a.append(1)
> >>>>> a.calls
> >> 2
> >>>>> a.append(2)
> >>>>> a.append(3)
> >>>>> a.calls
> >> 5
> >>>>> a[3]
> >>
> >> Traceback (most recent call last):
> >>   File "<pyshell#15>", line 1, in <module>
> >>     a[3]
> >> TypeError: 'CallCounter' object is unindexable
> >
> > Hmm. The problem is that new-style classes don't look up special
> > methods
> > on instances, just in the class itself.
> >
> > There is some discussion here, it looks a bit ugly:
> > http://groups.google.com/group/comp.lang.python/browse_thread/
> > thread/c5bb6496970b5c5a?hl=en&tvc=2
> > Alex Martelli's second response proposes a solution that overrides
> > __new__() to create a custom class for each wrapper.
> >
> > There might be some help here too, I haven't read it closely:
> > http://tinyurl.com/25lx5t
> >
> > The code works if CallCounter is an old-style class.
> >
> > Kent
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070923/df106d08/attachment.htm 


More information about the Tutor mailing list