Profile

Cover photo
Wilson Xu
Works at Tisiwi(天使湾)
Attended Sun Yat-sen University
Lives in Hangzhou. China
753 followers|18,819 views
AboutPostsPhotosReviews

Stream

Wilson Xu

Shared publicly  - 
 
Three lovely Chinese figures. The old man in green hat represents longevity, The red face in the middle is one of most famous icons "Guan Yu", avatar of bravery and loyalty, the third one "Zhong Kui" is a good god killing bad ghost for people.
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
Weekly Newsletter I Subscribed.
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
Turned Raluca Budiu's (NN/g) article Mobile: Native Apps, Web Apps, and Hybrid Apps to a table for simplicity, readability and extensibility.
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
Legen...wait a min...dary!
Web Performance. Learn more about web performance tools at Google, including browser extensions and APIs for Insights, PageSpeed Service, and our optimization libraries. Give Feedback. Have comments or questions about PageSpeed Insights? Send feedback or discuss on our mailing list.
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
Autumn's coming
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
In Hangzhou, there're a lot of old bridges with beautiful names. This's 进龙桥(The bridge of forwarding dragon).
1
Add a comment...
In his circles
6 people
Have him in circles
753 people
MoHa - Ait Idir's profile photo
кристина саркисян's profile photo
Дмитрий Садиев's profile photo
алексей новгоров's profile photo
Cars for Christ's profile photo
Мирослава Цибульская's profile photo
Shalu Sharma's profile photo
Archeotel K L's profile photo
Stephen Garvey's profile photo

Wilson Xu

Shared publicly  - 
 
Hand-painted Steve Jobs, gift from a friend.
3
Tan Randy's profile photo
 
哇,是一笔画吗?
 ·  Translate
Add a comment...

Wilson Xu

Shared publicly  - 
 
Larry Page and Sergey Brin meet at Stanford. Larry, 22, a U Michigan grad, is considering the school; Sergey, 21, is assigned to show him around. 1996. Larry and Sergey begin collaborating on a search engine called BackRub. BackRub operates on Stanford servers for more than a year—eventually ...
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
 
I was asked on Twitter why Python uses 0-based indexing, with a link to a new (fascinating) post on the subject (http://exple.tive.org/blarg/2013/10/22/citation-needed/). I recall thinking about it a lot; ABC, one of Python's predecessors, used 1-based indexing, while C, the other big influence, used 0-based. My first few programming languages (Algol, Fortran, Pascal) used 1-based or variable-based. I think that one of the issues that helped me decide was slice notation.

Let's first look at use cases. Probably the most common use cases for slicing are "get the first n items" and "get the next n items starting at i" (the first is a special case of that for i == the first index). It would be nice if both of these could be expressed as without awkward +1 or -1 compensations.

Using 0-based indexing, half-open intervals, and suitable defaults (as Python ended up having), they are beautiful: a[:n] and a[i:i+n]; the former is long for a[0:n].

Using 1-based indexing, if you want a[:n] to mean the first n elements, you either have to use closed intervals or you can use a slice notation that uses start and length as the slice parameters. Using half-open intervals just isn't very elegant when combined with 1-based indexing. Using closed intervals, you'd have to write a[i:i+n-1] for the n items starting at i. So perhaps using the slice length would be more elegant with 1-based indexing? Then you could write a[i:n]. And this is in fact what ABC did -- it used a different notation so you could write a@i|n.(See http://homepages.cwi.nl/~steven/abc/qr.html#EXPRESSIONS.)

But how does the index:length convention work out for other use cases? TBH this is where my memory gets fuzzy, but I think I was swayed by the elegance of half-open intervals. Especially the invariant that when two slices are adjacent, the first slice's end index is the second slice's start index is just too beautiful to ignore. For example, suppose you split a string into three parts at indices i and j -- the parts would be a[:i], a[i:j], and a[j:].

So that's why Python uses 0-based indexing.
20 comments on original post
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
Hangzhou revolutionary martyr memories museum.
2
Add a comment...

Wilson Xu

Shared publicly  - 
 
Chinese monks' shoes.
1
Add a comment...

Wilson Xu

Shared publicly  - 
 
Aliyun Worldwide Developer Conference 2013.
1
Add a comment...
People
In his circles
6 people
Have him in circles
753 people
MoHa - Ait Idir's profile photo
кристина саркисян's profile photo
Дмитрий Садиев's profile photo
алексей новгоров's profile photo
Cars for Christ's profile photo
Мирослава Цибульская's profile photo
Shalu Sharma's profile photo
Archeotel K L's profile photo
Stephen Garvey's profile photo
Work
Occupation
Programmer
Skills
Programming
Employment
  • Tisiwi(天使湾)
    Analyst, present
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Hangzhou. China
Story
Tagline
Passionate programmer, failed entrepreneur, growing VC newbie
Introduction

Passionate programmer, failed entrepreneur, growing VC newbie at Tisiwi(天使湾创投) MicroVC in Hangzhou, China.

Bragging rights
404 yet :(
Education
  • Sun Yat-sen University
Basic Information
Gender
Male
周围没啥好吃!
Public - 2 years ago
reviewed 2 years ago
1 review
Map
Map
Map