« first day (4326 days earlier)      last day (847 days later) » 

01:28
Where can I find the implementation of the type class? I've tried looking here to no avail.
Thanks @vaultah. Are we allowed to ask for clarification to answers posted on the main site here?
01:50
In general, I would say yes. Here are the rules of this room though, just in case sopython.com/chatroom
 
2 hours later…
03:30
Cabbage
Justed editing an answer and found myself typing "increasing pythonicity" as the reason. Thoughts on the use of "pythonicity"?
 
4 hours later…
07:30
Hi guys!
@SargeATM prob something about being more pythonic (like "describes a coding style that leverages Python's unique features to write code that is readable and beautiful")
@SargeATM Made more pythonic
 
5 hours later…
12:24
Why is (0, 0) the top left of an image?! Aaaarghhh
In any sane geometry module, increasing y means going up. Why do images have to be backwards? You want to represent an area of the image as a Rectangle? Screw you, the coordinates are upside down
I want to go into cryo-sleep until the world is less stupid.
13:12
Isn't that super common in graphics systems
Dunno. Is there a difference between images and graphics?
13:47
@Aran-Fey This history lesson is here and it looks like convention might have carried over into some image formats and not others
Wow, that's from way back when
14:07
What's harder to find is what image format uses which convention in a list somewhere. Seems like it would be nice to have some list to crossref against if you were making an app to deal with e.g. jpeg and .png
14:21
It's nothing quite that low-level, I'm just dealing with PIL
Well, that and I have to decide if I want to go along with the y-is-down convention or not
 
2 hours later…
16:15
Half-serious proposal: define the constants UP = -1; DOWN = 1 and incorporate them into every expression in your program that does arithmetic on y coordinates. e.g. rewrite sprite.move(23, 42) as sprite.move(DOWN*23, 42)
Then, if it turns out that PIL disagrees with you about what direction "up" is, you only need to move one hyphen in your code
As for the geometry side of things, I decided to make my own Rectangle plus UpsideDownRectangle. Still unsure about the API design though. I want to add a switch like library.get_some_rectangles(upside_down=True), but I can't decide on a name and default value for the parameter
A super-generalized approach could be: define a method transform(self, matrix) on all of your geometry types, which makes it easy to apply any affine transformation to them. Then flipping the entire scene is as easy as scene = scene.transform([[1,0],[0,-1]])
Oh, I'm not planning to implement something as fancy as transforms. I have 3 classes Point, Vector, and Rectangle that support +, - and in and that's pretty much it
Plus the UpsideDownRectangle which swaps the meaning of rect.top and rect.bottom
Valid. I was just about to say it's likely overkill. And you'd have to figure out what to do if a transformation turns a rectangle into a non-rectangle. It could be easily skewed into a parallelogram, for instance.
16:39
On the bright side, it's impossible for an affine transformation to turn a parallelogram into a non-parallelogram. So you wouldn't need to worry about implementing __contains__ for arbitrary quadrilaterals. Just parallelograms, which I reckon is considerably easier
Definitely, because parallelograms are guaranteed to be convex
16:58
fun fact, the BMP format considers the bottom left corner of the image to be the "first" pixel. It gets stored in the first slot of the pixel array. Compare to, say, png, where the top left corner gets the first slot.
Honestly, it makes sense to store the top of the image at the start of the file. Gives it more time to load, since we always scroll from top to bottom
I was about to say "... Unless it's an interlaced png", but upon closer inspection, the top left corner is still the first pixel in the array, even though everything else gets jumbled around. Top left is getting preferential treatment, no fair
 
2 hours later…
19:10
@KarlKnechtel Java marketed itself on this?
19:52
I finally got bored enough to answer a pandas question on SO. But in my wanderings from that through other questions, I think I've found the most impressive pandas one-liner in existence
intermediate_df = df.groupby(by=['country','grade','category','id'], as_index=False).agg(int_totals=pd.NamedAgg(column='amount',aggfunc='sum'),int_counts=pd.NamedAgg(column='id',aggfunc='count')).groupby(by=['country','grade','category'], as_index=False).agg(mean_totals=pd.NamedAgg(column='int_totals',aggfunc='mean'),mean_counts=pd.NamedAgg(column='int_counts',aggfunc='mean'))
... How does someone conceive of this?
Sorry, it's syntactically invalid at the end, actually, because it overspills the chat char limit. Wow
huh, or not. I didn't realise the code formatting gave a scroll bar in chat until just now (or I just forgot)

« first day (4326 days earlier)      last day (847 days later) »