Showing posts with label programming language. Show all posts
Showing posts with label programming language. Show all posts

Saturday, 14 October 2017

9 Interesting facts about Python Programming language

1.There is actually a poem written by Tim Peters named as THE ZEN OF PYTHON which can be read by just writing "import this" in the interpreter.


2.One can use an “else” clause with a “for” loop in Python. It’s a special type of syntax that executes only if the for loop exits naturally, without any break statements.



3.In Python, everything is done by reference. It doesn’t support pointers.

4.Function Argument Unpacking is another awesome feature of Python. One can unpack a list or a dictionary as function arguments using * and ** respectively. This is commonly known as the Splat operator. Example here



5.Want to find the index inside a for loop? Wrap an iterable with ‘enumerate’ and it will yield the item along with its index. See this code snippet



6.One can chain comparison operators in Python answer= 1<x<10 is executable in Python. More examples here



7.We can’t define Infinities right? But wait! Not for Python. See this amazing example


8.Instead of building a list with a loop, one can build it more concisely with a list comprehension. See this code for more understanding.

9. Finally, Python’s special Slice Operator. It is a way to get items from lists, as well as change them. See this code snippet



Monday, 25 September 2017

What is new in Java 9?

Java 9 is the evolutionary upgrade over its previous version 8 ( including every procedural update ). It's not like a major “groundbreaking” update like 7th but if you could use the “linking of the modules” then it's good for you.Here is some information about it (Java Platform, Standard Edition ) and you can dig out some more use out of this update.
Java 9 has several changes and it would be an extremely long answer if I were to list all of them.

However, there are some changes, which will impact how you program in Java 9. I list some of them below. However, the description will generally be short, as you can research most of them if you want.

1.The Process API changes

If you’ve ever tried accessing native processes running on the system, you’d probably know that Java didn’t use to be good at this. You would have to resort to C++ or C to manage the processes. With Java 9, you’d hardly ever use native code to manage processes.

2.Support for HTTP/2

With this, we finally let go of the legacy class Http URLConnection. It had several problems, however, the one which troubled the most was that used outdated technology based on protocols like FTP and gopher which are no longer in use.

3.Better Stack Traces

Nothing much to say here, just that it is a lot more organized than before. Also, you have the new StackWalker class, with which you can navigate your stack traces through the code, without String Manipulations.

4.Better Javadocs

This is one of my favorites. The Javadocs finally get a search bar, that means I don’t have to use Google to visit the documentation of the class.

5.Supports Unicode 8

Unicode 7 is the latest version of Unicode.

6.Modularity

This can’t be explained very simply, to be honest. It basically “divides the JDK into a set of modules that can be combined at compile time, build time, and run time into a variety of configurations”. To be honest, even I don’t understand it completely.

7.Better String Concatenations

Right now, if you do something like ”A” + “B”, in the bytecode, you have a StringBuffer. While this is a good option, it still has performance issues. Java 9 attempts to fix that.

8.JShell

This is what got most of us excited. No need to make classes, typing code directly into the command prompt. Java has finally got REPL.

9.Compile time improvements

Classes will tend to compile a lot quicker.

10.Javafx improvements

I haven’t actually tried this yet, but several UI Controls and the CSS API have seen a major upgrade.

11.Applets are finally depreciated

This made me happy the most. Finally can schools stop teaching something which has absolutely no future.

12.Parser API for Nashorn

Self explanatory.

13.Compact Strings

“Improve the space efficiency of the String class and related classes while maintaining performance in most scenarios and preserving full compatibility for all related Java and native interfaces.”

14.Project Coin

You can longer use only `_` as a variable name. This used to give a warning in Java 8, but generates an error in Java 9