Skip to main content
added 10 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

OK, aa few things:

A. I would make head and size private, you don't want them changed from outside the class.

B. You should use __len__ instead of __sizeof__ - they have different meanings.

C. Implement __iter__

D. After doing C, Format the repr using: "[{}]". format(", ". join(map(str, self)))

  1. I would make head and size private, you don't want them changed from outside the class.

  2. You should use __len__ instead of __sizeof__ - they have different meanings.

  3. Implement __iter__

  4. After doing #3, format the repr using:

    "[{}]". format(", ". join(map(str, self)))
    

OK, a few things:

A. I would make head and size private, you don't want them changed from outside the class.

B. You should use __len__ instead of __sizeof__ - they have different meanings.

C. Implement __iter__

D. After doing C, Format the repr using: "[{}]". format(", ". join(map(str, self)))

OK, a few things:

  1. I would make head and size private, you don't want them changed from outside the class.

  2. You should use __len__ instead of __sizeof__ - they have different meanings.

  3. Implement __iter__

  4. After doing #3, format the repr using:

    "[{}]". format(", ". join(map(str, self)))
    
Source Link
Shain
  • 66
  • 1

OK, a few things:

A. I would make head and size private, you don't want them changed from outside the class.

B. You should use __len__ instead of __sizeof__ - they have different meanings.

C. Implement __iter__

D. After doing C, Format the repr using: "[{}]". format(", ". join(map(str, self)))