<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=OpenWest_2014%2FPython_to_Go</id>
	<title>OpenWest 2014/Python to Go - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=OpenWest_2014%2FPython_to_Go"/>
	<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=OpenWest_2014/Python_to_Go&amp;action=history"/>
	<updated>2026-04-30T05:52:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://aznot.com/index.php?title=OpenWest_2014/Python_to_Go&amp;diff=94&amp;oldid=prev</id>
		<title>Kenneth at 15:11, 17 May 2014</title>
		<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=OpenWest_2014/Python_to_Go&amp;diff=94&amp;oldid=prev"/>
		<updated>2014-05-17T15:11:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;by Brian G. Merrell&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Compile first:&lt;br /&gt;
 go help&lt;br /&gt;
&lt;br /&gt;
test.go:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package main&lt;br /&gt;
&lt;br /&gt;
import &amp;quot;fmt&amp;quot;&lt;br /&gt;
&lt;br /&gt;
func main() {&lt;br /&gt;
  fmt.Println(&amp;quot;test&amp;quot;)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
go build -o test test.go&lt;br /&gt;
&lt;br /&gt;
To just run the script:&lt;br /&gt;
 go run test.go&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Justifications:&lt;br /&gt;
* C++ too complex&lt;br /&gt;
* compilation too slow&lt;br /&gt;
* programming to difficult&lt;br /&gt;
* programmers choosing easy over safety and efficiency&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Python bad because:&lt;br /&gt;
* actually quite complex&lt;br /&gt;
* runtime errors&lt;br /&gt;
* performance&lt;br /&gt;
* doesn&amp;#039;t scale&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Go has:&lt;br /&gt;
* concurrency is a breeze&lt;br /&gt;
* no exceptions&lt;br /&gt;
* no type hierarchies&lt;br /&gt;
* no classes&lt;br /&gt;
&lt;br /&gt;
Go good because:&lt;br /&gt;
* small language (fit all in your head, have read the spec)&lt;br /&gt;
* compile time checks (fast)&lt;br /&gt;
* fast enough for even more things&lt;br /&gt;
* benefits at little cost&lt;br /&gt;
* dynamic feel with compiled performance&lt;br /&gt;
* rich standard library&lt;br /&gt;
* libraries are all written in Go&lt;br /&gt;
* great bundled tooling&lt;br /&gt;
* seems to scale well&lt;br /&gt;
* cross compiling in Go is simple&lt;br /&gt;
* Go syntax is very light and simple&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Hello World Web server:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package main&lt;br /&gt;
&lt;br /&gt;
import (&lt;br /&gt;
 &amp;quot;fmt&amp;quot;&lt;br /&gt;
 &amp;quot;net/http&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
func main() {&lt;br /&gt;
 http.HandleFunc(&amp;quot;/&amp;quot;, Hello&amp;quot;)&lt;br /&gt;
 http.ListenAndServer(&amp;quot;kicakhost:800&amp;quot;, nil)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
func Hello(w http.ResponseWrite, r *http.Request....&lt;br /&gt;
???&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Don&amp;#039;t like about Go:&lt;br /&gt;
* Naked return statements (optional)&lt;br /&gt;
 x,yz, =1,2,3&lt;br /&gt;
 return&lt;br /&gt;
* scoping rules specific case&lt;br /&gt;
* not faster than java&lt;br /&gt;
* new vs &amp;amp;T{} vs make&lt;br /&gt;
* len(&amp;quot;foo&amp;quot;) vs &amp;quot;foo&amp;quot;.Len() - but keeps lanuage simple&lt;br /&gt;
* Name &amp;quot;Go&amp;quot; is ungoogable / hastagable (use golang) *** MOST ANNOYING ***&lt;br /&gt;
* No dynamic linking in Go - makes binaries huge&lt;br /&gt;
** two compilers - may work with gccgo, just not with google&amp;#039;s gc compiler&lt;br /&gt;
** no dlopen in Go&lt;br /&gt;
&lt;br /&gt;
Python vs Go&lt;br /&gt;
* Interpreted vs Compiled&lt;br /&gt;
* Strongly typed vs Strongly typed&lt;br /&gt;
* Dynamically typed vs statically typed&lt;br /&gt;
* Garabage collected&lt;br /&gt;
* Unique syntax vs Similar to C&lt;br /&gt;
* Open Source&lt;br /&gt;
* Python Foundation vs Google&lt;br /&gt;
* more platforms vs fewer platforms&lt;br /&gt;
* 1991 vs &lt;br /&gt;
* ???&lt;br /&gt;
&lt;br /&gt;
Go does not have:&lt;br /&gt;
* Classes&lt;br /&gt;
* Exceptions&lt;br /&gt;
* Assertions&lt;br /&gt;
* Templates / generics (for now)&lt;br /&gt;
* Operator overloading&lt;br /&gt;
&lt;br /&gt;
Zen of Python&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; import this&lt;br /&gt;
&lt;br /&gt;
Go does not have:&lt;br /&gt;
* decorators&lt;br /&gt;
* static methods&lt;br /&gt;
* class methods&lt;br /&gt;
* properties&lt;br /&gt;
* iterators&lt;br /&gt;
* generators&lt;br /&gt;
* exceptions&lt;br /&gt;
* meta classes&lt;br /&gt;
* class decorators&lt;br /&gt;
* multiple inheritance&lt;br /&gt;
* list comprehensions&lt;br /&gt;
* ternary operator (expression?true:false)&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
Errors should never pass silently - sure beats runtime error&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package main&lt;br /&gt;
&lt;br /&gt;
import (&lt;br /&gt;
 &amp;quot;fmt&amp;quot;&lt;br /&gt;
 &amp;quot;net/url&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
func main() {&lt;br /&gt;
 u := url.Parse(&amp;quot;http://foo.org/index%.html&amp;quot;) // notice bad &amp;#039;%&amp;#039;&lt;br /&gt;
 /* fix&lt;br /&gt;
 u, err := url.Parse(&amp;quot;http://foo.org&amp;quot;)&lt;br /&gt;
 if err != nil {&lt;br /&gt;
   fmt.Println(&amp;quot;got error&amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 */&lt;br /&gt;
 fmt.Println(u.Host)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Zero Values&lt;br /&gt;
&lt;br /&gt;
Encapsulation - capitalized names are exported&lt;br /&gt;
&lt;br /&gt;
Slices vs Lists&lt;br /&gt;
&lt;br /&gt;
Arrays&lt;br /&gt;
&lt;br /&gt;
Slicing syntax is very similar to python&lt;br /&gt;
&lt;br /&gt;
Maps, Dicts and Sets&lt;br /&gt;
&lt;br /&gt;
Duck typing - Go uses interfaces to solve&lt;br /&gt;
&lt;br /&gt;
Exception handling - uses interfaces and type assertions to check&lt;br /&gt;
&lt;br /&gt;
Calling C code from Go&lt;br /&gt;
&lt;br /&gt;
go get - similar to pip&lt;br /&gt;
&lt;br /&gt;
Unit testing and Code coverage&lt;br /&gt;
 go test ./...&lt;br /&gt;
 go test -cover ./...&lt;br /&gt;
&lt;br /&gt;
Other tools (included)&lt;br /&gt;
 http://play.golang.org&lt;br /&gt;
&lt;br /&gt;
[[Category:Go]]&lt;/div&gt;</summary>
		<author><name>Kenneth</name></author>
	</entry>
</feed>