Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
What is "generator object" in Django?
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

A generator object in python is something like a lazy list. Elements are only evaluated as soon as you iterate over them. (So the calling list evaluates them all.)

For example you can do:

 >>> def f(x): ... print "yay!" ... return 2 * x >>> g = (f(i) for i in xrange(3)) # generator comprehension syntax >>> g <generator object <genexpr> at 0x37b6c0> >>> for j in g: print j ... yay! 0 yay! 2 yay! 4

See how f is evaluated only as you iterate over it. You can find excellent material on the subject here: http://www.dabeaz.com/generators/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!