Register to get access to free programming courses with interactive exercises

Conclusion Python: Declarative programming

We looked at several high-level constructs that allow you to describe all sorts of collections and infinite data streams.

It is safe to say that these constructions are a language within a language. High-level constructs may be incomprehensible to novice Python programmers, but their expressive power can tell you about many things briefly.

Generation with yield is more like regular imperative Python, but using this style forces you to interpret the code in your head. This interpretation is more challenging than reading regular imperative code. This difficulty stems from the fact that with imperative code, you don't have to figure out how to suspend a function or traverse the function body several times.

Procedures

We've left out co-procedures, which are generators to which you can send messages and expect them to give you more than just the next batch of data.

Co-procedures is a large and complex field. Even experienced programmers struggle to learn how to write, understand, and debug co-procedure code. In Python, all asynchrony is built on procedures, although you can work with them without fully understanding all the intricacies.

Object style generators

We did not cover another side of generators: writing generators in object style. To understand this area, you need to learn the basics of OOP. It is material for future courses. Some of the more complex and narrow topics are beyond the course, but the ability to use the tools we've described already gives programmers powerful tools for working with data.


Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

Bookmate
Health Samurai
Dualboot
ABBYY
Suggested learning programs
profession
new
Developing web applications with Django
10 months
from scratch
under development
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.