Why my .split(' ') doesnt work?

I've been trying to override the first input for fullname under object "Pete Tong" and change it to "James Milner" using the split function.

However, when I run the below code, all output except for printing of the fullname() returns the "Pete Tong" first and last name, which I was trying to change for all accesses. Any idea why? I thought it should be printing all as "James Milner" with the override.

class Employee:
    def __init__(self, first, last):
        self.first = first
        self.last = last

    @property
    def email(self):
        return "{}.{}@email.com".format(self.first, self.last)

    @property
    def fullname(self):
        return "{} {}".format(self.first, self.last)

    @fullname.setter
    def fullname(self, name):
        first, last = name.split(' ')
        self.first = first
        self.last = last


emp_1 = Employee('Pete', 'Tong')

emp_1.fullname = 'James Milner'

print emp_1.first

print(emp_1.first)
print(emp_1.email)
print(emp_1.fullname)

The problem is that you're using Python 2, and your class is not inheriting object. You can either (a) Use Python 3, or (b) Change the class definition to:

class Employee(object):

which will work in both Python 2 and Python 3.

split up, with I thought she'd split up with her boyfriend.split somebody ↔ up Why would she try to split us up?2  An injury may be a probable cause for a split nail. Crushing your nail tip or bed can result in your nail growing with a ridge or split-like appearance.


You haven't stated so explicitly, but I suspect that you're running Python 2 on a feature that works only in Python 3.

The one print without parentheses implies that you're running this with Python 2. setter works only in Python 3. That also explains how another user can get James from your code (after fixing that one print).

To fix this in Python 2, you need your class to inherit from the mother-of-all, object:

class Employee(object):

Python3 does this automatically; Python 2 does not.

split, My father and Mr Calder agreed to split the cost of repairs to the Wrights' car. split head open• What if Lucy had split her head open again?split with/from• Her  Split ends can’t be repaired. The only reliable way to get rid of them is to cut them off. The latest trend to get rid of split ends is a process called velaterapia, also known as candle cutting.


In order to for properties to work you need to use new style classes which inherit from object, so declare your class like this, it will work

class Employee(object):
    def __init__(self, first, last):
        self.first = first
        self.last = last

    @property
    def email(self):
        return "{}.{}@email.com".format(self.first, self.last)

    @property
    def fullname(self):
        return "{} {}".format(self.first, self.last)

    @fullname.setter
    def fullname(self, name):
        first, last = name.split(' ')
        self.first = first
        self.last = last


emp_1 = Employee('Pete', 'Tong')

emp_1.fullname = 'James Milner'

print emp_1.first

print(emp_1.first)
print(emp_1.email)
print(emp_1.fullname)

SPLIT, split definition: 1. to (cause to) divide into two or more parts, especially + obj + adj ] The woman had split her head open (= got a long, deep  How to Split screen your PC monitor, please follow the steps given below and check if it helps. Open the programs or documents you want to view in split screen. Click on one of the program windows. Press and hold the "Windows" logo button on the bottom-left of your keyboard.


Window menu : Split window, Splits the spreadsheet window into two panes, or removes this split. This command is only available when the spreadsheet window is open and active (on top). All publicly-traded companies have a set number of shares that are outstanding. A stock split is a decision by a company's board of directors to increase the number of shares that are outstanding


Split is suddenly not recognised as a function - Help, How do I get back to my happy state that split gave me? dhoyt 2 March 2018 15:​46 #2. So what causes split cabbage heads and how do you treat these splitting cabbages once it occurs? What Causes Split Cabbage Heads? Split cabbage heads usually follows a heavy rain, especially after a period of dry weather. When the roots absorb excess moisture after the cabbage head is firm, the pressure from internal growth causes the head to


Python 3 Notes: Split and Join, split(), .join(), and list(). Splitting a Sentence into Words: .split(). Below, mary is a single string. Even though it is  Depending on what type of cake you are making, your oven temperature, and the procedure you followed when you mixed the cake batter, there are a variety of reasons why a cake might crack or split on top.