« first day (2746 days earlier)      last day (2216 days later) » 

12:05 AM
60 Minutes looks good tonight...then SV after that
 
wim
12:20 AM
^ this seems worded in problematic way..
 
pluralsight?
When the correct answer to "Why is A necessary?" is "It's not necessary", you know they don't like you
FWIW the first answer has to be wrong because Exception('msg') works
it doesn't even need a message, does it?
 
wim
1:28 AM
Exception is *args and **kwargs
 
Hello, I'm using PyCharm, and it seems like the '__init__.py' files do not exist in my package file hierarchy but my program still work, what's behind the scene?
I've searched a little bit and is it that it's a new feature that '__init__.py' is no longer needed since version 3.3?
 
2:00 AM
@Niing EMPTY __init__.py files are no longer needed. See stackoverflow.com/a/48804718/4822348
 
@JGrindal Thank you
 
 
2 hours later…
3:48 AM
Anyone knows why deepcopy doesn't work with pandas.ExcelWriter?
 
4:29 AM
@Ajit Okay, give me 2 minutes while I activate my mind reading device and attempt to figure out your problem based on the 0 context or code provided
 
Lol ok, when I try something like deepcopy(pd.ExcelWriter('somepath.xlsx', 'xlsxwriter')) I get a TypeError __new__() takes atleast two arguments
Should I be subclassing and implementing pd.ExcelWriter with __deepcopy__ method?
 
4:58 AM
Why would you copy a file-writer object? It's not like it's something you can modify anyway. If multiple instances need it, let them either share it or create their own versions
 
5:09 AM
I can set properties on those instances that would modify their appearance. Something like set_first_row_color_blue(writer_instance). In the function, ideally i wouldn't want to modify the original instance I passed
 
5:20 AM
@chrisz hammered
@Ajit okay, then create a new one for each
 
Cbg
 I get this from a ajax request in Flask:

        print(request.form)
        InmutableMultiDict[('("user_id":5}', '')])

    How can i access to user_id?
 
nuuuu too much code, please use a dpaste
 
@cᴏʟᴅsᴘᴇᴇᴅ dpaste.com/37JKVY9
 
thank you :)
 
your welcome
i cant retrieve the data from the request
 
6:33 AM
Hi
 
7:09 AM
cbg
 
TIL Counters don't support < :/
 
cbg
 
cbg
@Aran-Fey collections.Counter?
 
yeah
 
how would you use it?
 
7:22 AM
Well, since Counters are essentially multisets, it should be equivalent to all(count2[k] >= v for k, v in count1.items()) or count1 & count2 == count1
 
I remember bringing up set operations for dicts in this chat not too long ago, in the sense that I would like to have them. The opposition was strong and numerous.
Still seems useful to me though
 
8:02 AM
But you can always perform set operations on set(keys) and lookup values. Isn't that the same?
 
set operations aren't multiset operations
 
Cabbage.
yay I was awarded my first bounty today :)
 
congrats =)
 
That is an encouragement to keep an eye out on the bounties tab.
 
8:17 AM
there is a bounty hunter out there who recently broke the record for the most amount of rep received in a single day
this one: stackoverflow.com/users/2830850/tarun-lalwani?tab=reputation beating the previous record of 1.5k with 1.7k
 
Wow they must be really skilled. * amazed *
 
Nah, they just have a lot of time on their hands to research each of these niche topics
 
@Simon good job man
@cᴏʟᴅsᴘᴇᴇᴅ i <3 bounty hunters
feel so much like the old west
 
I've offered 27 bounties, but earned only 4. I've never been much of a bounty hunter. Guess I'm not one for the wild west culture, even though I enjoy watching wild west movies myself :D
 
Yeah I've seen your bounties, but I thought you would have got more than 4
Simon has added Simon to the part time bounty hunter list
 
8:44 AM
@Simon You wrote tuples are faster than lists in one of your recent answers. Do you have an example?
 
9:00 AM
Since I am now eligible to link my question, here it goes :D
https://stackoverflow.com/questions/49941005/use-a-method-function-to-format-xlsx-writer
 
@Arne Sure:
C:\Users\Simon\Desktop>python -m timeit "a = (1, 2, 3)"
10000000 loops, best of 3: 0.0269 usec per loop

C:\Users\Simon\Desktop>python -m timeit "a = [1, 2, 3]"
10000000 loops, best of 3: 0.0876 usec per loop

C:\Users\Simon\Desktop>
Did you want me to include that in my answer?
 
27 ns per loop :|
 
Well sorry got to go. Rbrb. Just ping if anyone wants me.
 
good to know. my test had a different setup, so I was confused:
$ python -m timeit -s 'from random import choice; arr = tuple(range(100))' '[choice(arr) for _ in range(1000)]'
500 loops, best of 5: 682 usec per loop
$ python -m timeit -s 'from random import choice; arr = list(range(100))' '[choice(arr) for _ in range(1000)]'
500 loops, best of 5: 681 usec per loop
 
Imports go in setup
 
9:15 AM
aren't they?
 
I think cpython interns a few of these tiny tuples by default, so they're much faster to create
then again, that time difference is on the scale of "seriously, don't worry about it" small
 
@Simon I don't think it's that relevant to the answer, mainly because the tuple would only get built once anyways. It was really only for my own curiosity.
 
Selenium cannot handle tabs wtf
Ahh
 
yah, nah
mostly if your pages are react-generated
or something dynamic like that. Pain to deal with
 
Apparently "selenium tabs" is a bad search (shows selenium medicinal tablets). I suppose Google forgot about my relation to software.
No no, it remembers. All links were software selenium related, just the sponsored links (shop now tab) were the medicinal ones. Ah, Google sticking to their motto "Don't be evil" (just be greedy).
 
9:27 AM
Yeah I tried that.. it makes for very weird behaviours on IE
 
Yeah, my bad. I was suggesting to open windows instead.
 
@AshishNitinPatil Yeah, it's sometimes scary to encounter programming terms being used differently in the wild
I still remember my surprise on the search results for 'latex string' =|
 
@Reno Hmm, yes, might get tricky, good luck.
 
@Arne oh sorry, I only saw part of your line from mobile :| my mistake
 
9:29 AM
Ah . Screw IE. @$@#
 
Anyway, why are you using IE with selenium?
 
It is related to our conversation yesterday T.T chat.stackoverflow.com/transcript/6?m=42219326#42219326
 
Ah, crap. Hope they pay you well.
 
hi all
 
9:34 AM
cbg
 
i am studying decorators
and i stuck here can you help?
 def double(f):
	def g(a, b):
		return 2 * f(a, b)
	return g

@double
def subtractor(a, b):
	return a - b

print((subtractor)(3,2))
print(subtractor(3,2))
what are the difference between in last 2 print statement, it gives me same result which is 2
 
uuuuh should there be a difference?
single-item parens are no-ops
(unless they stop a syntax error from happening)
 
^ Also, please use 4 spaces instead of tabs.
 
I kinda get through the working of the first one
yes sir
 
In [1]: (list) == list
Out[1]: True
 
9:37 AM
no no no let me explain what i understand from the first print statement
 
Is there a default __init__()? I meant if I didn't write one would this method exist?
 
@Niing yes
 
Are you answering me or ... kan?
 
All classes are subclasses of object, so if you don't define one, you inherit object.__init__
 
@AshishNitinPatil Thank you:)
 
9:39 AM
Almost any __ prepended method (like __init__) or variable would exist by default (although, different types / subclasses may have differences)
Because of what Aran-Fey said (inheritance)
 
so double decorator getting its argument as subtractor, and this subtractor function definition has been passed then inside double function g is another nested function that g function is retuning 2 * f(a,b) which is nothing but subtractor and the double function is returning definition of g
 
@Aran-Fey Oh that makes sense to me, thank you too:)
 
so when i call first print statement double(subtractor) gives the definition of g and than i passed g variables
 
@kanishktanwar true
 
but can you explain how 2 print statement working
 
9:43 AM
You just explained it
 
Once you "decorate", it's no longer the function you wrote, but a function "wrapped" with the decorator.
 
so its same thing huh!
 
yes, that's what Andras and I were mentioning previously.
I wonder if the original function is somehow still accessible
 
@kanishktanwar You can very roughly think of a decorated function definition as first defining the function and then doing just subtractor = double(subtractor). So subtractor is actually g.
 
yes it is but passing definition vs passing return values seems to me an error
 
9:47 AM
Remember functions are also objects that can be passed around.
 
@AshishNitinPatil Had the decorator used functools.wraps, there'd be __wrapped__.
 
Even if they are "returned", they can still be called
 
yea right but i don't find any difference having or not
 
@IljaEverilä hmm, thanks. I think this should be a default, no?
@kanishktanwar what difference are you referring to? And why do you think it should be there?
 
9:48 AM
that is what i wanted to hear -> Even if they are "returned", they can still be called thanks
 
ah, okay
 
Your questions and code don't fit
 
having @wraps(g)
 
(fun)(arg) and fun(arg) being the same has nothing to do with decorators
 
well it sure did
 
9:50 AM
he was confused with something else :-p
 
wait I don't know that thanks for clarification
 
the concept of "function is an object" is usually confusing at first
 
they are both same things
 
We don't know the total number of confusions
 
man you guys are life saver thanks everyone
 
9:52 AM
No problem
 
stackoverflow.com/a/1166200/2689986 ah, silly me. But still, some syntactic sugar might help preserve original func, but I guess there's functools just for that.
 
@AshishNitinPatil And inspect.unwrap for unwrapping.
Given that functools has been used properly.
 
btw @AshishNitinPatil thanks for your help
I was able to do what I needed
 
you're welcome :) And I did see your yesterday's ping :-p
 
10:01 AM
Oh so it wasn't deja vu :P
 
10:21 AM
Hello All,
I have some text files containing 1000+ lines. It contains some lines in the format:
`
seq open @ 2018/02/26 23:07:51 node: \nodes\wroot.nod (wroot)
seq call @ 2018/02/26 23:07:51 node: ttt
retrieve BIOS data using F:\tools64\BiosConfigUtility64.exe /GetConfig:\working \bcudump.txt
BCU is working
seq done @ 2018/02/26 23:07:55 node:ttt
seq call @ 2018/02/26 23:07:57 node: \nodes\dddd (aaa)
1111
2222
pppp
seq done @ 2018/02/26 23:07:57 node: \nodes\ddd(wroot#9^wchkefierror)

`
I want to extract the lines between seq call and seq done in a list and insert NULL in the list if the line starts with seq open or seq log.

As you can see there may be any random no. of lines even 0 between seq call and seq done. I have been trying to find answers but to no avail. Also I am new in python.
 
@AndrasDeak looool
 
10:40 AM
@ImdadulChoudhury that sounds like a straightforward thing to do. Loop over your file line by line, use .startswith to see if you have a line of interest, keep a state like between_call_and_done and append to a list you create before the loop when you have a line you like. If the line starts with seq open or seq log, append NULL, whatever that is (python only has None)
 
11:00 AM
@Arne Ok. I hope I was a bit helpful at least.
 
11:11 AM
@Simon You absolutely were, I learned something useful again =)
 
12:03 PM
The more the merrier ;)
 
 
1 hour later…
1:19 PM
\o 1 hour later... cbg :D
 
DSM
Cabbage for all.
 
DSM :D \o
 
cbg
 
1:39 PM
What are some programming problems which look deceptively simple but are tricky to implement correctly in first attempt? I can think of fizz buzz, size sieve, etc. but need more examples. I want my students to appreciate TDD/BDD and want them to feel a pain - a desire to write specs first then dive into code.
 
Is fizzbuzz deceptively simple?
 
DSM
Set consolidation is trickier to get right than people think. Every time I see someone implement one it's usually only the work of a minute to find an example their code fails for.
 
AVL trees have so many corner cases it drives people borderline insane
so it is deceptively "simple"
 
@RinkyPinku Finding primes, eg Eratosthens.
 
@OneRaynyDay can you think of simpler examples? Something I can dictate in class, let them submit their codes and move on to importance of TDD in one 40-minute session?
 
1:49 PM
Please note that we like to reserve stars in this room for messages that are of interest to a broader audience, more often amusing than not.
 
@DSM thanks, great example.
 
sometimes, if you present a 2D BFS problem, people often forget a "visited" set and end up running forever
 
@Andras I thought stars were private, sorry
 
idk; shrug
 
It's OK, that's why I wanted to let you know :) All the stars on the right (assuming you're not on mobile) are a pool of shared stars
 
1:51 PM
Surprisingly many people think that stars are private even though there's a wall of starred messages off to the side there >>>
 
Cabbage
 
@Aran-Fey they don't show in mobile, only if you look for them explicitly in the menu
@PM2Ring hey, how are you?
hope all's fine
 
Hi @Andras . I'm ok, I guess. I've been a bit depressed for the last couple of months, but I think I'm getting over it.
 
I'm sorry to hear that :(
 
@RinkyPinku have a look maybe on advent of code tasks, there are some nice and easy puzzles
 
1:54 PM
@PM2Ring best of luck to you, if I may suggest - try some high intensity (HIIT) workout and rest of the day just coding - pulled me out and put me in great shape.
 
and most of the times there are few examples that can be implemented as unit tests first
 
Also, I needed a holiday from all the low quality questions in the python tag. Reading them wasn't good for my emotional state... But it doesn't look like there's been much improvement in my absence. Eg, stackoverflow.com/questions/49982676/… It's almost a textbook case of horrible Python and inefficient algorithms. :(
 
No, it's been a cesspool lately
whenever I venture near the front page I start losing rep
 
@marxin I was considering Euler's, but advent of code tasks seems like a better alternative.
 
@RinkyPinku Thanks for the advice. I've been walking a bit lately, I don't think I could cope with anything much more strenuous at this stage. A couple of weeks ago I could barely get out of bed.
 
1:56 PM
you can try filtering for upvoted unclosed posts rather than the fresh ones, that's what I usually do when I want to spend my time better :)
 
@PM2Ring Hey, walking and going out to get a breath of fresh air is great :) good for you man
 
Hmm, TIL I can modify elements of a list that are inside a tuple.
 
We've had a ridiculously warm autumn here in Sydney. I guess I can be grateful for that.
 
@toonarmycaptain why is that surprising?
 
@toonarmycaptain OTOH, try making a set with stuff that contains a deeply nested unhashable element. It won't let you.
 
2:00 PM
@OneRaynyDay My understanding was that tuples were immutable.
 
tuples are, lists are not :)
 
@toonarmycaptain Indeed. And you can't change the list in a tuple for another list. But you can certainly mutate the lists in a tuple.
 
Yes, but I naiively assumed that that meant once created, nothing in the tuple could be modified.
 
it's more like... you can modify each object, but you cannot change the reference inside the tuple
 
@toonarmycaptain You aren't the first person to have that quite reasonable assumption. And I suspect you won't be the last. ;)
 
2:02 PM
I'm sure if tuples implemented true "immutability" then they would need to detect the mutable methods being called for all objects contained within it, which would make it incredibly slow which is not what people want
 
DSM
Don't worry. Give python a few more versions and we'll be forced to able to write immutable x = (1,2,[3,4]) and it will be fixed for all time.
 
@PM2Ring This I just found out by experiment. I have a vague expectation to use tuples as part of the hash for an object, in order to do set testing waaay down the track in my project. Not that I plan on having lists inside them, but it is good to know.
 
But think of how that would be implemented. The tuple would need to be somehow notified of any attempts to change the contents of any of its mutable items, no matter how deeply they're nested. It'd be a nightmare.
@DSM I guess that'd be tolerable for literal lists. But for other lists that may be referenced in multiple places (some of them mutable) it would be evil.
 
DSM
Not that I'm recommending this, but I don't think it'd be that bad. It could be implemented via deepcopy + setting a "do not mutate" flag.
 
@PM2Ring Or it could be stored as a string, parsed for types inside the tuple at runtime? That might not be so slow. Awkward for large objects, though.
 
2:07 PM
An immutable object is kind of like a country with a very strict border patrol - they won't let you bring anything in or take anything out, but you can still enter the country empty-handedly and change things on the inside
 
@PM2Ring long time no see cbg \o hope things are well! just read the transcript, hope you are doing better!
 
As DSM said, it'd just need stuff to have a "do not mutate" attribute. Which I guess everything could inherit from object. But I wouldn't be pleased if such a thing were added to Python.
 
Thanks, guys.
 
we are here to chat with you if you want to, fellow pythonian.
 
2:10 PM
@PM2Ring ^^ indeed
 
pythonian or roomsixian, idk which one would describe us if we were a "race".
 
Some would object to that (SO rules), but I prefer SOpythonistas?
 
DSM
Some people really prefer pythonaut to pythonista even though it never quite caught on.
 
I thought it was pythoneers
 
SOpythonistas sounds a bit too... (for a lack of a better word) preppy, pythonaut sounds pretty cool, pythonista sounds like we supply people with a coding issue similar to barista to alcoholics, pythoneers at first made me think of pioneers :\
 
2:14 PM
I think they're all gimmicky
 
Python Dev.
 
@MooingRawr I prefer big snakes, but apparently that doesn't translate well?
 
not to mention, people might think you are being naughty
 
@toonarmycaptain sorry I don't get it unless you are saying pythons are big snakes then oh o.o
 
@MooingRawr I'm sure pythoneers is meant to be a play on pioneers
but agreed they all sound very gimmicky
 
DSM
2:16 PM
Huh, I hadn't even thought of "barista" for "pythonista". I'm dating myself here, but I always think of "Sandinista", which is one of the reasons I don't care for it.
 
pythonauts
 
@OneRaynyDay I secondly thought of engineers ;\
 
I like engineer better than pioneer, much better.
but pythoneer sounds not-so-exciting :/
 
DSM
I think our Ruby cousins call themselves "Rubyists", which isn't very exciting either.
 
they're just rubying it in.
(sorry :-p)
 
DSM
2:20 PM
Ouch. Look out, KMG & RG, ANP is coming for you.
 
I quite like pythonaut, but I tolerate (and occasionally use) pythonista.
 
You are from the 60s, you'd definitely like pythonaut.
 
Fair point. :)
 
DSM
Today we have a new part-Python dev coming to NumberFirm from a sister company to see if he's interested in joining us here. My empire is gradually expanding!
 
your empire is being built by minions, how do you fell about that?
 
2:23 PM
@AshishNitinPatil Or an anacondonaut, boanaut, depending on where you're from.
 
@MooingRawr Frankly, I would be glad to be Gru.
@toonarmycaptain I'm sure there a lot of puns you could slytherin
 
@PM2Ring What's more depressing is that my 6 month old laptop is 4x slower on these tuple from comprehension numbers.
 
DSM
Anyone else getting "oops-something bad happened" messages on main?
 
On a totally different subject, over the last several weeks I've been messing around off & on with stuff related to the number e. It started with that thing from math.SE about higher dimensions, which we discussed here last time was around. I just added a relevant comment: math.stackexchange.com/questions/2644700/…
 
@AshishNitinPatil Indeed. I was referring to the astronaut, cosmonaut, taikonaut and spationaut regional difference.
 
2:26 PM
> Stack Overflow is currently offline for maintenance
 
@DSM Nope. But I just got an unusual result when I clicked on the icon in the menubar for my pending replies to comments. It's showing me the comments, but not in the format I'm familiar with.
 
@MooingRawr that's a lot of errors, truly an "overflow"
 
overflows of overflows I like it.
 
DSM
Guru meditation errors are the best errors.
 
Nothing on stack status. So (unplanned), likely someone having a bad time with devops right now.
eh, we're back already. routine.
 
2:31 PM
Anyway, here's a little bit of Python 3.6+ code that can calculate large numbers of decimal digits of e. It's rather primitive compared to my code here. But it's much smaller, and much faster, since it uses Python's own big integer arithmetic. It can easily do 10000 digits almost instantly, and doesn't take too long to do 100,000. BUt I suspect it might be a bit slow at doing a million digits. ;)
m = 10 ** 100
a, f, i = 0, 1, 2
while f < m:
    f *= i
    a = a * i + 1
    i += 1
print(f'2.{m * a // f}')
 
DSM
@PM2Ring: took 1 min 18s for me, which isn't too shabby!
 
Thanks, @DSM. SUre it's just a simple Taylor series, but sometimes simple is best. :) However, last week I discovered a cool way to estimate the error in the truncated Taylor series for e, and I suspect it will also give good results for e^x, but I haven't tested that yet. I'll post a short demo in a few moments.
 
> Converted from C to Python 2007.12.10
 
s = f = 1
for i in range(1, 20):
    f *= i
    q = i * i + i + 1
    p = q + i + 1
    s1 = s + p / q / f
    s += 1 / f
    print(i, s, s1)
@AshishNitinPatil I still have the C version on my HD too. :)
 
Keeping data securely for 10+ years. Kindly provide tips.
 
2:41 PM
I've also got some POV raytracing scene files that are around 20 years old that I originally wrote on the Amiga.
 
if you use a caesar cipher noone(even yourself) would be able to find out what the original data was
 
DSM
Umm..
 
I like to map a to b, b to c, etc.
/s
 
@PM2Ring How many times have you had it transferred to a "newer" medium of storage?
 
@PM2Ring I fixed a grammar error there (I'm a little OCD), and it forced me to find other edits, so I had to look for pep8 comment stuff.
 
2:44 PM
And if I may ask, where do you store it now? Do you back things up in the cloud?
 
I had a bit of a scare a few weeks ago. I was doing some browsing when all of a sudden the machine froze, and I couldn't do anything, not even reboot. I eventually just killed the power, and then it wouldn't restart, it didn't even go to the BIOS startup stuff. I spent a few hours fiddling with it, without success, and eventually even my monitor wouldn't turn back on. I was not happy.
But a few days later the monitor did turn on and I tried a few more things on the computer and it turned out that one of my two 1 GB RAM cards was dead. Fortunately, I have a spare pair of half gig cards that are brand new. I suppose I ought to think seriously about buying a newer machine...
 
Ah yes, RAM corruption is a big headache. Mostly because you can't locate the error usually.
 
@AshishNitinPatil Only a few times. This machine is fairly ancient. I last replaced its main HD about 6 or 7 years ago. So now it has one SATA drive and one old 80GB IDE drive. I guess I should do something about backing up the data on that IDE drive...
 
Laptops, IMO are quite better in that regards. But surely don't / can't live long enough. Just like you said ^
 
@AshishNitinPatil No, I don't use the cloud. Every now & then I burn my programming code (and raytracing scene files) to a CD.
 
2:50 PM
I remember buying a pack of single-time writable CDs / DVDs for backup. Good times. Now I mainly back it up on Google Drive (only imp stuff).
 
@PM2Ring Hmm. I was trying to resurrect an old XP machine last night, which had the same symptoms. I will try this! Well, provided my wife hasn't made me throw the old RAM cards I was keeping for this exact situation.
 
@toonarmycaptain Fair enough. Approved.
@toonarmycaptain I was happy to lean that DDR400 RAM is still quite available on eBay. I guess there's still a big market for it in 3rd world countries. But cards > 1GB don't come cheaply.
 
@PM2Ring Wait, how do you have brand new half gig cards?
@PM2Ring Eh, if I don't have any I'll probably get permission to purloin some from old desktops the school district is ridding itself of.
 
My stepdad had them sitting around, and he decided to give them to me, since they don't fit in any of his machines. Before he retired he was an electronics technician, so he naturally tends to accumulate electronic stuff. Every couple of years he has a big purge and gets rid of the olde stuff, but it doesn't take long for it to build up again because people keep giving him stuff. :)
@DSM I'm assuming that was an attempt at humour. Probably inspired by some of the caesar cipher questions we see on SO.
 
/s means sarcasm
 
2:59 PM
cbg
o/ @PM2Ring
 
s/ means substitute
 
Hi, pi.
 
but since you can edit your messages, unlike IRC, that's not nearly as necessary
cbg all
 
s/\/s/s\//g
 
In sed you can use other delimiters for the s command for situations like that.
At least, you can in GNU sed. I'm not sure about POSIX sed.
 
3:03 PM
elaborate?
 
From the sed info text: The `/' characters may be uniformly
replaced by any other single character within any given `s' command.
The `/' character (or whatever other character is used in its stead)
can appear in the REGEXP or REPLACEMENT only if it is preceded by a `\'
character.
 
you can do something like sed -delimiter ; 's;/s;s/; <stuff>`
or apparently just do it
 
Yep. Eg
$ sed 's|/|Z|g' <<<'///'
ZZZ
 
Language-agnostic design problem: My system has a collection of User objects and Homework objects. Any User can assign homework to any other user. Each user object should have an attribute that keeps track of the homework that the user has assigned, and the homework assigned to them. What should I name these two attributes?
homework_assigned_to_me and homework_I_assigned are unambiguous, but it's weird to use first person pronouns in a variable name, especially if it's referring to the object and not the coder
 
english grammar just can't handle cases like these
 
3:12 PM
Maybe there's an obscure graph theory term I can use. something that distinguishes between the two types of edges that connect nodes in a directed graph
 
homework_by_me and homework_to_me?
 
The gold medal is awarded only if you can avoid pronouns
 
assign_out, assign_in
 
my_homework and homework_i_assigned
 
... gold medal incoming, sweet!
 
3:17 PM
pi is running unopposed in the gold category so far
 
@PM2Ring WOW, HI!
ahem, cbg, @PM2Ring. We've missed you.
 
Thanks @cᴏʟᴅsᴘᴇᴇᴅ
 
Apr 10 at 19:51, by Kevin
In the absence of any real information, I choose to believe that PM is occupied in a dirigible race around the world
I now choose to believe that PM won that race
 
@Kevin i concede, need to rbrb
 
@Kevin :)
 
3:21 PM
silently goes to google that word
 
@cᴏʟᴅsᴘᴇᴇᴅ because text makes no sound.
 
The trick to any race around the world is to head for the north pole (or south, if it's closer) and do a little 1 foot circle around it. Thus technically satisfying the requirements, while traveling only slightly more than one quarter of an Earth circumference in the worst case.
 
@Kevin you'd probably have to make it back to the finish line
 
ah I see @PM2Ring, today I learned
 
3:24 PM
I guess that's why most races require checkpoints, and "circumnavigate" is used for records
 
Ideally the finish line should stretch up and down the entire longitude. But if they can't spring for that much ribbon, going back down to your starting point means your journey is at worst 0.5 circumferences plus one foot, which is better than 1.0 circumferences for most kinds of planets
@PM2Ring Heh, led zeppelin.
 
morning cabbage
 
The light required to fill the zeppelin wouldn't be too heavy, but the LEDs required to keep it inflated would weigh a fair bit, I reckon. :)
 
Decorator question, Would it be correct to say that rules of scoping are reversed with decorated functions. Such that variables in the innermost function are available in the scope of the outermost wrapper?
 
Perhaps if we fire lasers from the ground into the envelope
@Ajit Not in my experience, no
 
3:31 PM
Usually when the question is "Is X a special case in python?" the answer is "no"
 
But perhaps there are some special cases to that ;-)
 
If I have a string referenced by a variable string = '....', can I somehow evaluate it as an f-string later?
or does f-strings only apply to literals?
 
Literals only, unless you use eval trickery
 
@Kevin Maybe. But if you make pathways for light to enter the zeppelin then it can also leak out of those pathways. Of course, it needs to be lined with an unobtainium mirror so the photons don't just instantly convert to heat...
 
3:33 PM
I reckon that dynamically constructing f strings has exactly the same security risks as eval, come to think of it
 
@Ajit I suspect you have a misunderstanding in how decorators work. Care to show us a MCVE?
 
@PM2Ring Yeah ideally you would arrange the transparent and reflective patches in some cunning way so that you get a large number of reflections before the beam escapes. Super hard mode: the lasers are stationary on the ground, but the zeppelin is moving, so the laser angle changes over time.
("Stationary" here meaning their position doesn't change, but they can swivel to continue pointing at the zeppelin)
Practical solution: use an unobtanium mirror that lets through 100% of all photons from one side, and reflects 100% of photons from the other side. A two way unobtanium mirror is twice as hard to obtain as a one way unobtanium mirror, but that just means they're both infinitely hard to obtain, so you may as well get the fancier one.
 
It's like a Maxwell's Demon for photons. I wonder how long it'd take for a box made of that stuff to create a kugelblitz if you left it in the sun...
 
@PM2Ring I tried something and it didn't work. I expected it to work .
https://pastebin.com/G7QEAJDN
 
3:50 PM
@Ajit What did you expect that v += 2 to do?
 
Well, I thought the decorated function would 'resolve' and the variable v would be available in the outer scope
 
Note that this works in Python 3:
def dec(func):
    v = 10
    def decorator(num):
        nonlocal v
        v += 2
        return func(num) + v
    return decorator

@dec
def increment(num):
    return num + 1

print(increment(10))
print(increment(10))
#output
23
25
 
sry I meant decorator
Understand thanks!
The call stack would behave same as a normal function call
 
@Ajit Bear in mind that 1) Python scans top down, executing stuff as it finds it, and that also applies to function definitions. When a function definition is executed it creates the function object. 2) The dec function gets called once, via the @syntax, and it gets passed the original increment function object as soon as its available, and the function object returned by dec then gets bound to the incrementname, shadowing the original incrementobject.
Sorry about the multiple pings. :(
 

« first day (2746 days earlier)      last day (2216 days later) »