473,804 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Where are list methods documented?

I'm trying to figure out how to sort a list, and I've run into
a problem that that I have tripped over constantly for years:
where are the methods of basic types documented? The only
thing I can find on a list's sort() method is in the tutorial
where it states:

sort()
Sort the items of the list, in place.

Doesn't the list method would accept a callable to be used as a
comparison function? Where is that sort of thing in the
documentation? I've looking in the library reference, the
language reference, the global module index.

I have figured out I can do
list.sort.__doc __

'L.sort(cmpfunc =None) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1'

--
Grant Edwards grante Yow! But they went to MARS
at around 1953!!
visi.com
Jul 18 '05 #1
17 2171
[Grant Edwards]
I'm trying to figure out how to sort a list, and I've run into
a problem that that I have tripped over constantly for years:
where are the methods of basic types documented?
The methods on mutable sequence types are documented in the Library
manual's section on mutable sequence types:

http://docs.python.org/lib/typesseq-mutable.html
The only thing I can find on a list's sort() method is in the tutorial
where it states:


You could have found the above by, e.g., looking up "sort" in the
Library manual's index.
Jul 18 '05 #2
Grant Edwards said unto the world upon 2005-02-01 12:21:
I'm trying to figure out how to sort a list, and I've run into
a problem that that I have tripped over constantly for years:
where are the methods of basic types documented? The only
thing I can find on a list's sort() method is in the tutorial
where it states:

sort()
Sort the items of the list, in place.

Doesn't the list method would accept a callable to be used as a
comparison function? Where is that sort of thing in the
documentation? I've looking in the library reference, the
language reference, the global module index.

I have figured out I can do

list.sort._ _doc__


'L.sort(cmpfunc =None) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1'


Hi,

I'm not positive I understand what you are looking for, but do these
help?:

<http://www.python.org/doc/2.4/lib/built-in-funcs.html#l2h-15>
<http://www.python.org/doc/2.4/lib/typesseq.html>
<http://www.python.org/doc/2.4/lib/typesseq-mutable.html>

Best,
Brian vdB
Jul 18 '05 #3
Grant Edwards wrote:
I'm trying to figure out how to sort a list, and I've run into
a problem that that I have tripped over constantly for years:
where are the methods of basic types documented? The only
thing I can find on a list's sort() method is in the tutorial
where it states:

sort()
Sort the items of the list, in place.

Doesn't the list method would accept a callable to be used as a
comparison function? Where is that sort of thing in the
documentation? I've looking in the library reference, the
language reference, the global module index.

I have figured out I can do

list.sort._ _doc__


'L.sort(cmpfunc =None) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1'

Grant,
For a quick, short doc string list: >>> help(list)
wes

Jul 18 '05 #4
On 2005-02-01, Tim Peters <ti********@gma il.com> wrote:
[Grant Edwards]
I'm trying to figure out how to sort a list, and I've run into
a problem that that I have tripped over constantly for years:
where are the methods of basic types documented?
The methods on mutable sequence types are documented in the
Library manual's section on mutable sequence types:

http://docs.python.org/lib/typesseq-mutable.html

You could have found the above by, e.g., looking up "sort" in the
Library manual's index.


I did. I looked up sort in the library index, and it took me
to 3.3.5 Emulating container types, which said:

Mutable sequences should provide methods append(), count(),
index(), extend(), insert(), pop(), remove(), reverse() and
sort(), like Python standard list objects.

I also looked at quite a few "list" links in the index.

I don't think it's at all obvious that the documentation for
list.sort would be under "mutable sequence object".

--
Grant Edwards grante Yow! YOW!! Everybody out
at of the GENETIC POOL!
visi.com
Jul 18 '05 #5
On 2005-02-01, Brian van den Broek <bv****@po-box.mcgill.ca> wrote:
I'm not positive I understand what you are looking for, but do these
help?:

<http://www.python.org/doc/2.4/lib/built-in-funcs.html#l2h-15>
<http://www.python.org/doc/2.4/lib/typesseq.html>
<http://www.python.org/doc/2.4/lib/typesseq-mutable.html>


Yes, that last page was the one I was looking for. I didn't
know enough to spell list as "mutable sequence type".

--
Grant Edwards grante Yow! I think my CAREER
at is RUINED!!
visi.com
Jul 18 '05 #6
Grant Edwards <gr****@visi.co m> writes:
On 2005-02-01, Brian van den Broek <bv****@po-box.mcgill.ca> wrote:
I'm not positive I understand what you are looking for, but do these
help?:

<http://www.python.org/doc/2.4/lib/built-in-funcs.html#l2h-15>
<http://www.python.org/doc/2.4/lib/typesseq.html>
<http://www.python.org/doc/2.4/lib/typesseq-mutable.html>


Yes, that last page was the one I was looking for. I didn't
know enough to spell list as "mutable sequence type".

--
Grant Edwards grante Yow! I think my CAREER
at is RUINED!!
visi.com


You could also have typed 'sort' in the box here:

http://starship.python.net/crew/theller/pyhelp.cgi

This search is also available in Mark Hammond's Mozilla Python sidebar.

Thomas
Jul 18 '05 #7
[Tim Peters]
You could have found the above by, e.g., looking up "sort" in the
Library manual's index.

[Grant Edwards] I did. I looked up sort in the library index, and it took me
to 3.3.5 Emulating container types,
It doesn't for me. Here:

http://docs.python.org/lib/genindex.html#letter-s

There are two entries for "sort":

sort (IMAP4_stream method)
sort (list method)

You're looking for the second one <wink>.

....
I don't think it's at all obvious that the documentation for
list.sort would be under "mutable sequence object".


I was just answering your question ("where are the docs?"), not trying
to imply you were an idiot for not guessing that.

You could have gotten to the same place in several ways. Another
would have been to look up "list" in the Library index, and click on

list
type, operations on

For good or ill, the Library manual takes a rather abstract view of
the types currently implemented, as reflected in its table of
contents:

2. Built-In Objects
2.1 Built-in Functions
2.2 Non-essential Built-in Functions
2.3 Built-in Types
2.3.1 Truth Value Testing
2.3.2 Boolean Operations
2.3.3 Comparisons
2.3.4 Numeric Types
2.3.5 Iterator Types
2.3.6 Sequence Types
2.3.7 Set Types
2.3.8 Mapping Types
2.3.9 File Objects
2.3.10 Other Built-in Types
2.3.11 Special Attributes
2.4 Built-in Exceptions
2.5 Built-in Constants

So, e.g., it doesn't mention floats or dicts by those names either.
It's well worthwhile to spend some time browsing that entire chapter.
Jul 18 '05 #8
On 2005-02-01, Tim Peters <ti********@gma il.com> wrote:
[Grant Edwards]
I did. I looked up sort in the library index, and it took me
to 3.3.5 Emulating container types,


It doesn't for me. Here:

http://docs.python.org/lib/genindex.html#letter-s

There are two entries for "sort":

sort (IMAP4_stream method)
sort (list method)

You're looking for the second one <wink>.


Aargh. My bad. I was in the language reference index. I seem
to have a very hard time ending up in the document I'm trying
for. For some reason, I fairly consistently click on the wrong
link in the document index. :(

--
Grant Edwards grante Yow! I'm definitely not
at in Omaha!
visi.com
Jul 18 '05 #9
In article <r7**********@p ython.net>,
Thomas Heller <th*****@python .net> wrote:

You could also have typed 'sort' in the box here:

http://starship.python.net/crew/theller/pyhelp.cgi

This search is also available in Mark Hammond's Mozilla Python sidebar.


....and as a link from python.org's documentation pages.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

"Given that C++ has pointers and typecasts, it's really hard to have a serious
conversation about type safety with a C++ programmer and keep a straight face.
It's kind of like having a guy who juggles chainsaws wearing body armor
arguing with a guy who juggles rubber chickens wearing a T-shirt about who's
in more danger." --Roy Smith, c.l.py, 2004.05.23
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2798
by: Georg Scholz | last post by:
Hello, The class "Control" contains a documented Property "ControlType". So for example, in a form, you can write code like this: Dim c as control set c = me.Controls("textbox1") if c.ControlType = acTextBox then ...
10
2679
by: Benny Raymond | last post by:
I'm trying to change the way a treeview works just a bit, i'm pretty new to C# and now i'm running into overloading. I tried the following code and it's yelling at me saying that no overload method takes 0 arguments. #region tViewNodeCollection public class tViewNodeCollection : TreeNodeCollection { private tView _owner; private tViewNode _parent; /// <summary>
2
1304
by: PinoyDotnet | last post by:
I am just starting 2.0, so I have this In ASPNET 1.X there is a method called InitializeComponent() which clearly wires in the Page_Load method to the Load event, like this: private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load);
2
3509
by: felecha | last post by:
I learned about Exceptions in School, and now that I'm building my first real application on the job, I'm going through it trying to analyze it for all possible Exceptions so I can handle them effectively. I've been looking in the Help / Index for each Method's documentation, and looking at the listed Exceptions. I'm finding a number of methods with no Exceptions specified. Does that mean there is no possible Exception for that method?...
8
1742
by: Daz | last post by:
Hi everyone. I just wanted to know if there was any way to use script to display a list of methods linked to a particular object? The object I have in mind is getBrowser(), and I can't seem to find any documentation online with regards to it's methods. Also, as I am learning, it would be nice to be able to know what methods are available for a particular object/function, without necessarily having to spend a while looking up an...
15
2789
by: Laser Lu | last post by:
I was often noted by Thread Safety declarations when I was reading .NET Framework Class Library documents in MSDN. The declaration is usually described as 'Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.' So, does this mean All the static/shared methods written in .NET compatible programming language, such as C#, VB.NET, are guaranteed to be...
5
3842
by: David Longnecker | last post by:
I'm working to create a base framework for our organization for web and client-side applications. The framework interfaces with several of our systems and provides the business and data layer connectivity for basic operations and such. I've ran into a snag that I just can't think myself out of. Here's an example: I have an object for a Student called StudentRecord. It has properties such as name, grade, identification number, etc.
0
278
by: Weeble | last post by:
On Jun 20, 11:10 pm, Göran Andersson <gu...@guffa.comwrote: I did it that way because CopyTo has a whole bunch of failure cases to take care of (multi-dimensional array, not enough space, negative index, null array), and I didn't think it was likely to get used that much, so I wanted to do something that would behave correctly without a lot of work. If it became a performance issue I would certainly have changed it later.
6
1446
by: HillBilly | last post by:
One question I have not figured out is how to learn which event parameter list is supported by a control? EventArgs, CommandEventArgs, what?
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.