Programming

What is Reactive Programming ?

Reactive Programming (Rx) is a declarative programming paradigm concerned with data streams and the propagation of change. In reactive programming, data streams are spine of application. Events, messages, calls, and even failures are going to be conveyed by a data stream. With reactive programming, you observe these streams and react [...]

2020-09-28T17:07:47+05:30Categories: Programming|

bind Function and Placeholders in C++

Function template std::bind takes a function as input and generates a forwarding call wrapper. Calling this wrapper is equivalent to invoking input function with some of its arguments. A placeholder forwards argument to the calling function object returned by std::bind. Syntax std::bind is defined in functional header. Below is syntax [...]

2020-09-25T15:25:33+05:30Categories: Programming|Tags: |

accumulate and partial_sum Function in C++

std::accumulate() computes the sum of the given elements in the range. std::partial_sum() computes the partial sums of the elements in the subranges of the range. Syntax Below is the syntax of accumulate. template <class InputIterator, class T> T accumulate (InputIterator first, InputIterator last, T init); template <class InputIterator, class T, [...]

2020-09-23T18:08:25+05:30Categories: Programming|Tags: |

copy and copy_if Function in C++

std::copy() and std::copy_if() function in C++ copies the elements in the range, to another range. However std::copy_if() function copies the element based on result of unary function passed to it. Syntax Syntax of copy() and copy_if() function is template <class InputIterator, class OutputIterator> OutputIterator copy (InputIterator first, InputIterator last, OutputIterator [...]

2020-09-23T16:51:45+05:30Categories: Programming|Tags: |

Numeric Operator Overload in Python

Plus (+) operator is used for adding numbers and at the same time to concatenate strings. It is possible because + operator is overloaded by both int class and str class. Operators are methods, defined in respective classes. Defining methods for operators is known as Operator Overloading. To use + [...]

2020-09-21T18:37:13+05:30Categories: Programming|Tags: |

Comparing Object Instances in Python

Rich comparison methods are used for comparing object instances. It assigns special methods to each operator as given in below table. OperatorMethod==__eq__(self, other)!=__ne__(self, other)<__lt__(self, other)<=__le__(self, other)>__gt__(self, other)>=__ge__(self, other) The correspondence between operator symbols and method names is as follows: x < y calls x.__lt__(y), x>=y calls x.__ge__(y), and so on. [...]

2020-09-21T17:02:59+05:30Categories: Programming|Tags: |

String Representation of Class Object in Python

Python module __str__() and __repr__() functions are used to convert class object into string. These functions can be are very helpful in debugging by logging useful information of the object. _str_ Function It is called by str() and the built-in functions format() and print() to compute printable string representation of [...]

2020-09-21T15:26:13+05:30Categories: Programming|Tags: |

Enumerations in Python

Enumerations are a set of symbolic names bound to unique, constant values. Within an enumeration in Python, the members can be compared, and the enumeration itself can be iterated over. Because Enums are used to represent constants, it is recommended to use UPPER_CASE names for enum members. Enum Types enum [...]

2020-09-21T13:16:23+05:30Categories: Programming|Tags: |

Counter in Python

Counter is used to keeps track of how many times equivalent values are added. It is a collection where elements are stored as dictionary keys and their counts are stored as dictionary values. Syntax To create a counter, use below syntax collections.Counter([iterable-or-mapping]) It returns counter object. A Counter is a [...]

2020-09-17T11:15:13+05:30Categories: Programming|Tags: |

Deque in Python

A deque is a double-ended queue in which elements can be both inserted and deleted from either the left or the right end of the queue. deque class in Python supports deque. It is a generalization of stacks and queues. It support thread-safe, memory efficient appends and pops from either [...]

2020-09-16T17:52:57+05:30Categories: Programming|Tags: |
Go to Top