go

Interactive CLI packages – checkboxes & selection

Interactive CLI packages – checkboxes & selection Question: I am trying to learn more about making some cool CLI interfaces to provide the options for some local scripts. By digging into the source of the yeoman-generator I was able to come across inquirer for Node, which is how I learned that it was possible. (Example …

Total answers: 2

Equivalent for Python's list comprehension

Equivalent for Python's list comprehension Question: I am playing with Go but I am having a very hard time doing things that are very simple in other languages. I’d like to reproduce a Python comprehension: array = [a for a in anotherArray if (some condition)] What is an elegant way to do it in Go? …

Total answers: 2

Different Results in Go and Pycrypto when using AES-CFB

Different Results in Go and Pycrypto when using AES-CFB Question: I am adding a go application to an already existing python codebase. I’ve been having trouble dealing with encryption between the languages. This is using go 1.2.1 and Python 2.7.x / PyCrypto 2.7a1. Here is the Python sample: import Crypto.Cipher import Crypto.Hash.HMAC import Crypto.Hash.SHA256 import …

Total answers: 6

Python equivalent of Golang's select on channels

Python equivalent of Golang's select on channels Question: Go has a select statement that works on channels. From the documentation: The select statement lets a goroutine wait on multiple communication operations. A select blocks until one of its cases can run, then it executes that case. It chooses one at random if multiple are ready. …

Total answers: 8

Can Go really be that much faster than Python?

Can Go really be that much faster than Python? Question: I think I may have implemented this incorrectly because the results do not make sense. I have a Go program that counts to 1000000000: package main import ( “fmt” ) func main() { for i := 0; i < 1000000000; i++ {} fmt.Println(“Done”) } It …

Total answers: 8

Writing a Python extension in Go (Golang)

Writing a Python extension in Go (Golang) Question: I currently use Cython to link C and Python, and get speedup in slow bits of python code. However, I’d like to use goroutines to implement a really slow (and very parallelizable) bit of code, but it must be callable from python. (I’ve already seen this question) …

Total answers: 4