[Tutor] What's the difference between sort(aList) and aList.sorted()
C W
tmrsg11 at gmail.com
Wed Jul 26 22:22:45 EDT 2017
Thank you very much, Steve!
I think I got it. To get help() on a method, you have to somehow invoke an
object first.
In your example, even an empty vector [] will do.
Thanks!
On Wed, Jul 26, 2017 at 10:16 PM, Steven D'Aprano <steve at pearwood.info>
wrote:
> On Wed, Jul 26, 2017 at 10:03:59PM -0400, C W wrote:
> > Thank you very much, all!
> >
> > One other question: how do you look up a method?
>
> Any of these will work:
>
> help(list.sort)
>
> help([].sort)
>
> alist = [1, 2, 3, 99]
> help(alist.sort)
>
>
>
>
> --
> Steve
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list