Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61b49a0

Browse filesBrowse files
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> (cherry picked from commit ef7973a) Co-authored-by: Brad Solomon <brad.solomon.1124@gmail.com>
1 parent 5d555fa commit 61b49a0
Copy full SHA for 61b49a0

File tree

2 files changed

+17
-0
lines changed
Filter options

2 files changed

+17
-0
lines changed

‎Lib/webbrowser.py

Copy file name to clipboardExpand all lines: Lib/webbrowser.py
+16Lines 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

+1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.