Tag

Generator

1 views collected around this technical thread.

Test Development Learning Exchange
Test Development Learning Exchange
May 17, 2025 · Fundamentals

Understanding Python Generator Functions: Syntax, Usage, and Practical Examples

Python generator functions, using the yield keyword, enable lazy evaluation and memory-efficient data processing, with examples covering basic syntax, differences from regular functions, Fibonacci sequence generation, large file reading, two-way communication via send(), and control methods like throw() and close(), highlighting their advantages.

GeneratorIteratorsMemory Efficiency
0 likes · 4 min read
Understanding Python Generator Functions: Syntax, Usage, and Practical Examples
Python Programming Learning Circle
Python Programming Learning Circle
Apr 22, 2025 · Fundamentals

Why and How to Avoid Writing For Loops in Python

The article explains why you should challenge yourself to avoid explicit for loops in Python and demonstrates how to replace them with list comprehensions, generator expressions, map/reduce, and itertools, resulting in shorter, more readable, and better‑structured code.

Functional ProgrammingGeneratorPython
0 likes · 7 min read
Why and How to Avoid Writing For Loops in Python
Code Mala Tang
Code Mala Tang
Apr 15, 2025 · Fundamentals

What Really Happens Inside a Python for-loop? Uncover the Magic of Iterators

This article demystifies Python’s for-loop by explaining how iterable objects and iterators work under the hood, illustrating the iterator protocol with code examples, and providing practical custom iterator implementations, common pitfalls, and tips for efficient data processing.

Data ProcessingGeneratorIterable
0 likes · 9 min read
What Really Happens Inside a Python for-loop? Uncover the Magic of Iterators
Code Mala Tang
Code Mala Tang
Apr 5, 2025 · Fundamentals

How to Write Loop-Free Python Code: Faster, Cleaner Alternatives

This article explains why traditional Python loops can hurt performance and readability, and demonstrates six loop‑free techniques—including list comprehensions, map/filter, built‑in functions like sum/max/min, NumPy vectorization, generators, and dictionary/set comprehensions—providing concise, faster, and more Pythonic code examples.

Functional ProgrammingGeneratorNumPy
0 likes · 10 min read
How to Write Loop-Free Python Code: Faster, Cleaner Alternatives
php中文网 Courses
php中文网 Courses
Mar 5, 2025 · Backend Development

Using PHP Generator Functions to Create Infinite Iterable Objects for Large Data Processing

The article explains how PHP generator functions can create infinite iterable objects, such as a Fibonacci sequence, to process large data sets efficiently by yielding values on demand, reducing memory usage and improving performance, with practical code examples and discussion of advantages and use cases.

GeneratorMemory Optimizationlarge-data
0 likes · 5 min read
Using PHP Generator Functions to Create Infinite Iterable Objects for Large Data Processing
php中文网 Courses
php中文网 Courses
Jan 24, 2025 · Backend Development

Using PHP Generator Functions to Create Infinite Iterable Objects

This article explains PHP generator functions introduced in PHP 5.5 and enhanced in PHP 7, demonstrating how to implement infinite iterable objects such as a Fibonacci sequence, and discusses their advantages for processing large data sets, memory efficiency, and typical use cases like log handling and pagination.

Backend DevelopmentGeneratorLarge Data Processing
0 likes · 5 min read
Using PHP Generator Functions to Create Infinite Iterable Objects
Test Development Learning Exchange
Test Development Learning Exchange
Jan 18, 2025 · Fundamentals

Understanding Python Comprehensions: Lists, Sets, Dictionaries, Nested and Generator Expressions

Python comprehensions provide concise syntax for creating lists, sets, dictionaries, nested structures, and generator expressions, allowing developers to replace explicit loops and conditional logic with readable one‑liner constructs, as illustrated with practical code examples and guidance on their appropriate use.

Generatorcomprehensionsdictionary
0 likes · 6 min read
Understanding Python Comprehensions: Lists, Sets, Dictionaries, Nested and Generator Expressions
Deepin Linux
Deepin Linux
Jan 8, 2025 · Fundamentals

Deep Dive into C++20 Coroutines: Principles, Components, and Practical Applications

This article explains the fundamentals of C++20 coroutines, describing their lightweight asynchronous execution model, key language constructs such as co_await, co_yield, and co_return, the underlying components like promise objects and coroutine handles, and demonstrates real‑world usage through comprehensive code examples for networking, file I/O, generators, and task scheduling.

Asynchronous ProgrammingC++20Example
0 likes · 32 min read
Deep Dive into C++20 Coroutines: Principles, Components, and Practical Applications
Test Development Learning Exchange
Test Development Learning Exchange
Oct 8, 2024 · Fundamentals

Understanding Python's Iteration Protocol: Iterable and Iterator with Practical Examples

This article explains Python's iteration protocol, detailing how iterable objects and iterators work, and provides multiple code examples—including custom iterables, generators, and iterator-based test data handling—to demonstrate their use in building flexible and memory‑efficient applications.

GeneratorIterableIterator
0 likes · 11 min read
Understanding Python's Iteration Protocol: Iterable and Iterator with Practical Examples
Test Development Learning Exchange
Test Development Learning Exchange
Oct 1, 2024 · Fundamentals

Understanding Python Generator Functions and Their Applications in API Automation Testing

This article explains Python generator functions, their memory‑efficient iteration mechanism, and demonstrates through multiple examples—including basic generators, Fibonacci sequences, large file processing, HTTP streaming, and API test data generation—how they can streamline and optimize interface automation testing workflows.

API testingAutomationGenerator
0 likes · 10 min read
Understanding Python Generator Functions and Their Applications in API Automation Testing
Test Development Learning Exchange
Test Development Learning Exchange
Jul 30, 2024 · Fundamentals

Advanced Python Iteration Techniques with Practical Examples

This article presents ten advanced Python iteration techniques—including list, dictionary, and set comprehensions, zip, enumerate, itertools utilities, and generator expressions—each illustrated with clear code examples to help developers write more concise, efficient, and readable code.

GeneratorPythoncomprehension
0 likes · 5 min read
Advanced Python Iteration Techniques with Practical Examples
php中文网 Courses
php中文网 Courses
Jun 12, 2024 · Backend Development

Using PHP Generator Functions to Create Infinite Iterable Objects for Large Data Processing

This article explains how PHP generator functions can create infinite iterable objects, demonstrating with a Fibonacci sequence example to efficiently handle large data sets while reducing memory usage and improving performance in backend development.

GeneratorInfinite SequenceMemory Optimization
0 likes · 5 min read
Using PHP Generator Functions to Create Infinite Iterable Objects for Large Data Processing
Test Development Learning Exchange
Test Development Learning Exchange
Jun 1, 2024 · Backend Development

Using Python Generator Functions for Efficient API Automation Testing

This article demonstrates how Python generator functions can be applied in API automation testing to process large data streams, batch requests, infinite sequences, file handling, dynamic test data generation, recursive file traversal, lazy calculations, data filtering, response processing, retry logic, and test report creation, thereby improving memory efficiency and test flexibility.

AutomationGeneratorMemory Management
0 likes · 6 min read
Using Python Generator Functions for Efficient API Automation Testing
Test Development Learning Exchange
Test Development Learning Exchange
Apr 30, 2024 · Fundamentals

Understanding Python Comprehensions: Lists, Dictionaries, Sets, and Generators with Examples

Python comprehensions provide a concise, powerful way to create new data structures—lists, dictionaries, sets, and generators—from existing iterables, combining loops and conditional logic, and the article explains their syntax, usage, and includes practical code examples for dynamic parameter construction, data analysis, and testing scenarios.

GeneratorPythoncode
0 likes · 7 min read
Understanding Python Comprehensions: Lists, Dictionaries, Sets, and Generators with Examples
Test Development Learning Exchange
Test Development Learning Exchange
Apr 13, 2024 · Fundamentals

Advanced Python Techniques: 10 In-Depth Code Examples

This article presents ten advanced Python techniques—including list comprehensions, lambda functions, decorators, context managers, generators, metaclasses, asyncio coroutines, enums, slicing, and exception handling—each illustrated with detailed code examples to help readers deepen their mastery of Python programming.

AdvancedGeneratorasyncio
0 likes · 6 min read
Advanced Python Techniques: 10 In-Depth Code Examples
Python Programming Learning Circle
Python Programming Learning Circle
Nov 13, 2023 · Fundamentals

Why You Should Avoid For Loops in Python and Use More Advanced Constructs

The article explains how avoiding explicit for‑loops in Python encourages the use of more expressive constructs such as list comprehensions, generator expressions, map/reduce, and itertools, leading to shorter, more readable, and better‑structured code while showcasing practical examples and best‑practice recommendations.

Functional ProgrammingGeneratorcode optimization
0 likes · 7 min read
Why You Should Avoid For Loops in Python and Use More Advanced Constructs
php中文网 Courses
php中文网 Courses
Nov 1, 2023 · Backend Development

Understanding PHP Generator Functions: Syntax, Use Cases, and Examples

This article explains PHP generator functions, covering their purpose for memory‑efficient data iteration, streaming, and asynchronous tasks, detailing their syntax with the yield statement, providing multiple code examples, outlining advantages, usage notes, and concluding with best‑practice recommendations.

GeneratorPHPasynchronous
0 likes · 5 min read
Understanding PHP Generator Functions: Syntax, Use Cases, and Examples
php中文网 Courses
php中文网 Courses
Oct 31, 2023 · Backend Development

Using Generators in PHP 7 for Efficient Data Processing

This article explains PHP 7 generators, describing their concept, memory‑saving benefits, and how to implement them with a practical example that reads a large file and yields squared numbers, demonstrating efficient data processing and lazy loading in backend development.

Backend DevelopmentGeneratorMemory Optimization
0 likes · 5 min read
Using Generators in PHP 7 for Efficient Data Processing
php中文网 Courses
php中文网 Courses
Oct 30, 2023 · Backend Development

Using the PHP yield Keyword for Memory‑Efficient Data Processing

This article explains how the PHP yield keyword creates generators that allow lazy iteration over large data sets, large files, or infinite sequences, reducing memory consumption and improving performance by pausing and resuming function execution without returning the entire collection at once.

Backend DevelopmentGeneratorMemory Optimization
0 likes · 7 min read
Using the PHP yield Keyword for Memory‑Efficient Data Processing
Python Programming Learning Circle
Python Programming Learning Circle
Sep 21, 2023 · Fundamentals

Python Performance Optimization Tips

This article presents practical Python performance optimization techniques, including using local variables, minimizing function calls, employing mappings over conditionals, iterating directly over sequences, preferring generator expressions, pre‑compiling code, and structuring modules with functions to reduce overhead and improve efficiency.

Best PracticesGeneratorOptimization
0 likes · 6 min read
Python Performance Optimization Tips