Bottom Page

Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"add to list" function
The following function should generate a list from my class - right?

def to_list(self):
        return [self.customer_id, self.firstname, self.lastname, self.born, self.zip_code
Well, it needs a closing bracket (]) at the end of the second line, but otherwise, yeah. Note that you have to put that indented under the class definition (to automatically pass self), or you need to manually pass the function an instance of your class.
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Thanks! Lost the bracket while pasting the code in here.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Making list empty after return in function dan789 10 302 Nov-24-2018, 11:54 PM
Last Post: micseydel
  Run function in parallel but inherite dynamic data from the previous function atizva 4 382 Jul-11-2018, 06:39 AM
Last Post: volcano63
  function 'return' and file content into a list shiro26 4 363 Jul-06-2018, 10:20 PM
Last Post: volcano63
  question about list and remove function wmw12344 5 503 Mar-30-2018, 11:52 AM
Last Post: ljmetzger
  make a list of string in capital by using a function anancba 3 699 Nov-23-2017, 06:42 AM
Last Post: heiner55
  List in function thehimanshukeshri 1 615 Nov-19-2017, 07:58 AM
Last Post: buran
  Calling list from previous function zykbee 1 620 Nov-13-2017, 12:10 PM
Last Post: Larz60+
  View function mapping is overwriting an existing endpoint function: index rarevesselt 12 7,672 Oct-22-2017, 12:34 AM
Last Post: rarevesselt
  What exactly is wrong with my list.append function? Coga19000 2 607 Aug-24-2017, 08:36 AM
Last Post: Coga19000
  simulating sum function on LIST vvv 2 1,055 Feb-25-2017, 06:57 AM
Last Post: vvv

Forum Jump:

Users browsing this thread: 1 Guest(s)