Harsh J

Memoirs of a QWERTY Keyboard

Archive for the ‘Movie’ Category

Boggis, Bunce and Bean

2 comments

Boggis, Bunce and Bean from Fantastic Mr. Fox

Boggis, Bunce and Bean from Fantastic Mr. Fox

And the following is how it begins,

Boggis and Bunce and Bean
One fat, one short, one lean
These horrible crooks
So different in looks
Were none the less equally mean.

Thorougly enjoyed watching Fantastic Mr. Fox (2010 movie, based on a book by Roald Dahl). The art, humor, plot, voice cast and the dialogs – all were excellent. A 10 from me for the entertainment!

(Pff, not that it counts coming from here anyway; but great job you studio folks)

Written by Harsh

February 10th, 2010 at 11:46 am

Posted in Movie

Tagged with , ,

Avatar

7 comments

Watched Avatar, and it seemed to me that James Cameron’s been busy playing popular video games ever since Titanic.

Movie was good at entertaining, although I had this thought; that in his focus of developing the alien ecosystem, he failed to improve ours in the time-line portrayed. Must’ve seen it in 3D to avoid thinking so much during a movie. Now to wait for the Avatar I know.

Well, that’s a year end coming up. Hope 2010 has a lot of surprises for you too :)

Update: Whoa! What’s this?! I like the sound of it, Jack Black-ish.

Written by Harsh

December 31st, 2009 at 10:04 pm

Posted in Fun, Movie, Personal

Tagged with , ,

Say Hello to the War Machine!

2 comments

War Machine and Iron Man suits in the first Iron Man 2 Poster

War Machine and Iron Man suits in the first Iron Man 2 Poster

Whiplash, Black Widow, War Machine and Iron Man. This is surely gonna be over-hyped ;)

Written by Harsh

December 2nd, 2009 at 5:02 pm

The Day The Earth Stood Still (2008)

3 comments

Saw this movie at the theaters today. A very nice concept packed into a slightly-bad movie with a good star cast.

The moment of the movie when the Earth actually stands still, was the best part among all other. Honestly I got interested in this movie only cause it had Keanu Reeves in its star-list. And he was pretty good as the visiting extraterrestrial. It’s kinda weird to say that, since it was only his body in use.

The movie should have had one scene of an actual speech. The people should have known why they were being hit by those forces. Instead, it ends abruptly leaving no cliffhanger. The visitor and his assistance, all just go away. The original 1951 movie had a better plot, with more details on the violence and harm humans caused. This was pretty fine otherwise, including humor just when it begins to get boring.

P.s. So the universe does have the cyclops, I suspected so for long!

Written by Harsh

December 13th, 2008 at 9:38 pm

The new print function in Python 3

2 comments

The print statement has gone. A function replaces it in Python 3.0. Apart from the other changes, this one probably needs the most mind and finger retraining, cause its something I use a lot while fiddling with the interpreter.

So far, till Python 2.6

So this is how you all have been happily typing away in Python 2.x:

print "Print this and print a newline"
print "Print this, but not a newline",

Now, if you had a collection of elements you wanted to print with certain formatting, say with punctuation, here’s how you would do it:

basket = ('Apple', 'Oranges', 'Banana')
print ", ".join(basket) + "."

# Which produces the output:
"Apple, Oranges, Banana."
About the print() function in Python 3.0

About the print() function in Python 3.0

Some would even prefer to use a logical loop instead, for readability’s sake. But this method does require a string operation to happen, and loops probably would take up lines, or worse, in certain cases.

Now, in Python 3.0 onwards

The print statement has gone for good and the print() function comes in.

This decision is well explained in the PEP (Python Enhancement Proposals) and the specific paper on it can be found here (Numbered 3105)

Digging into this function’s documentation would reveal all about it in simple text (If you are an avid reader of the Python Documentation). Of what’s continued here is all just for newbies-only, with some demonstrations.

A simple demo equivalent to the first as above:

print ("Print this line, and print a newline")
print ("Print this line, but not a newline", end="")

You might notice that its got a little complex here, with a keyword argument being supplied instead of an ending comma as before.

But lets see the full power of this new print() function by doing the same punctuation to the fruit basket as before:

basket = ('Apple', 'Oranges', 'Banana')

print (*basket, sep=", ", end=".\n")

# Which produces the same output as desired:

"Apple, Oranges, Banana."

We do the same thing as before, except that we don’t require a loop, nor string operations. The function’s two keyword arguments sep and end handle the complex jobs for us. Basically, this is what they mean:

  • sep – Seperator string – Defines the string that is to be placed between every two values printed.
  • end – Ender string – Defines the string to be printed at the end of the print function.

By default, sep has a space (‘ ‘) and end is a newline (‘ \n ‘). So a simple signature of this new print function would be like:

print ( [object(s)], sep=' ', end='\n' )

And finally, the Star of this show

The one last addition to the print function made by the Python team was the file keyword argument. That’s right, one more keyword argument.

  • file – Object Name – Specify file/object to print to.

This one is a really cool addition, and it defaults to sys.stdout, (i.e.) your terminal. Thus, a more complete print() signature is:

print ( [object(s)], sep=' ', end='\n' , file=sys.stdout)
# No, you obviously don't have to import sys for this.
# Its just to describe what file its printing to.
# (/dev/stdout in UNIX's case)

All the file argument needs is an object that supports any write(string) method.

Now lets try printing the fruit basket to a file than to the terminal as default:

fruits = open("fruitsfile.txt", "w")
basket = ('Apple', 'Oranges', 'Banana')
print (*basket, sep=", ", end=".\n", file=fruits)

# Effectively prints the punctuated line,
# to the file named fruitsfile.txt

This could have a great use, especially with logging! And since it supports any object with a write method, the possibilities could be endless.

Now tell me if you still hate that its got parentheses? Look at the power of this new function!

Written by Harsh

December 9th, 2008 at 11:06 pm