A lot of new python learners have a hard time wrapping their brain around PEP 380. I am usually asked:
To understand what
yielddoes, you must understand what generators are. And before you can understand generators, you must understand iterables.
An iterable is an object that has an
__iter__ method which returns an iterator, or which defines a
__getitem__ method that can take sequential indexes starting from zero (and raises an
A powerful language with features you might not know about.
You can have more than one parameter extended like the example above.
The above contrived method returns true if the two given collections are equal or if either one of them contains the given element, otherwise false. The point to notice is that you can invoke methods of both Comparable and Collection on the arguments b1 and b2.
What’s especially unknown to many programmers is that you can actually label and break out of any…
A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces with colons between the names and values, and commas between the values and names. The internal form is an object having
opt methods for accessing the values by name, and
put methods for adding or replacing values by name.
In computer science, predication is an architectural feature that provides an alternative to conditional transfer of control, implemented by machine instructions such as conditional branch, conditional call, conditional return, and branch tables. Predication works by executing instructions from both paths of the branch and only permitting those instructions from the taken path to modify architectural state. 
To better understand the concept, let’s take an example:
“Processing a sorted array is faster than processing an unsorted array”
The code above takes ~12 seconds to run. But on commenting line 15, not touching the rest, the same code takes ~33…
Ever wondered how does a piece of code look like that can lock up a traditional computer?
I have always had this curiosity and finally now I have explored and written enough to come up with a some really dangerous pieces of code that will do the job.
Fork Bomb: Very simple, yet effective. I came across the shell fork bomb years ago when I had to reboot the system. It looks like this:
Just a shell function that calls itself twice and never terminates.
This is how it look like in C. Well, this will get the…