Tag Info

New answers tagged

-1

Holy hell, now I really feel stupid. After looking, the file producing the error wasn't even the file I was looking in (the one I posted). As I'm new to Go, I had put a set of brackets around the for loop like you would in C# or C++. The answer to this question, which anyone reading this question should always bear in mind is always read everything ...


1

I can give you a rather generic answer that I feel is only suited to more complex use cases due to the excessive boiler plate required. You can perfectly simulate a functional paradigms in Java (they've done so in Scala) and use for example the decorator pattern to solve your problem. The general approach is to define an abstract class or an interface with a ...


2

It's similar to the RAII idiom in C++, where you put resource management code in the constructor & destructor of a class. Since Java doesn't have destructors, if you're targeting Java 7 or later you could instead (ab)use try-with-resources and an AutoCloseable (untested): class GLCoordGuard implements AutoCloseable { protected GL _gl; public ...


0

Okay, when I understood you correctly your problem is that you don't know why params inside the function is associated with the dictionary myParams you put into the function, right? Okay, lets start at the beginning: When you have the following python code, how does Python know that you can call the upper() method (which makes it all caps) on the variable? ...


0

You’re noticing the difference between parameters and arguments, and also the notion of scope. A parameter is a name that refers to a value passed into a function. Consider a trivial function definition: def f(x): return x Here, x is a parameter of f. An argument is the value assigned to a parameter during a function call. print f(42) Here, 42 is ...


1

You're right to wonder why this symbol doesn't seem to mean anything to the rest of the file, but its spelling isn't its only attribute. Consider its positioning. The confusion lies in trying to equate the parameter name and the argument name. You are right, there is no connection between the names as such. But if you saw a Python error message due to a ...



Top 50 recent answers are included