« first day (359 days earlier)      last day (2871 days later) » 

9:01 PM
@Suever Wow. That's so good! :-)
 
And it's 100% scalable. It has any number of octave workers that just sit around waiting for things to do which we can increase/decrease the number as needed
And it only launches octave once per worker and just cleans itself up after it's done with a job so we don't waste time relaunching
 
Just made a variable tramp for a ramping time. #DontCare
 
you can also save the time stamp for the start of ramping, trampstamp
 
9:17 PM
:D
 
tramp for president
 
oh international politics, fun times we're having:P
Let's talk about Masi's new avatar instead
 
Wow
hardly recognized him
 
wow.
 
you gotta love 'em now, dont you?:D
 
9:26 PM
This question lmao
30
Q: What's the difference between "2*2" and "2**2" in Python?

MasiWhat is the difference between the following codes? code1: var=2**2*3 code2: var2=2*2*3 I see no difference. This raises the following question. Why is the code1 used if we can use code2?

A Masi question... that would have been solved by RTFM
This comment - very insightful
When you make tests with numbers follow these 2 rules: only use prime numbers (you were ok) and never use 2 twice. — Luc M Jun 25 '09 at 19:35
 
:D
some deep shit
 
@Suever "Octave workers that sit around waiting for things to do" I like how that sounds :-)
@rayryeng huh, even I know that!
 
@LuisMendo idlers
 
@LuisMendo :D
mind you, that question was written almost 7 years ago
maybe documentation wasn't as available back then... or it was... I dunno
g2g folks. have a great weekend :)
 
Let's assume so :-)
 
9:34 PM
Later @rayryeng :)
 
Nice weekend you too, @rayryeng!
 
night @ray
I'm pretty sure 2**3 was documented 7 years ago
python is not that young
 
It's a weird notation anyway. What do they use ^ for?
 
It was documented in 2001 at the latest
^ is XOR in C
 
and in python too
 
9:39 PM
yep, just found it
which is really weird if you think about it
 
>>> [i^j for i in [0,1] for j in [0,1]]
[0, 1, 1, 0]
 
if anything it should be AND
 
a**b comes from fortran or a common relative
 
@AndrasDeak implicit expansion along the same dimension?
 
@LuisMendo nested list comprehension:)
>>> [k**2 for k in range(5)]
[0, 1, 4, 9, 16]
this is equivalent to arrayfun(@(x)x^2,0:4)
only tyipically the fastest solution around, unlike arrayfun
 
9:42 PM
So nested list comprehension expands along a common dimension. Interesting
 
(well, at least as long as native python is concerned)
@LuisMendo it doesn't know any dimensions, it's just a compact form of a double loop
the above is equivalent to
out=[]
for i in [0,1]:
    for j in [0,1]:
        out.append(i^j)
where out will be the list containing the output
 
I see. That append collapses all dimensions, in Matlab terms
 
no, append only adds an item to a list:)
a python list is like a matlab cell, only less crappy
 
@AndrasDeak Brilliant!
 
@TroyHaskin stop reading, I brought some python:D
 
9:45 PM
@AndrasDeak that's a good definitition!
 
and linear...:D
 
You kids and your tuples.
 
tuples are weird
 
I still can't decide whether to say the equivalent of dict is a containers.Map or a struct using dynamics fields. I know the former is probably more correct, but the latter has basically the same facilities to my knowledge.
 
I don't know containers.Map to say anything about that, but a struct is very close (with the difference that your keys can be anything that is hashable, not just valid variable names)
 
9:51 PM
@AndrasDeak For some reason I thought they were the same. So I did a google search, found this question, and read through the referenced dup.
Why can't everyone else do that?
 
the same as what?
oh, tuples and lists
yeah, the difference is the point:)
mutability kills
 
stoopid mutants
 
@AndrasDeak Yeah. It is a little annoying that field names must be valid variable names.
 
@TroyHaskin I agree
 
@AndrasDeak I remember when I first started learning JavaScript and was like "why in the seventh layer of Hell are strings immutable? Matlab is so much better".
 
9:54 PM
:)
python strings are also immutable
but you don't really notice
mutability is overrated
 
@AndrasDeak Indeed. It seems to be a very common thing. Even Fortran had static allocation of character element lengths for the longest time.
 
yup, you can usually even read those in the executable:D
 
@AndrasDeak Careful. You might fall down the Functional Black Hole if you take that statement too far.
 
@TroyHaskin oh I'm in no peril of that
parentheses repel me
 
Too far down?
Ah! Hahaha.
 
9:57 PM
the main issue with mutability is that there are slightly obscure language features that can bite newbies in the ass badly:)
my favourite is a mutable default parameter for a function: def fun(x0=1,y0=1,points=[]): ...
if you call this function without passing a value for points, it will be an empty list. The first time you call the function. :D
but if you append to the list in one of the function calls, its value is retained
 
Dear Gods.
 
if the definition had points=(), an empty tuple, which is immutable, that wouldn't happen
 
Good to know if-and-when I start the Python-ing.
 
I know of 2 or 3 such odd quirks so far, that can be pretty bad pitfalls
otherwise I'm pretty happy with the language:)
 
A similar thing happens in Fortran90 where variables that are initialized in their variable declaration have an implicit save (state) applied to it. A little upset when I found that one out.
 
10:02 PM
oh, indeed
fortunately I read that before encountering it:)
by the way my first question on SO was about a similar oddity, but that turned out to be crappy code and undefined behaviour
I passed a data (constant) array to a subroutine, which tried to modify it
 
Nice.
 
by the time I asked the question I realized what the issue was, during the process of MCVEing
 
You asked before MCVEing?! Heresy.
 
no, I MCVEd before asking:)
that's why the question goes "why don't I get a warning or whatever" and "why is there inconsistent behaviour" and not "what did I do wrong":)
 
Oh, well. Continue on then, good sir.
 
10:07 PM
:D
(that's it)
 
10:18 PM
From this answer I gather that mutable / immutable can be likened to pass by reference / by value. Correct?
 
no
mutability is the inherent property of an object, telling you whether it can be mutated. As in changing its value without reassigning
it's hard to explain in matlab terms
it all ties in with how variables work in python
When you say x=3, you set the name x to point to an integer with value 3. When you say x=2, you rebind the name x to point to another integer. When you say x=[1,3,4], you again rebind to a list. If you say x[0]=2, you mutate the list to which x points, while x points to the same underlying object
 
Well the examples in the answer sound like "pass by reference" for "mutable": the reference object is changed, as opposed to a new copy being created within the function. Pass by reference is also a non-Matlab term
 
Yes, but mutability isn't defined in terms of a function call
 
@AndrasDeak Yes, that makes sense. Thanks for the explanation. To me that's more or less the same as by reference / by value
 
If you have the time and are interested enough, here's a very good explanation of names and mutability: nedbatchelder.com/text/names.html
@LuisMendo it's similar in a sense:) The end result is similar. But it's an inherent property of the objects
 
10:23 PM
@AndrasDeak Thanks! That's long, but I'll give it a try :-)
 
and the only difference (probably) between lists and tuples is that tuples are immutable
 
@LuisMendo That is what re-binding is. And in Matlab, I've only encountered those semantics when using lexical closures.
 
@AndrasDeak Very good indeed! I just finished it. I still think that mutable / immutable is analogous to pass by reference / by value. Or rather, to reference / value (not necessarily passing) :-)
 
OK:)
 
Ooops
good, not food
:-)
 
10:35 PM
yeah, I got that;)
 
Very food. Much deed.
 
@TroyHaskin :-P
 
But yeah, I actually have a method on all of my objects called bind which performs the referencing and relies on the fact that Matlab is copy-on-write.
 
lazy-ass matlab
though not as bad as haskell
 
10:39 PM
@LuisMendo I think that the differences between immutability and pass-by-value are that variables passed by value can be changed locally, and in the originating scope of the variable it is mutable
immutable variables are immutable everywhere
 
but there can be fun things: a=(1,2,'a',[3,4,5]) is an immutable tuple, you can't do a[2]=1, but you can do a[3][0]=1 to get (1,2,'a',[1,4,5]) :D
because the fourth element of the (immutable) tuple is a (mutable) list
 
ugh
 
Sorry for coming up with the weirdest shit in pyhon, it's really much better than I make it look:)
As I said, there are only a few of these which I know of (so far).
 
no, it's really just random "hey, this would be cool!" thrown together in an oddly OCD fashion
 
and of course these make sense too if you learn how names work
 
10:42 PM
at least from my vast 30-minute experience ;)
 
most of it is really elegant and logical, some of these oddities are emergent
like the previous one, it actually makes sense: the reference to which a[3] points can't change, because a is immutable
but the object that resides at that address can change, since that is mutable
the tuple doesn't know anything about it
the "mutable default function parameter", on the other hand, should be a conscious choice made by (probably) Guido van Rossum, which I personally disagree with
 
well yeah, if what the tuple contains is a reference to the mutable list
 
yup
 
11:11 PM
@beaker True. My "mutable / immutable" vs. "reference / value" was meant more as an analogy than as a correct statement
 

« first day (359 days earlier)      last day (2871 days later) »