diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-08-21 20:26:51 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-08-21 20:26:51 +0100 |
commit | e28318c2711a1a3410fcefe2a6f292656056aeb3 (patch) | |
tree | d547809a2a9f7bcdfbe8aa34a28f4d2341c32772 | |
parent | 39ee833c29039f635ef65c9d31e551c6c58055d0 (diff) | |
download | slixmpp-e28318c2711a1a3410fcefe2a6f292656056aeb3.tar.gz slixmpp-e28318c2711a1a3410fcefe2a6f292656056aeb3.tar.bz2 slixmpp-e28318c2711a1a3410fcefe2a6f292656056aeb3.tar.xz slixmpp-e28318c2711a1a3410fcefe2a6f292656056aeb3.zip |
Micro-optimise _format_jid.
-rw-r--r-- | slixmpp/jid.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/slixmpp/jid.py b/slixmpp/jid.py index 2e23e242..337aca2a 100644 --- a/slixmpp/jid.py +++ b/slixmpp/jid.py @@ -208,16 +208,15 @@ def _format_jid(local=None, domain=None, resource=None): :return: A full or bare JID string. """ - result = [] + if domain is None: + return '' if local is not None: - result.append(local) - result.append('@') - if domain is not None: - result.append(domain) + result = local + '@' + domain + else: + result = domain if resource is not None: - result.append('/') - result.append(resource) - return ''.join(result) + result += '/' + resource + return result class InvalidJID(ValueError): |