<story><title>What Python developers need to know before migrating to Go</title><url>http://blog.repustate.com/migrating-code-from-python-to-golang-what-you-need-to-know/2013/04/23/</url></story><parent_chain><item><author>n1ghtm4n</author><text>Some thoughts after spending ~100 hours with Go.&lt;p&gt;- Function overloading is a major convenience that you will miss. There are differently named versions of every function and you will call the wrong version with the wrong arguments &lt;i&gt;all the time&lt;/i&gt;. The number of functions in the standard library could be reduced by at least 1&amp;#x2F;4 if they&amp;#x27;d got this right. The official FAQ (&lt;a href=&quot;http://golang.org/doc/faq#overloading&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;golang.org&amp;#x2F;doc&amp;#x2F;faq#overloading&lt;/a&gt;) explains that leaving out overloading is &amp;quot;simpler&amp;quot;, meaning &lt;i&gt;simpler for them&lt;/i&gt;.&lt;p&gt;- Default parameters are a major convenience that you will miss. Using strings.Replace() to remove some chars from a string? Don&amp;#x27;t forget to pass the -1 at the end, asshole! The -1 says don&amp;#x27;t put a limit on the number of replacements. In Python there would be a max=None default parameter and this would never bite anyone.&lt;p&gt;- No named arguments, because fuck readability.&lt;p&gt;- Forcing me to handle errors is great. Having 20 different ways to do it is not great. Examples: fmt.Errorf(), fmt.Fprintf(os.Stderr), errors.New(), log.Fatal(), log.Fatalf(), log.Fatalln(), panic&amp;#x2F;recover...&lt;p&gt;- Using &amp;amp;&amp;amp; and || for logical operators in this day and age is just ridiculous. Why do people keep inventing programming languages as if Python doesn&amp;#x27;t exist?&lt;p&gt;- Don&amp;#x27;t think that just because the Unicode guys invented Go that Unicode is going to be easy. Their solution is not to create an airtight abstraction layer between chars (or &amp;quot;runes&amp;quot; WTF?) and integers. Their solution is to provide almost no abstraction and force you to deal with the inherent integer-ness of all characters. Example:&lt;p&gt;In Python:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    len(&amp;quot;нєℓℓσ&amp;quot;)  # 5, because there are 5 chars&lt;/code&gt;&lt;/pre&gt;
In Go:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    len(&amp;quot;нєℓℓσ&amp;quot;) &amp;#x2F;&amp;#x2F; 12, because there are 12 bytes
    utf8.RuneCountInString(&amp;quot;нєℓℓσ&amp;quot;) &amp;#x2F;&amp;#x2F; 5, plz kill me i am an abomination
&lt;/code&gt;&lt;/pre&gt;
tl;dr If you&amp;#x27;re inventing a programming language for human beings (not UNIX gods), try it out on a group of smart high school students first. It will be a humbling experience.</text></item></parent_chain><comment><author>derefr</author><text>&amp;gt; between chars (or &amp;quot;runes&amp;quot; WTF?) and integers.&lt;p&gt;&amp;quot;Runes&amp;quot; were the original name, as implemented in Plan 9 by the same folks, for what the standards committee later decided to call the relatively blaze term &amp;quot;Unicode codepoints&amp;quot;--and which are not quite the same thing as characters.&lt;p&gt;(In fact, I would say that the notion of a Unicode &amp;quot;character&amp;quot; is ambiguous to the point of uselessness--there are &lt;i&gt;glyphs&lt;/i&gt; composed from several codepoints (base glyph + combining accents), which should be treated as one &amp;quot;character&amp;quot;; there are &lt;i&gt;ligatures&lt;/i&gt; that hold single codepoints, but which semantically are &lt;i&gt;multiple&lt;/i&gt; &amp;quot;characters&amp;quot;; there are stacking languages where one &amp;quot;character&amp;quot;, representing a whole word, will be composed together from several codepoint &amp;quot;radicals&amp;quot;; while in other ideographic languages, each pre-composed idea-part is its own &amp;quot;character&amp;quot; and has its own codepoint; and so forth.)</text></comment>
<story><title>What Python developers need to know before migrating to Go</title><url>http://blog.repustate.com/migrating-code-from-python-to-golang-what-you-need-to-know/2013/04/23/</url></story><parent_chain><item><author>n1ghtm4n</author><text>Some thoughts after spending ~100 hours with Go.&lt;p&gt;- Function overloading is a major convenience that you will miss. There are differently named versions of every function and you will call the wrong version with the wrong arguments &lt;i&gt;all the time&lt;/i&gt;. The number of functions in the standard library could be reduced by at least 1&amp;#x2F;4 if they&amp;#x27;d got this right. The official FAQ (&lt;a href=&quot;http://golang.org/doc/faq#overloading&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;golang.org&amp;#x2F;doc&amp;#x2F;faq#overloading&lt;/a&gt;) explains that leaving out overloading is &amp;quot;simpler&amp;quot;, meaning &lt;i&gt;simpler for them&lt;/i&gt;.&lt;p&gt;- Default parameters are a major convenience that you will miss. Using strings.Replace() to remove some chars from a string? Don&amp;#x27;t forget to pass the -1 at the end, asshole! The -1 says don&amp;#x27;t put a limit on the number of replacements. In Python there would be a max=None default parameter and this would never bite anyone.&lt;p&gt;- No named arguments, because fuck readability.&lt;p&gt;- Forcing me to handle errors is great. Having 20 different ways to do it is not great. Examples: fmt.Errorf(), fmt.Fprintf(os.Stderr), errors.New(), log.Fatal(), log.Fatalf(), log.Fatalln(), panic&amp;#x2F;recover...&lt;p&gt;- Using &amp;amp;&amp;amp; and || for logical operators in this day and age is just ridiculous. Why do people keep inventing programming languages as if Python doesn&amp;#x27;t exist?&lt;p&gt;- Don&amp;#x27;t think that just because the Unicode guys invented Go that Unicode is going to be easy. Their solution is not to create an airtight abstraction layer between chars (or &amp;quot;runes&amp;quot; WTF?) and integers. Their solution is to provide almost no abstraction and force you to deal with the inherent integer-ness of all characters. Example:&lt;p&gt;In Python:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    len(&amp;quot;нєℓℓσ&amp;quot;)  # 5, because there are 5 chars&lt;/code&gt;&lt;/pre&gt;
In Go:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    len(&amp;quot;нєℓℓσ&amp;quot;) &amp;#x2F;&amp;#x2F; 12, because there are 12 bytes
    utf8.RuneCountInString(&amp;quot;нєℓℓσ&amp;quot;) &amp;#x2F;&amp;#x2F; 5, plz kill me i am an abomination
&lt;/code&gt;&lt;/pre&gt;
tl;dr If you&amp;#x27;re inventing a programming language for human beings (not UNIX gods), try it out on a group of smart high school students first. It will be a humbling experience.</text></item></parent_chain><comment><author>callenish</author><text>&amp;gt; In Go:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    len(&amp;quot;нєℓℓσ&amp;quot;) &amp;#x2F;&amp;#x2F; 12, because there are 12 bytes
    utf8.RuneCountInString(&amp;quot;нєℓℓσ&amp;quot;) &amp;#x2F;&amp;#x2F; 5, plz kill me i am an abomination
&lt;/code&gt;&lt;/pre&gt;
I&amp;#x27;m not sure I understand your objection. Bytes and UTF8 characters are different things, and you can&amp;#x27;t abstract away the difference. There are also times, perhaps the majority of times, when you will need the byte count of a UTF8 string. That means you need at least two different length functions for strings and they need different names.&lt;p&gt;Shouldn&amp;#x27;t UTF8-specific things live in the utf8 namespace? Some programs won&amp;#x27;t need any string handling, after all, and it would be a waste to include code they never used.&lt;p&gt;Assuming you can allow the utf8 namespace as sensible, would you feel better if there was a RuneLen() function aliased to RuneCountInString()?&lt;p&gt;If you are that upset about it, then my suggestion is to explain your rationale and submit a patch[1] to provide the alias. It&amp;#x27;s not like it would be hard to code. Perhaps you might convince people and get it in the next release.&lt;p&gt;[1] &lt;a href=&quot;http://golang.org/doc/contribute.html&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;golang.org&amp;#x2F;doc&amp;#x2F;contribute.html&lt;/a&gt;</text></comment>