From e28318c2711a1a3410fcefe2a6f292656056aeb3 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Aug 2016 20:26:51 +0100 Subject: Micro-optimise _format_jid. --- slixmpp/jid.py | 15 +++++++-------- 1 file 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): -- cgit v1.2.3