@@ -36,7 +36,10 @@ class HumanName(object):
3636
3737 Instantiation assigns to ``full_name``, and assignment to
3838 :py:attr:`full_name` triggers :py:func:`parse_full_name`. After parsing the
39- name, these instance attributes are available.
39+ name, these instance attributes are available. Alternatively, you can pass
40+ any of the instance attributes to the constructor method and skip the parsing
41+ process. If any of the the instance attributes are passed to the constructor
42+ as keywords, :py:func:`parse_full_name` will not be performed.
4043
4144 **HumanName Instance Attributes**
4245
@@ -56,6 +59,12 @@ class HumanName(object):
5659 :param str string_format: python string formatting
5760 :param str initials_format: python initials string formatting
5861 :param str initials_delimter: string delimiter for initials
62+ :param str first: first name
63+ :param str middle: middle name
64+ :param str last: last name
65+ :param str title: The title or prenominal
66+ :param str suffix: The suffix or postnominal
67+ :param str nickname: Nicknames
5968 """
6069
6170 C = CONSTANTS
@@ -77,7 +86,9 @@ class HumanName(object):
7786 _full_name = ''
7887
7988 def __init__ (self , full_name = "" , constants = CONSTANTS , encoding = DEFAULT_ENCODING ,
80- string_format = None , initials_format = None , initials_delimiter = None ):
89+ string_format = None , initials_format = None , initials_delimiter = None ,
90+ first = None , middle = None , last = None , title = None , suffix = None ,
91+ nickname = None ):
8192 self .C = constants
8293 if type (self .C ) is not type (CONSTANTS ):
8394 self .C = Constants ()
@@ -86,8 +97,17 @@ def __init__(self, full_name="", constants=CONSTANTS, encoding=DEFAULT_ENCODING,
8697 self .string_format = string_format or self .C .string_format
8798 self .initials_format = initials_format or self .C .initials_format
8899 self .initials_delimiter = initials_delimiter or self .C .initials_delimiter
89- # full_name setter triggers the parse
90- self .full_name = full_name
100+ if (first or middle or last or title or suffix or nickname ):
101+ self .first = first
102+ self .middle = middle
103+ self .last = last
104+ self .title = title
105+ self .suffix = suffix
106+ self .nickname = nickname
107+ self .unparsable = False
108+ else :
109+ # full_name setter triggers the parse
110+ self .full_name = full_name
91111
92112 def __iter__ (self ):
93113 return self
0 commit comments