summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorBrad Solomon <brad.solomon.1124@gmail.com>2020-05-11 18:50:11 (GMT)
committerGitHub <noreply@github.com>2020-05-11 18:50:11 (GMT)
commitef7973a981ff8f4687ef3fdb85a69fa15aa11fe5 (patch)
tree18afceb4a9883b98a50e2ec679430ace846c15f9 /Lib/webbrowser.py
parentd5d9a718662e67e2b1ac7874dda9df2d8d71d415 (diff)
downloadcpython-ef7973a981ff8f4687ef3fdb85a69fa15aa11fe5.zip
cpython-ef7973a981ff8f4687ef3fdb85a69fa15aa11fe5.tar.gz
cpython-ef7973a981ff8f4687ef3fdb85a69fa15aa11fe5.tar.bz2
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>
Diffstat (limited to 'Lib/webbrowser.py')
-rwxr-xr-xLib/webbrowser.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 1ef179a..9c73bcf 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -69,6 +69,14 @@ def get(using=None):
# instead of "from webbrowser import *".
def open(url, new=0, autoraise=True):
+ """Display url using the default browser.
+
+ If possible, open url in a location determined by new.
+ - 0: the same browser window (the default).
+ - 1: a new browser window.
+ - 2: a new browser page ("tab").
+ If possible, autoraise raises the window (the default) or not.
+ """
if _tryorder is None:
with _lock:
if _tryorder is None:
@@ -80,9 +88,17 @@ def open(url, new=0, autoraise=True):
return False
def open_new(url):
+ """Open url in a new window of the default browser.
+
+ If not possible, then open url in the only browser window.
+ """
return open(url, 1)
def open_new_tab(url):
+ """Open url in a new page ("tab") of the default browser.
+
+ If not possible, then the behavior becomes equivalent to open_new().
+ """
return open(url, 2)