« first day (3169 days earlier)      last day (1770 days later) » 
00:00 - 16:0016:00 - 00:00

4:00 PM
A slightly misleading riddle about a useless detail:
# Complete the following class in such a way that its instances have a
# __dict__, yet "__dict__" can't be found in the __slots__ definition.

class Cls:
    __slots__ = ...  # YOUR CODE HERE

obj = Cls()
assert hasattr(obj, '__dict__'), "You didn't create a __dict__ slot"
assert '__dict__' not in Cls.__slots__, "__dict__ may not appear in __slots__"
print('You win!')
 
Upside: by necessity we've pretty much become a paperless workspace. Hooray for the environment!
 
If you come up with a solution that feels like a hack... it's probably correct
 
__slots__ = replace_stdout_with_an_object_that_prints_you_win()
 
You'll get partial credit for that if you can do it in a single line :P
 
Hijacking stdout is my go-to "obviously in violation of the spirit of the riddle" solution for all problems. It never fails :^)
 
4:05 PM
But no, the intended solution should properly pass the assertions
 
Hmm, might need to hijack stderr too since those asserts are going to raise exceptions
 
Basically what I'm saying is that I used some weasel words in the description of the task
 
I think I get the gist of the exercise, although I'm currently distracted by writing a one line stdoutjacker
 
Would I be right in assuming __slots__ = (); __dict__ = {} isn't allowed?
 
Oh, nice loophole! Not the intended solution, unfortunately :)
 
4:15 PM
<--- Knows nothing of __slots__ and will be peaking at all spoilers.
 
@piRSquared do you think get will be slower in such cases? compared to .loc[]
 
It's the apply that'll be slow. And using get inside a nested comprehension is pretty much the same as WeNYoBen. I originally used m = df9.text.str[0].get; df8.assign(content=[[*map(m, x)] for x in df8.names])
 
ahh, so we can use get in such solns
 
that's list(map(m, x)) for non-golfing solutions
 
thank you. :)
 
@Aran-Fey I claim my partial credit, or perhaps partial partial credit because this isn't strictly speaking one line. It's 15 lines comprising one assignment statement.
Pretty sure there are a half dozen easier ways to do this (even more if I'm allowed to bail out early with sys.exit) but I'm hardly optimizing for simplicity here
 
Hmm, it doesn't print "You win!" for some reason
oh right, 'cause it crashes
*facepalm*
@Kevin Nah you get full partial credit. :P I appreciate being able to read it
Wait, no, it doesn't crash... I'm so confused
It prints "You win!" when I press Ctrl+D
l=["You win!\n"] <- fixed it
 
4:51 PM
Things might be going wonky because I made flush do nothing. Changing it to flush old stderr instead might help.
I also submit ideone.com/3NciMD for the underhanded category. This one actually makes it through the asserts.
 
Not the intended underhanded solution (:
 
I thought it was going to be something like abusing NFKC normalization, but it works the opposite way :(
 
Now that my Strange Mood is over, maybe I'll actually take the time to learn how __slots__ actually works
 
Huh, that'd make good riddle material though
 
Ok, my actual submission: view spoiler
 
5:01 PM
Yup, that's it
 
@Peilonrayz hey, it's fun that your top tag is :)
 
I guess this is one of those weird behaviors that you shouldn't ever do in a practical program, but which the language devs haven't gone out of their way to make illegal because it would take a lot of work
Possibly "solve the Halting Problem" levels of work
 
There's an easy solution, though: "__slots__ must be a spoiler"
 
@AndrasDeak Wat, I'm also missing my JS tag... huh
 
There must be some galaxy-brain level explanation for why "__slots__ must be a spoiler" isn't the current standard. Unfortunately my chakras aren't aligned today, so I can't see it
"Keeping the interface general makes it easier to extend the data model with new features in future versions of Python" broadly applies to all design choices like that, I suppose
 
wim
5:13 PM
__slots__ = "__dict__", "__dict__"   # try for a cute error message
 
Huh. And yet __slots__ = 'x', 'x' is allowed.
 
wim
what to do when a commenter wants to really widen the scope of one of your old answers? (here)
 
Hahaha, doing __slots__ = ['x'] * 999 actually creates 998 x slots you can't access, nice. Good job
 
wim
1. ignore 2. flag 3. reply 4. other .. ?
 
Either tell them to ask a new question or ignore them, depending on your mood
Mini-puzzle: How do you cause this error message?
> TypeError: descriptor 'b' for 'B' objects doesn't apply to 'A' object
 
5:32 PM
@wim 1 or 3
 
5:56 PM
Umm.... Don't often see code such as: if not something == 2... guessing it was a more complicated statement and just reduced and not rewritten as != for some reason...
 
wim
wrong room?
 
> One common “currency” in medical and safety analysis is the micromort: a one-in-a-million chance of death. People appear to be willing to pay about 10.000 Dollars more for a safer car that halves the risk of death, or about 50 Dollar per micromort.
^ Boy am I glad uni is teaching me relevant skills I'll definitely need in life
 
wim
ahh the $/μ☠️
 
@wim huh?
 
School doesn't teach you relevant life skills. School is a gauntlet that proves that you can follow instructions and remember things. If you want relevant life skills, ask your dad how to change your oil.
 
wim
6:03 PM
@JonClements msg seemed random and had no context for anything being discussed in the room, I thought it was a mistake
 
Ahhh okay... just doing a code review and just found that line odd... was about... so just kind of commented here...
 
I don't trust not a == b because I can never remember if it evaluates to (not a) == b or not (a == b)
 
wim
changing your own oil is ~60 $ μ⁻¹☠️⁻¹
 
a is not == b
 
wim
@Kevin it's the latter
 
6:07 PM
If a and b are both bools it doesn't matter but heterogeneous types can get wacky
>>> not "" == False
True
>>> (not "") == False
False
 
wim
and if you mess with __ne__ it might be something entirely different to a != b
 
OK whatever :P
 
has bugs though
Been a while since I encountered it, but I think something goes wrong if you select multiple lines and backspace/del
(don't ask me why)
 
seems to work on safari. Maybe it's a browser related issue
 
6:15 PM
@wim I don't like "μ⁻¹☠️⁻¹" I've never seen "1 / km" as "k⁻¹m⁻¹"
 
@cs95 Did it work out of the box or did you have to change all those http:// URLs to https:///*://?
 
@piRSquared oh, I see what you mean, sorry
 
wim
cigarette butt density on our state highways is 500 k⁻¹m⁻¹
 
Apology accepted even though I don't what for @ad
 
I originally interpreted your message as "I've never seen a unit expressed with a negative power before" before I understood it to mean "I've never seen a unit where its 'micro' prefix has an exponent too"
The former is pretty common and the latter isn't something I've seen before today
 
6:22 PM
exactly, I remarked that the former happens often and then I realized he meant the latter which is invalid
 
admittedly, I could've been less terse
 
I think the reader can (eventually) derive the intended meaning as long as they know that "k" by itself doesn't correspond to any SI unit
 
@Aran-Fey worked just like that
 
Exercise: assuming "k" stands for "kilobyte", devise a scenario where you might measure something in kilobyte-meters^-1.
 
why do we have to assume "k" stands for "kilobyte" when you wrote out "kilobyte"?
 
6:28 PM
stackoverflow.com/questions/56691690/… So confusing with so many Mike's
 
Data density on a CD
 
I like to throw superfluous information into my word problems. Gives em character.
 
so you didn't mean "kilobyte-ilobyte"?
 
You have to replace the k in "kilobyte-ilobyte" too. And the k in "kilobyte-ilobyte-ilobyte"
 
kilobyte-ilobyte-ilobyte is a trilobyte
 
6:33 PM
Recursion Golf: What is the most succinct way to produce a RecursionError
 
Ill-O-byte is my rapper name
 
Warning: Work place chuckles are approaching audible!
 
On the topic of recursion, I was disappointed today when I tried to create a self-referential AST and it merely segfaulted instead of executing forever.
import ast
x = ast.parse("print('GOTO 10') or 1", mode="eval")
x.body.values[1] = x.body #should make the expression equivalent to `print('GOTO 10') or (print('GOTO 10') or (print('GOTO 10') or (...)))
eval(compile(x, "", mode="eval"))
 
pd.Series([np.nan,[]]).where(pd.isna,[]) OK done.
 
@piRSquared 16 characters
 
6:37 PM
Nicely done
 
Ha, I just wrote the same answer, character-for-character
 
wim
isn't it even less without a lameduh
 
And @cs95 lol I remember that
 
Disclaimer, not a golf answer
 
wim
it's 15 with a def right?
 
6:39 PM
@piRSquared 14 characters, REPL only: view spoiler
 
def f():f();f()
doesn't do anything ^ /-: what am I doing wrong
 
wim
you need newline char
instead of semicolon char
 
@wim yeah, looks like 15
 
No function definitions used: 19 characters
 
24 characters but interesting
 
wim
6:47 PM
shortest way to make a TypeError? I got 3 chars..
 
wim
@piRSquared if you are longer than 20 you are already worse than raise RecursionError :P
 
@wim hah! that is too funny
 
Cabbage! I'm stepping through code that involves a threading.Thread, and would like to confirm an assumption I am having about what the debugger tells me (pycharm's documentation on debugging doesn't seem to address this): am I correct that when seeing <type.Type object at 0x7f5d88498b00>, the instance is not the same one as another that is seen a different address <type.Type object at 0x7f2d15553828>?
 
wim
6:50 PM
I can't see pastebin but I guess there are many ways to do it
didn't find any 2 chars yet
 
@FélixGagnon-Grenier I can't think of a situation where an object moves to a new address during its lifetime, so I think it's safe to assume those are different instances.
 
@FélixGagnon-Grenier yep
 
3 chars using our fun IPython trick
@cs95 Gah, exactly the same thought, I didn't even need the last char though :/
 
:) I see. welp, that is... an interesting situation
 
wim
6:54 PM
safe in cpython
 
wim
since id is memory-location based and id has to be preserved for lifetime
I don't believe that Python itself has such restriction (id being memory address based) though
how did you use spoiler app again
still broken for me
@AndrasDeak on a tape
 
If you were using multiprocessing, I might expect your Queue/Pipe objects to have different addresses in each process. but you're not using multiprocessing, so I don't know why I'm bringing this up.
 
possibly in case I'd have simply not mentioned it?
 
7:00 PM
Possibly :-P
 
Data density on a tape would be kilobyte per meter, wouldn't it? I'm looking for "[thing] per kilobyte per meter"
"cost of driving a truckload of tapes down the highway" might be measured in dollars per kilobyte-meter... Does that count? I don't know who I'm asking since I'm the one that posed the challenge.
 
holy mother of xy problem.. I er... had FLASK_DEBUG active, which while quite useful, seem to launch the app twice (I thought it was simply an artifact of the logging). Is that, somewhat how it's supposed to be, or did I screw something up in a higher league fashion?
 
It doesn't launch twice, it launches two threads/processes (I think threads); one of them watches for changes in your source code so that the development server will reboot when you change your code
 
this would explain that
 
7:10 PM
Although, that answer isn't totally satisfying for me on why you get duplicate log entries
Is this using the development server?
 
Are you on linux? Does it appear as 2 process IDs?
It's 2 processes. The thread confusion for me came from the dev server now also launching in with threaded=True by default
 
re-cabbage
 
7:25 PM
mm, I just got a rep notification of +-1. I've never seen that before. It was in green and now I'm 1 rep lower. Wut?
 
@roganjosh unsure about the process ids. it's launchbed from pycharm, so I think the processes are all named "java"
 
Oh, helpful
 
wim
@Kevin ok. that's not what you originally asked :P
 
@Aran-Fey nice
 
7:36 PM
@Kevin ah
 
@Kevin that is bandwidth, methinks.
 
wim
bandwith is per time
 
bandwidth is kevin'd
 
@FélixGagnon-Grenier I'm guessing the extra process launched by DEBUG just ends up adding a duplicate logging handler, even though it's described as a child process that is supposed to just be watching for file changes. I don't have a strong enough understanding of singletons across multiple processes but that's probably where I'd start if I did want to understand why
 
wim
number of pigeons needed to do your backups via IPoAC ...?
 
7:40 PM
@wim I should never have clicked the little notification. Then I wouldn't have seen the two -1 rep events :(
If I'd waited for Syzygy, maybe it would have been resolved in my favour
 
wim
"birdwidth"
 
What side of a bird has the most feathers?
 
The outside.
 
badum-tsh
 
If they're used for bedding, isn't it the right? For some odd reason I have it in my head they use feathers from the left
Which now seems nuts. Why is that in my head? I probably fell asleep with YouTube playing and random play went into the darker realms
 
7:48 PM
that does sound nuts
 
@piRSquared I hope this doesn't work: (f:=lambda:f())()
 
How do you get down from an elephant?
You can't - you get down from a goose
 
@PM2Ring It does :)
Python 3.8.0a4 (v3.8.0a4:c1004b8546, May  6 2019, 16:50:16)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> (f:=lambda:f())()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  File "<stdin>", line 1, in <lambda>
  [Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded
 
Well, I wasn't that far off. It's not bedding, it's badminton shuttles. inverse.com/article/…
 
@Devesh when comment flagging... it's perfectly reasonable to flag the post itself with a custom reason and put in something like: "all comments are no longer needed" rather that flagging each comment individually... not that it matters much, but at least then it's a single flag rather than quite a lot :)
 
7:51 PM
@PM2Ring grats, you've found another reason for people to hate on walrus ops :P
 
I knew something relied on feathers from the left side
 
@JonClements Okay will keep in mind, I didn't know there was such an option
 
@cs95 It should be popular with fans of JavaScript.
 
PythOnScript or POS for short
 
@PM2Ring It's very javascript-y indeed
 
7:55 PM
Is the type error within less than 3 chars game over?
 
(({please}) => ({make: please}))({please: 'please'}).make
 
I had a question about one of the solutions
 
Not if you keep it going
 
Hah, I am not that well versed in python to make a guess
 
7:56 PM
@PM2Ring that's what I came up with when the challenge was posted, but Aran's saner version was shorter so I didn't bother posting
 
2 characters to beat, but it relies on IPython so 3 is still a decent target to beat
 
although how do I install Kevin's userscript
I have tampermonkey installed
 
@FélixGagnon-Grenier I've hardly touched JS in the last decade, so I'm not familiar with its recent features. But I was writing closures etc in JS long before I discovered Python.
 
@DeveshKumarSingh then just like any other userscript
open the "raw" version, TM should offer to install it
 
@AndrasDeak That did it
Best I could come up was 5 characters view spoiler
 
8:02 PM
you can golf off 1 character
 
In this? golf off as in get rid off?
 
Yes
 
aah, okay not many characters to get rid off, let me think
btw the solutions to recursion errors were quite good, I hope they are added by @Aran-Fey in the riddles page
aah okay view spoiler should be 4 characters
 
How do you have fancy quotes as valid Python? Is that caused by copy/paste somehow?
 
I copied from ipython terminal, so maybe a copy/paste
 
8:08 PM
@wim Could you post the solution to this puzzle?
 
have any you guys ever used paramiko?
 
@PM2Ring :) I think (ab)using parens was a way to write slightly less scope ingucing madness in the past
 
8:27 PM
"ingucing"
 
I have 10 thumbs
 
@FélixGagnon-Grenier who are the people you got them from?
 
It's classified.
But it's rumored one of them has much smaller hands now.
 
And have difficulty eating sandwiches
 
I apologized a few times, sandwiches are a real loss
 
8:42 PM
Koalas have two thumbs on each hand, but they are not known for eating sandwiches.
 
@FélixGagnon-Grenier "one of them"? So you presumably harvested thumbs from someone else who had more than the average number of thumbs?
 
9:02 PM
@cs95 My router is playing up. I was trying to delete the comment as soon as you made the edit
 
ah, np
 
It was you that made me realise the string methods in pandas can't be trusted for efficiency, and I then realised it extended to datetimes. I wasn't gonna let you get away with your ambiguous statement after dropping that bombshell on me like a year ago :P
 
no, datetimes are vectorized because they're ints under the hood
 
The datetime conversion, but not .dt methods
 
ah. Probably not. But they're convenient as heck. And that canon on loops came out in jan :P
 
9:06 PM
Feels like a years, such is the crushing-ness (?) of the revelation
 
wim
@Aran-Fey no, I don't have edit priviliges on that page
@DeveshKumarSingh used extensively at WimCorp
 
The spoiler is enough to make me not want to go near the problem.
 
wim
9:21 PM
@PM2Ring on the other hand, more thumbs
 
10:04 PM
@wim that was one of my several guesses. still can't get it to work though
ooh w8
nvm... still not familiar enough
 
wim
how many different TypeError messages can we make in 3 chars?
the solutions page has these:
'int' object is not callable
bad operand type for unary +: 'str'
unsupported operand type(s) for @: 'int' and 'int'
things like -{} and ~1j are more variants on "bad operand type"
I wonder if there are some others ...
 
10:22 PM
_() --> TypeError: 'DataFrame' object is not callable but I'm pretty sure that's cheating
 
notebook?
 
Spyder IPython console, but it wouldn't matter with _
 
wim
IPython is cheating, and _ is cheating
besides its the same message as for 1()
 
You only specified int in the initial list :P
@piRSquared in the off-chance I'm not teaching you to suck eggs: stackoverflow.com/questions/1538832/…
 
wim
I meant the messages modulo unary operators (-,~,+) and type names
 
10:27 PM
I've got TypeError: 'tuple' object is not callable, does that count?
 
wim
no
 
harsh :(
 
wim
how do you do that in 3 chars though?!
 
,()
 
_()
 
10:28 PM
ooooh ipython boo
 
wim
get lost IPython weenies
 
it did seem weird to me for what it's worth
 
@roganjosh i'm ignorant of most things and rarely take offense when people presume the truth of it.
 
Wait. This is not IPython
 
mine is
 
10:29 PM
_() works without IPython
 
it doesn't
>>> _()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '_' is not defined
 
It does
 
Use REPL
3 mins ago, by roganjosh
@piRSquared in the off-chance I'm not teaching you to suck eggs: https://stackoverflow.com/questions/1538832/is-the-single-underscore-a-built-in-variable-in-python
 
wim
it should work with python -S
huh, I thought -S defeated the stupid _ thing but apparently it doesn't
 
10:31 PM
lol
from string import printable as p
from itertools import permutations

errors = set()
for t in permutations(p, 3):
    try:
        eval(''.join(t))
    except TypeError as e:
        errors.add(e)
    except Exception:
        pass
 
wim
hah, brute force
 
I guess I shouldn't be surprised, but still 0o8 is a SyntaxError
 
wim
good call
bad call for using a set instead of a dict
 
/-:
 
wim
... errors = defaultdict(list)
... for t in permutations(p, 3):
...     src = ''.join(t)
...     try:
...         eval(src)
...     except TypeError as e:
...         errors[str(e)].append(src)
...     except Exception:
...         pass
all other errors you can apparently get in 3 chars: SyntaxError, NameError, ZeroDivisionError, ValueError, AttributeError, IndentationError
 
10:38 PM
I've gone from some high point of actually (I think) pointing out something you guys don't know (normally, I'm leaning on you) to thinking the library of babel makes chat superfluous due to the brute-force. Everything we could possibly say already exists in that library.
 
wim
actually the ValueError is bogus
it relied on using that "p" variable
 
call it pppp for transparency
 
eval(src, locals={})
 
wim
the AttributeError was bogus too, sorry
@roganjosh cool site
I would never have found it if you didn't say it in the chat ;)
 
I actually saw it on VSauce on YouTube. But it's not as easy to navigate as he made it seem :)
I can see the bolding on the thumbnail for the random text, but it doesn't show when I open the page
Scratch that, it's just barely bold vs. the other text on my TV
 
wim
10:47 PM
so, judging from πR² brute force, those are the only 3 messages
actually maybe there is some other one using unicode identifiers
but i'd be surprised
 
@roganjosh closed
 
Thanks :)
 
00:00 - 16:0016:00 - 00:00

« first day (3169 days earlier)      last day (1770 days later) »