Skip to content

Commit ef7973a

Browse files
bsolomon1124brsolomon-deloitteterryjreedy
authored
bpo-40561: Add docstrings for webbrowser open functions (GH-19999)
Co-authored-by: Brad Solomon <brsolomon@deloitte.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent d5d9a71 commit ef7973a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Lib/webbrowser.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ def get(using=None):
6969
# instead of "from webbrowser import *".
7070

7171
def open(url, new=0, autoraise=True):
72+
"""Display url using the default browser.
73+
74+
If possible, open url in a location determined by new.
75+
- 0: the same browser window (the default).
76+
- 1: a new browser window.
77+
- 2: a new browser page ("tab").
78+
If possible, autoraise raises the window (the default) or not.
79+
"""
7280
if _tryorder is None:
7381
with _lock:
7482
if _tryorder is None:
@@ -80,9 +88,17 @@ def open(url, new=0, autoraise=True):
8088
return False
8189

8290
def open_new(url):
91+
"""Open url in a new window of the default browser.
92+
93+
If not possible, then open url in the only browser window.
94+
"""
8395
return open(url, 1)
8496

8597
def open_new_tab(url):
98+
"""Open url in a new page ("tab") of the default browser.
99+
100+
If not possible, then the behavior becomes equivalent to open_new().
101+
"""
86102
return open(url, 2)
87103

88104

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Provide docstrings for webbrowser open functions.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy