Rare Insight Into the IPy Team

An email conversation between two members of the IPy team that you, dear reader, might find amusing.

From:Srivatsn Narayanan
Sent: Friday, May 02, 2008 4:00 PM
Subject: You dont need pinky fingers? šŸ˜„

http://twitter.com/DevHawk/statuses/802239164


From:Dino Viehland
Sent: Friday, May 02, 2008 11:30 PM

Wow, am I really that loud? šŸ˜„

This is a response to the idea that no design is complete until you canā€™t remove anything else without sacrificing the overall goals of the end result.Ā  Is the pinky really necessary?Ā  We can ā€œcut that featureā€, right? šŸ˜„


From: Srivatsn Narayanan
Sent: Friday, May 02, 2008 11:49 PM

If you cut off the pinkie, then the ring finger becomes the pinkie and so iteratively you will have to lose all of them šŸ˜ƒ. If I remember right in Europe, you hold up the pinkie to order beer. So itā€™s quite important šŸ˜„


From: Dino Viehland
Sent: Friday, May 02, 2008 11:59 PM

Well I find it hard to argue with ordering beer, but I doubt the pinkieā€™s original use was to order beer.Ā  Therefore Iā€™d describe this as an abuse of an existing API that might be better served by a new API specifically designed for this purpose.Ā  But I question even if a new API is necessary.

Drinking beer by definition involves a container in which the beer is consumed from.Ā  Therefore the container itā€™s self (or the lack thereof) might be able to serve the dual role for both consuming the beer and indicating the need for a refill.Ā  For example when drinking sake Iā€™ve been told it is customary to tip the bottle on its side to indicate the desire for a refill.Ā  Are we really to expect that the Human API exposes every need in a direct fashion?Ā  For example should I have another appendage for ā€œI need more bread sticksā€ and yet another for ā€œCan I get a refill or on the water?ā€.Ā  Iā€™d propose the ā€œ2 creams no sugarā€ appendage because thatā€™s the way I take my coffee.

On the other hand the iterative problem does seem to be more relevant ā€“ but it presupposes a purpose for the pinky in the first place!Ā  But alas, I admit Iā€™ve just returned from drinking beer, so this may not be the best argument šŸ˜ƒ.


From: Srivatsn Narayanan
Sent: Saturday, May 03, 2008 12:21 AM

The pinkie is like a reserved field/custom field in a API. Every user community can come up with its own use for it but they have to devise the protocol themselves. Apparently different civilizations have. Wikipedia as usual has a list of those. So do you get your ā€œ2 creams no sugarā€ appendage ā€“ sure if u can agree on the semantics with the waiter. Seems like a PM call to me šŸ˜„

PS: What beer did u have? I should try that ā€“ seems effective šŸ˜„


From: Dino Viehland
Sent: Saturday, May 03, 2008 12:26 AM

I hadnā€™t quite considered it like this but Iā€™d propose an alternate encoding ā€“ binary.Ā  With 4 fingers one can communicate up to 16 different which seems to cover most of the listed issues.Ā  Yes 5 gives you up to 32 messages but 16 should be enough for everyone šŸ˜ƒ.

And they were various Haleā€™s Ales fresh from the brewery.


From: Srivatsn Narayanan
Sent: Saturday, May 03, 2008 12:31 AM

I wouldnā€™t want to hold up 0010 really (although it wonā€™t be the middle finger anymore) šŸ˜„


From: Dino Viehland
Sent: Saturday, May 03, 2008 12:40 AM

Ahh, but letā€™s just call that one reserved ā€“ that leaves the end-user with 15 other messages!Ā  Personally Iā€™d suggest we reserve the entire bit ā€“ that way we could use other codes like 1010 for future expansion of various standard messages.Ā  Urination seems popular on the pinky list so maybe weā€™d want to standardize that in the future ā€“ we of course need to look at uses of the other fingers before we come to this conclusion.Ā  Users are now left with 8 user-defined messages but that seems plenty.Ā  Also they can then use 1000 or 0001 (depending their endianness, a.k.a. left-handed or right-handed) for the now deprecated pinky-messages.


From: Srivatsn Narayanan
Sent: Saturday, May 03, 2008 12:55 AM

1000, 1100, 1110 and 1111 are actually used for counting numbers 1,2,3,4 šŸ˜„ They are too obvious to be non-standardized. So they are out as well.

That cuts the user messages to 5 (third bit is reserved anyway). Some of the ones left are hard to make as well ā€“ try 0101 šŸ˜„

IronPython 2.0 Beta 2

We pushed out the latest beta of IronPython 2.0 this morning. From the release notes:

Weā€™re pleased to announce the release of IronPython 2.0 Beta 2. In addition to the usual bug fixes (~25 reported on CodePlex and ~50 reported internally), this release has been partially focused on improving the performance of IronPython, in particular startup perf. Another focus of this release was improving upon our traceback support which had regressed quite a bit in 2.0B1 and had largely been broken in the 2.0 Alphas. Our traceback support should now be superior to that of IronPython 1.1!

Weā€™ve also made a minor change to our packaging by adding a Microsoft.Scripting.Core.dll in addition to the Microsoft.Scripting.dll thatā€™s been around since the start of 2.0. We are doing this purely as an architectural layering cleanup. Microsoft.Scripting.Core contains DLR features that are essential to building dynamic languages. Microsoft.Scripting will contain language implementation helpers that can either be re-used (e.g., BigInts) or copied (possibly e.g., the default binder). This process is all about our work to get the DLR architecture right and shouldnā€™t have any noticeable IronPython impact except that thereā€™s now one more DLL to include in any package.

As a consequence of the new DLL, the deprecated file IronPython2005.sln is broken. This is the last release that will include this .sln file in the source zip file. Of course the Visual Studio 2008 version of this file, IronPython.sln, still builds.

Weā€™d like to thank everyone in the community who reported these: kevgu, oldman, christmas, brucec, scottw, fuzzyman, haibo, Seo Sanghyeon, grizlupo, J. Merrill, perhaps, antont, 05031972, Jason Ferrara, Matt Beckius, and Davy Mitchell.

The full release notes have details about the bugs we fixed. Congrats to the team and thanks again to the community members for their assistance.

Importing Static Methods with IPy

Like .NET, Python uses namespaces to avoid name collisions. However, the semantics are a bit different. If you want to use a type or function from a a given namespace in Python, you have to import it into your current scope. For example, if you want to use the Python datetime built-in module, you would import it into the current scope and use it like this:

import datetime
bush_last_day = datetime.date(2009,1,20)

Notice that when I import a Python module this way, itā€™s scoped into itā€™s namespace, which forces me to use the entire namespace scoped name to access the type. Of course, that gets tedious quickly, so Python provides a way to import a type from a specific namespace into your current scope like this:

from datetime import date
bush_last_day = date(2009,1,20)

With IronPython, you can do import .NET namespaces as well. Hereā€™s that same code using the standard .NET DateTime class.

from System import DateTime
bush_last_day = DateTime(2009,1,20)

What I didnā€™t know is that you can import static methods & properties from .NET types into the current scope using the same syntax. Hereā€™s an example:

from System.DateTime import Now

if Now >= bush_last_day:
    print 'celebrate'
else:
    print (bush_last_day - Now).Days, 'days left'

Being able to import a static method into the current scope is pretty convenient. Thanks to my teammate Jimmy for cluing me into this IPy feature.

One caveat though: in Python, you can import an entire namespace into your current scope. You can do that with .NET namespaces, but not with .NET types

from datetime import *         # this works

from System import *           # so does this

from System.DateTime import *  # this doesnā€™t work

Update: Michael Foord pointed out that if you import Now as I describe above, it places a DateTime object representing the time you imported it into local scope, rather than placing the underlying get_Now static method in local scope. So while DateTime.Now always returns a new value, Now never changes. Sounds like an IPy bug to me, but Iā€™ll have to circle back with the team to be sure.

DLR Resources & Jobs

Iā€™m back home from PyCon, but between digging out my inbox, finishing transition reports and doing my mid-year career discussion Iā€™m a little busy. But I did want to point at a couple of recent posts from the IPy team blog: