[Tutor] Tutor Digest, Vol 79, Issue 134
Sayth Renshaw
flebber.crue at gmail.com
Sat Sep 25 17:30:28 CEST 2010
I started seting up django. the only issue I am having is that all
instructions seem to assume that I am on linux.Don't suppose there are any
good instructions for those on a windows based system.
On Sat, Sep 25, 2010 at 8:00 PM, <tutor-request at python.org> wrote:
> Send Tutor mailing list submissions to
> tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-request at python.org
>
> You can reach the person managing the list at
> tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
> 1. Re: pure function problem (Dave Angel)
> 2. Re: pure function problem (Roelof Wobben)
> 3. Re: Plotting a Linear Equation (kb1pkl at aim.com)
> 4. Re: list.append(x) but at a specific 'i' (Norman Khine)
> 5. Python And reading the Web - Javascript (Sayth Renshaw)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 24 Sep 2010 06:29:03 -0400
> From: Dave Angel <davea at ieee.org>
> To: Roelof Wobben <rwobben at hotmail.com>
> Cc: tutor at python.org
> Subject: Re: [Tutor] pure function problem
> Message-ID: <4C9C7D6F.5080700 at ieee.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 2:59 PM, Roelof Wobben wrote:
> >
> >
> > ----------------------------------------
> >> From: steve at pearwood.info
> >> <snip>
> >> On Fri, 24 Sep 2010 06:20:25 am Roelof Wobben wrote:
> >>
> >>> time =ijd()
> >> [...]
> >>> print time(uitkomst)
> >> Why are you calling time as a function, when it is a tijd instance?
> >>
> >> <snip>
> >
> > Hello Steve,
> >
> > I found this in my tutorial.
> >
> > 13.8. Instances as return values?
> > Functions can return instances. For example, find_center takes a
> Rectangle as an argument and returns a Point that contains the coordinates
> of the center of the Rectangle:
> > def find_center(box):
> > p =oint()
> > p.x =ox.corner.x + box.width/2.0
> > p.y =ox.corner.y - box.height/2.0
> > return p
> > To call this function, pass box as an argument and assign the result to a
> variable:
> >>>> center =ind_center(box)
> >>>> print_point(center)
> > (50.0, 100.0)
> >
> >
> > So i followed it but appearently not the good way.
> >
> > Roelof
> There's a big difference between print_point() and print time().
>
> print_point() in your tutorial is a function, presumably defined
> someplace else.
>
> You used print time(), (no underscore), which uses the print statement,
> and tries to call a function called time().
>
> Since you defined time as an instance of your class, and didn't do
> anything special, it's not callable.
>
> DaveA
>
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 24 Sep 2010 10:40:46 +0000
> From: Roelof Wobben <rwobben at hotmail.com>
> Cc: <tutor at python.org>
> Subject: Re: [Tutor] pure function problem
> Message-ID: <SNT118-W46627FE73899BE912DE70DAE620 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
>
> ----------------------------------------
> > Date: Fri, 24 Sep 2010 06:29:03 -0400
> > From: davea at ieee.org
> > To: rwobben at hotmail.com
> > CC: tutor at python.org
> > Subject: Re: [Tutor] pure function problem
> >
> > On 2:59 PM, Roelof Wobben wrote:
> >>
> >>
> >> ----------------------------------------
> >>> From: steve at pearwood.info
> >>>
> >>> On Fri, 24 Sep 2010 06:20:25 am Roelof Wobben wrote:
> >>>
> >>>> time =ijd()
> >>> [...]
> >>>> print time(uitkomst)
> >>> Why are you calling time as a function, when it is a tijd instance?
> >>>
> >>>
> >>
> >> Hello Steve,
> >>
> >> I found this in my tutorial.
> >>
> >> 13.8. Instances as return values?
> >> Functions can return instances. For example, find_center takes a
> Rectangle as an argument and returns a Point that contains the coordinates
> of the center of the Rectangle:
> >> def find_center(box):
> >> p =oint()
> >> p.x =ox.corner.x + box.width/2.0
> >> p.y =ox.corner.y - box.height/2.0
> >> return p
> >> To call this function, pass box as an argument and assign the result to
> a variable:
> >>>>> center =ind_center(box)
> >>>>> print_point(center)
> >> (50.0, 100.0)
> >>
> >>
> >> So i followed it but appearently not the good way.
> >>
> >> Roelof
> > There's a big difference between print_point() and print time().
> >
> > print_point() in your tutorial is a function, presumably defined
> > someplace else.
> >
> > You used print time(), (no underscore), which uses the print statement,
> > and tries to call a function called time().
> >
> > Since you defined time as an instance of your class, and didn't do
> > anything special, it's not callable.
> >
> > DaveA
> >
>
> Oke,
>
> I see it now.
> I have to us a function that i had to write a few questions before.
>
> Thanks everybody
>
> Roelof
>
>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 24 Sep 2010 12:26:31 -0400 (EDT)
> From: kb1pkl at aim.com
> To: tutor at python.org
> Subject: Re: [Tutor] Plotting a Linear Equation
> Message-ID: <8CD2A1C6185AFCF-854-182 at webmail-m060.sysops.aol.com>
> Content-Type: text/plain; charset="utf-8"; format=flowed
>
>
>
>
> -----Original Message-----
> From: Greg <gregbair at gmail.com>
> To: tutor <tutor at python.org>
> Sent: Fri, Sep 24, 2010 3:29 am
> Subject: Re: [Tutor] Plotting a Linear Equation
>
>
> On Thu, Sep 23, 2010 at 10:51 PM, Corey Richardson <kb1pkl at aim.com>
> wrote:
>
> ?Hello tutors. Probably the wrong mailing list, but someone might know.
> I want to use matplotlib (or similar) to plot an equation in
> slope-intercept (y=mx+b) or standard form (Ax + By = C). As far as I've
> read and tested, you can only plot with a series of points. I could
> make two points out of those manually, but I was wondering if anyone
> knew of an easier way. Thanks.
>
>
>
> You could just have your program compute the x- and y- intercepts, then
> plug them into matplotlib. ?Am I correct in that??
>
>
> --
> Greg Bair
> gregbair at gmail.com
> ______________________________________________________________________
> Yes, you are correct. That's what I planned on doing if I couldn't plug
> the equation right into matplotlib.
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 24 Sep 2010 19:58:44 +0200
> From: Norman Khine <norman at khine.net>
> To: Python tutor <tutor at python.org>
> Subject: Re: [Tutor] list.append(x) but at a specific 'i'
> Message-ID:
> <AANLkTinq++Wr+N6FHtObjXs2AOOG8O1o4CK1NvUAzgts at mail.gmail.com<AANLkTinq%2B%2BWr%2BN6FHtObjXs2AOOG8O1o4CK1NvUAzgts at mail.gmail.com>
> >
> Content-Type: text/plain; charset=UTF-8
>
> On Wed, Sep 22, 2010 at 9:47 PM, Steven D'Aprano <steve at pearwood.info>
> wrote:
> > On Wed, 22 Sep 2010 08:30:09 am Norman Khine wrote:
> >
> >> hello, how do i extend a python list but from a given [i],
> >
> > Do you mean to modify the list in place, like append() and extend() do,
> > or do you mean to create a new list, like + does?
> >
> >
> >> for example:
> >> >>> a = ['a', 'b', 'e']
> >> >>> b = ['c', 'd']
> >> >>>
> >> >>> a + b
> >>
> >> ['a', 'b', 'e', 'c', 'd']
> >>
> >>
> >> but i want to put the items of 'b' at [-2] for example.
> >
> > When you ask a question, it usually helps to show the output you *want*,
> > not the output you *don't want*, rather than to make assumptions about
> > what other people will understand.
> >
> > When you say that you want the items of b *at* -2, taken literally that
> > could mean:
> >
> >>>> a = ['a', 'b', 'e']
> >>>> b = ['c', 'd']
> >>>> a.insert(-2+1, b)
> >>>> print(a)
> > ['a', 'b', ['c', 'd'], 'e']
> >
> > Note that the items of b are kept as a single item, at the position you
> > ask for, and the index you pass to insert() is one beyond when you want
> > them to appear.
> >
> > To create a new list, instead of insert() use slicing:
> >
> >>>> a[:-2+1] + [b] + a[-2+1:]
> > ['a', 'b', ['c', 'd'], 'e']
> >
> >
> > If you want the items of b to *start* at -2, since there are exactly two
> > items, extend() will do the job for in-place modification, otherwise +.
> > But you already know that, because that was your example.
> >
> > If you want the items of b to *end* at -2, so that you get
> > ['a', 'b', 'c', 'd', 'e'] then you could use repeated insertions:
> >
> > for c in b:
> > ? ?a.insert(-2, c)
> >
> > but that will likely be slow for large lists. Better to use slicing. To
> > create a new list is just like the above, except you don't create a
> > temporary list-of-b first:
> >
> >>>> a[:-2+1] + b + a[-2+1:]
> > ['a', 'b', 'c', 'd', 'e']
> >
> >
> > To do it in place, assign to a slice:
> >
> >>>> a[-2:-2] = b
> >>>> print(a)
> > ['a', 'c', 'd', 'b', 'e']
>
> thanks for all the replies, and the detailed information
> >
> >
> >
> > --
> > Steven D'Aprano
> > _______________________________________________
> > Tutor maillist ?- ?Tutor at python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --
> ?u?op ?p?sdn p,u?n? p??o? ??? ??s no? '?u???? s???? ??? pu? '?u??uo?
> ?q s,??? ???
> %>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or
> chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )
>
>
> ------------------------------
>
> Message: 5
> Date: Sat, 25 Sep 2010 19:29:34 +1000
> From: Sayth Renshaw <flebber.crue at gmail.com>
> To: Tutor at python.org
> Subject: [Tutor] Python And reading the Web - Javascript
> Message-ID:
> <AANLkTinM5XOc8riMeoGF6eLqg5PGxW-e4fDpEy0evg3J at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Was hoping some could push me in the right direction about reading
> data from web pages and what modules to use. Is there support for
> reading if the page uses javascript?
>
> If you know any good links to tutorials for this it would be great. I
> was planning to use python 2.6 currently.
>
> I want to read some data from the web it will be text and numeric i
> was planning to export it to a database. I was thinking while I am
> learning maybe something simple like Sqlite or MySQL.
>
> I then want to read back data to perform sorting and some calculations on.
>
> Any ideas in general in how to do this appreciated. i don't mind
> reading so if you have some good links they are appreciated.
>
> Thank You
>
> Sayth
>
>
> ------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
> End of Tutor Digest, Vol 79, Issue 134
> **************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100926/4d00412d/attachment-0001.html>
More information about the Tutor
mailing list