yjqiang: `return tags[0] if len(tags) else None`
Maybe it is better for `return tags[0] if tags else None`?
facelessuser: > return tags[0] if len(tags) else None
Maybe it is better for return tags[0] if tags else None?

It's kind of a stylistic habit of mine.  I kind of do it that way as a reminder that I'm evaluating an iterable object. I'm not strict about it, but it is often something I do without thinking.
yjqiang: > > return tags[0] if len(tags) else None
> Maybe it is better for return tags[0] if tags else None?
> 
> It's kind of a stylistic habit of mine.  I kind of do it that way as a reminder that I'm evaluating an iterable object. I'm not strict about it, but it is often something I do without thinking.

Ok. Not a big deal.
facelessuser: Was just curious about performance, and someone on StackOverflow took the time to benchmark it. It appears that `len()` is definitely slower than checking its truthiness.

```
>>> import timeit
>>> min(timeit.repeat(lambda: len([]) == 0, repeat=100))
0.13775854044661884
>>> min(timeit.repeat(lambda: [] == [], repeat=100))
0.0984637276455409
>>> min(timeit.repeat(lambda: not [], repeat=100))
0.07878462291455435
```

In most cases you'd never notice, but if doing a ton of operations, the accumulation could be become for noticeable.  Nice to know.
diff --git a/docs/src/markdown/about/changelog.md b/docs/src/markdown/about/changelog.md
index 431b37d..fe398a9 100644
--- a/docs/src/markdown/about/changelog.md
+++ b/docs/src/markdown/about/changelog.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## 1.4.1
+
+- **NEW**: Add `select_one` method like Beautiful Soup has.
+
 ## 1.4.0
 
 - **NEW**: Throw `NotImplementedError` for at-rules: `@page`, etc.
diff --git a/docs/src/markdown/api.md b/docs/src/markdown/api.md
index c72b648..46cea96 100644
--- a/docs/src/markdown/api.md
+++ b/docs/src/markdown/api.md
@@ -16,10 +16,31 @@ Soup Sieve will detect the document type being used from the Beautiful Soup obje
 
 - While attribute values are generally treated as case sensitive, HTML5, XHTML, and HTML treat the `type` attribute special. The `type` attribute's value is always case insensitive. This is generally how most browsers treat `type`. If you need `type` to be sensitive, you can use the `s` flag: `#!css [type="submit" s]`.
 
+As far as the API is concerned, Soup Sieve mimics Beautiful Soup's original API at the time of writing this, which is why the names `select` and `select_one` are used. As of today, Beautiful Soup has agreed to include Soup Sieve as the official select library which is slated for the 4.7.0 release.
+
+Soup Sieve will always be available as an external API as well for more controlled tag selection if needed.
+
 ## Flags
 
 Early in development, flags were used to specify document type, but as of 1.0.0, there are no flags used at this time, but the parameter is provided for potential future use.
 
+## `soupsieve.select_one()`
+
+```py3
+def select(select, tag, namespaces=None, flags=0):
+    """Select the specified tags."""
+```
+
+`select_one` will return the first tag under the given tag that matches the given CSS selectors provided, or it will return `None` if a suitable tag was not found.
+
+`select_one` accepts a CSS selector string, a `Tag`/`BeautifulSoup` object, an optional [namespace](#namespaces) dictionary, and `flags`.
+
+```pycon3
+>>> import soupsieve as sv
+>>> sv.select_one('p:is(.a, .b, .c)', soup)
+<p class="a">Cat</p>
+```
+
 ## `soupsieve.select()`
 
 ```py3
@@ -126,6 +147,9 @@ class SoupSieve:
     def icomments(self, tag, limit=0):
         """Iterate comments only."""
 
+    def select_one(self, tag):
+        """Select a single tag."""
+
     def select(self, tag, limit=0):
         """Select the specified tags."""
 
diff --git a/docs/src/markdown/index.md b/docs/src/markdown/index.md
index 20739a0..f669b41 100644
--- a/docs/src/markdown/index.md
+++ b/docs/src/markdown/index.md
@@ -56,7 +56,15 @@ To use Soup Sieve, you must create a `BeautifulSoup` object:
 >>> soup = bs4.BeautifulSoup(text, 'html5lib')
 ```
 
-Then you can begin to use Soup Sieve to select:
+Then you can begin to use Soup Sieve to select a single tag:
+
+```pycon3
+>>> import soupsieve as sv
+>>> sv.select_one('p:is(.a, .b, .c)', soup)
+<p class="a">Cat</p>
+```
+
+To select all tags:
 
 ```pycon3
 >>> import soupsieve as sv
diff --git a/soupsieve/__init__.py b/soupsieve/__init__.py
index 15b4c59..b5f594d 100644
--- a/soupsieve/__init__.py
+++ b/soupsieve/__init__.py
@@ -89,6 +89,12 @@ def icomments(tag, limit=0, flags=0):
         yield comment
 
 
+def select_one(select, tag, namespaces=None, flags=0):
+    """Select a single tag."""
+
+    return compile(select, namespaces, flags).select_one(tag)
+
+
 def select(select, tag, namespaces=None, limit=0, flags=0):
     """Select the specified tags."""
 
diff --git a/soupsieve/css_match.py b/soupsieve/css_match.py
index 2b37cf7..9415b2f 100644
--- a/soupsieve/css_match.py
+++ b/soupsieve/css_match.py
@@ -764,6 +764,12 @@ class SoupSieve(ct.Immutable):
         for comment in self._sieve(tag, capture=False, comments=True, limit=limit):
             yield comment
 
+    def select_one(self, tag):
+        """Select a single tag."""
+
+        tags = self.select(tag, limit=1)
+        return tags[0] if tags else None
+
     def select(self, tag, limit=0):
         """Select the specified tags."""
 

select_one and select
I like the function `soup.select()` and `soup.select_one()`. Maybe you can add `select_one` to this repo? If the result is None, I can easily know that there are no match objects. Just like https://docs.python.org/3/library/re.html#re.search  Infact, I don't know why you use `limit` to control the number of the results. I think people would need one or all of the results.
diff --git a/tests/test_soupsieve.py b/tests/test_soupsieve.py
index 091a9b5..a8d0c5c 100644
--- a/tests/test_soupsieve.py
+++ b/tests/test_soupsieve.py
@@ -67,6 +67,19 @@ class TestSoupSieve(unittest.TestCase):
 
         self.assertEqual(sorted(['5', 'some-id']), sorted(ids))
 
+        ids = []
+        for el in sv.select('span[id]', soup, limit=1):
+            ids.append(el.attrs['id'])
+
+        self.assertEqual(sorted(['5']), sorted(ids))
+
+        self.assertEqual(
+            sv.select('span[id]', soup, limit=1)[0].attrs['id'],
+            sv.select_one('span[id]', soup).attrs['id']
+        )
+
+        self.assertEqual(None, sv.select_one('h1', soup))
+
         ids = []
         for el in sv.iselect('span[id]', soup):
             ids.append(el.attrs['id'])

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov coverage lxml beautifulsoup4
apt-get update apt-get install -y gcc
3.9
requirements/project.txt requirements/tests.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
beautifulsoup4==4.13.3
coverage==7.8.0
exceptiongroup==1.2.2
html5lib==1.1
iniconfig==2.1.0
lxml==5.3.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
six==1.17.0
-e git+https://github.com/facelessuser/soupsieve.git@8954ee48491311b62f1c314d0f9a5938c6bee0f1#egg=soupsieve
tomli==2.2.1
typing_extensions==4.13.0
webencodings==0.5.1

name: soupsieve
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - beautifulsoup4==4.13.3
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - html5lib==1.1
      - iniconfig==2.1.0
      - lxml==5.3.1
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - six==1.17.0
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - webencodings==0.5.1
prefix: /opt/conda/envs/soupsieve

tests/test_soupsieve.py::TestSoupSieve::test_select
tests/test_soupsieve.py::TestSoupSieve::test_cache tests/test_soupsieve.py::TestSoupSieve::test_comments tests/test_soupsieve.py::TestSoupSieve::test_copy_pickle tests/test_soupsieve.py::TestSoupSieve::test_filter tests/test_soupsieve.py::TestSoupSieve::test_immutable_dict tests/test_soupsieve.py::TestSoupSieve::test_immutable_object tests/test_soupsieve.py::TestSoupSieve::test_match tests/test_soupsieve.py::TestSoupSieve::test_recompile tests/test_soupsieve.py::TestInvalid::test_invalid_combination tests/test_soupsieve.py::TestInvalid::test_invalid_incomplete_has tests/test_soupsieve.py::TestInvalid::test_invalid_namespace tests/test_soupsieve.py::TestInvalid::test_invalid_pseudo tests/test_soupsieve.py::TestInvalid::test_invalid_pseudo_close tests/test_soupsieve.py::TestInvalid::test_invalid_pseudo_open tests/test_soupsieve.py::TestInvalid::test_invalid_syntax tests/test_soupsieve.py::TestInvalid::test_invalid_tag tests/test_soupsieve.py::TestInvalid::test_invalid_type_input
docs/src/markdown/api.md docs/src/markdown/about/changelog.md soupsieve/__init__.py docs/src/markdown/index.md soupsieve/css_match.py
docs/src/markdown/api.md docs/src/markdown/about/changelog.md soupsieve/__init__.py docs/src/markdown/index.md soupsieve/css_match.py