« first day (2287 days earlier)      last day (2676 days later) » 

12:06 AM
It's a ZedSpiracy
 
the good thing about google is that they know what you want
 
wim
I don't want functools though
it's a dumping ground for stuff that guido doesn't care about
 
lulz
 
I tend to use lru_cache there
but anyway my point was that py3 can come first in the search results:P
 
yeah, I'm not even sure what's there besides partial and lru_cache
it rarely does for me even on google
 
wim
12:15 AM
you think I'm joking but he actually called it a dumping ground. and that's why reduce ended up in there.
 
despite me never clicking on 2
 
wim
lru_cache is handy sometimes, I don't know why they didn't call it @memoize though
 
yup
> I ended up hating reduce() because it was almost exclusively used (a) to implement sum(), or (b) to write unreadable code. So we added builtin sum() at the same time we demoted reduce() from a builtin to something in functools (which is a dumping ground for stuff I don't really care about :-).
yeah, those are not concrete-solid arguments
rationally it should go "hmm, people keep implementing sum(), so let's do sum()"
and then teaching people how to use reduce properly:P
 
wim
Well, the rest of his answer which you've omitted, about what the strengths of a real functional programming language are, is a solid argument.
 
I stopped reading after the relevant quote:D
 
12:22 AM
> It is absolutely essential. Just look at Perl's fate -- Larry Wall is just too clean-shaven. :-)
 
wim
"teaching people how to use reduce properly" <-- but you basically don't need to use reduce in an imperative language.
I only ever needed it to implement a prod (that should have got added along with sum imo), and actually it probably would have been better to just do that with a loop anyway
 
@wim I don't know how to use reduce in any language, so I'll take your word for it
I've had to find a reduce-y implementation of prod for various project eulers, so I can relate
now I'm reading Guido's insight on multiline lambdas:D
 
12:37 AM
quick, hide, new nav bar is coming, and apparently they still haven't increased the contrast of the top bar (after all, what's feedback for, right?)
 
wim
I was hoping they would remove the Documentation ᴮᴱᵀᴬ but they just removed the ᴮᴱᵀᴬ
 
This isn't like a norse version of the onion, is it? nettavisen.no/1453635.html here in slightly more in English
 
1:03 AM
@WayneWerner that's awesome:D
 
I recently went to a nature museum where they had a stuffed moose. Those things are huge
that kid has some guts
 
and he goes on to keep them, apparently
 
TFW you'd really like to get rid of those gnarly white shirts but you still have young kids so what's the point? Nice ones will quickly get barfed on/dirtied
 
 
1 hour later…
2:15 AM
Would I break the counter class if I put a "count" at "math.inf"?
Python doesn't seem to have a way describe "infinity" for integer values :(.
 
Does anyone know how I can check if a given date for a given timezone is in daylight savings time or not? I've been struggling with this for awhile.
I've seen examples of checking whether daylight savings is active for the current date, or whether it's active in other timezones, but I want to know how to check if it's active for dates in the past
 
Well wouldn't that depend on the hemisphere you are?
 
yea, I know the timezone that I'm checking for
in my use case it will always be Canada/Pacific
 
@paul23 might as well use float('inf')
 
I mean, for example, both south africa and eastern europe use UTC+2 (kalingrad time) - however when they are in daylight savings is different.
 
2:27 AM
daylight savings even depend on the country as in whether it exists or not
 
So just the timezone (UTC+2) isn't telling enough?
 
for daylight savings you need the country
 
yea, my understanding was that Canada/Pacific has specific start and end dates for daylight savings
it's UTC-7 during daylight savings and UTC-8 when outside of daylight savings
basically I want to know what the UTC offset is for a date, it's either -7 or -8
 
it's also country-dependent whether they observe DST and if they do, when they switch
@paul23 you can even count characters with Counter, so I don't see a reason why it should break
what it needs is that the input is hashable
assuming you're talking about collections.Counter
 
I mean "put the count at infinity" - so that subtracting won't ever get it to reach zero. (Though that makes me wonder if collections.Counter is even useful, since I have to manually do stuff anyways as a count of zero means it gets removed from the list)
 
2:31 AM
@Davidjb have you seen for instance this and the linked dupe?
@paul23 ooooh, I see
@paul23 set it to -1?
but you can assign inf to it:D
why haven't you just tried?
 
@AndrasDeak I saw that one yea, I used a different SO answer but it didn't work...
 
>>> c = Counter('asdf')
>>> c
Counter({'d': 1, 'a': 1, 's': 1, 'f': 1})
>>> c['a'] = float('inf')
>>> c
Counter({'a': inf, 'd': 1, 's': 1, 'f': 1})
>>> c['d'] -= 1
>>> c
Counter({'a': inf, 's': 1, 'f': 1, 'd': 0})
>>> c['a'] -= 1
>>> c
Counter({'a': inf, 's': 1, 'f': 1, 'd': 0})
 
Well I'm just afraid I'll break one of the inner magical beings that keep python running if I do that.
 
a stdlib class should give you the finger if you're trying to gently break it
a Counter seems to be mostly a dict with a few bells and whistles
>>> c['s'] = 1.5
>>> c.most_common()
[('a', inf), ('s', 1.5), ('f', 1), ('d', 0)]
class Counter(builtins.dict)
 |  Dict subclass for counting hashable items.  Sometimes called a bag
 |  or multiset.  Elements are stored as dictionary keys and their counts
 |  are stored as dictionary values.
I don't think there's any black magic involved here
 
2:49 AM
thanks for pointing me in the right direction @AndrasDeak, I figured it out
this is what I ended up with:
def return_utc_timedelta(date_to_check):
tz = pytz.timezone('Canada/Pacific')
date_checked = pytz.utc.localize(date_to_check)
if date_checked.astimezone(tz).dst() != timedelta(0):
return -7
else:
return -8
 
I'm glad it worked out (I can't tell if it's correct or not)
good night
 
 
4 hours later…
6:39 AM
cbg
 
@AndrasDeak I like it
a shadow or yes, some contrast would be nice though
Turns out, I am gonna be doing Java instead of JS in my new job
I am happier
 
7:20 AM
cbg
 
7:31 AM
cbg
 
8:07 AM
cbg
 
8:40 AM
cbg, all
 
adding a uniqu econstraint to existing table takes minutes
 
How many rows in the table? The RDBMS has to verify that the constraint is true for existing data before it commits it to the data dictionary
 
9:02 AM
not many
about 2k, that's why it felt weird
 
cbg!
 
!cbg
 
Which database? That's certainly a tiny table by most people's standards. Is the table in use elsewhere?
 
nope, postgres
yeah it's tiny
 
9:20 AM
Cabbage!
 
cabbage
 
Are you adding a CHECK constraint or a unique index?
 
unique
hold on, maybe I left the web server running while doing this
but it still should cause this hang, as it's wouldn't be using that table
 
Check if it is locked out
By something
Those queries saved my ass a lot of times in the prev IljaCorp :D
 
Documentation quote from flatiron.engineering/technology/2016/09/13/…: “Note: The preferred way to add a unique constraint to a table is ALTER TABLE … ADD CONSTRAINT. The use of indexes to enforce unique constraints could be considered an implementation detail that should not be accessed directly. One should, however, be aware that there’s no need to manually create indexes on unique columns; doing so would just duplicate the automatically-created index.”
 
9:34 AM
oh cool, I will use those when doing this in the production db
:/
yeah I used that
 
9:50 AM
OK, I am about all out of ideas then, if you don't see access from any other connections
 
Thanks @PM2Ring
 
@poke Done
 
Sometimes I wish I had a second account that could edit in the so I can hammer myself…
 
Or just come in here & see if there's someone with edit privileges who can add the tag. And if this room's deserted there's always SOCVR...
In today's episode of 'Answering the "Y" in an "XY" problem' ... stackoverflow.com/questions/41738383/…
 
10:11 AM
@PM2Ring lovely
 
I love how the OP refused to clarify whether that line is in a .py file or being read from some text file.
 
Cabbage
 
cbg @BhargavRao
 
morning cbg
 
10:18 AM
Cabbage @Withnail
 
o/
Not been in here in aaaaaaaaaaaaaaaaaaaaaaaaaaaages.
 
hi
welcome back
 
Successfully got our django project/system off windows and onto AWS. \o/
and almost stable enough to start thinking about replacing it. The last couple of weeks have been negative amounts of fun.
 
I am getting hammered too
have to release something before I leave the company
but the application is still not stable
 
Gah, that's annoying.
The contractor I had in to provide moar handz said things along the lines of "I've stopped trying to make sense of this code or reason with it, I'm just fixing it."
And today I'm mostly moving us onto CircleCi on about three hours of sleep :D
 
10:26 AM
amazing
 
10:45 AM
cabbage
i have a problem but i cannot find any answer to it. I asked a question and it has been touched for at least two months not counting my recent edit. stackoverflow.com/questions/40361882/…
 
I take it that you've installed the required package, namely colorama?
 
i work on a school computer most of the time, so i'm not sure if that is possible
 
@TheOneWhoLikesToKnow use virtual environment
 
what do you mean
 
if virtual environment tools are installed, you can install packages locally
 
10:53 AM
XD
 
virtualenv.pypa.io/en/stable if you can't install virtualenv, you're going to ahve problems installing other packages anyway
 
@TheOneWhoLikesToKnow How do you expect to use software that you haven't installed? :puzzled:
 
You could just print the ansi codes yourself as well, if your console supports 'em.
 
i don't think i will be able to use virtualenv because you still have to install it
 
print('\033[01;32mHäläpäti hämmää häpäti hää\033[0m')
 
10:56 AM
Well, what PM said, then. You can't import packages you haven't installed.
 
@IljaEverilä the output is ' Häläpäti hämmää häpäti hää '
 
@Withnail add to that the upcoming senior project and other school work
I should probably commit suicide
 
Nah, don't do that, I've just opted for this approach
 
@TheOneWhoLikesToKnow I'd wager your console application does not support ANSI colour codes then
 
i use python 3.2
 
10:58 AM
@IljaEverilä That's the problem. Windows command prompt doesn't provide support for ANSI escape sequences. Ironically, back in the days of DOS, it was possible to use ANSI in the DOS shell,, using a thing called ANSI.SYS (which was supplied with DOS, IIRC), but in their infinite wisdom Microsoft decided to drop that.
 
@PM2Ring figures
 
Microcrap
 
i can't access windows command prompt
 
they are almost as bad as Mozilla
 
im on a school computer
 
10:59 AM
what are you using?
 
@TheOneWhoLikesToKnow Are you using some IDE or something then?
 
IDLE 3.2 (Python GUI)
 
oh god
 
have to go, brb
 
In other words, you can't print in colour
 
11:01 AM
stop using IDLE
 
@IljaEverilä OTOH, a quick Googling suggests that in Windows 10 you can use ANSI color escape sequences (and I guess other ANSI sequences too).
 
I honestly wonder why Python still comes with IDLE on windows
that's like installing Yandex bar when installing some random program
 
I use IDLE all the time
 
for what
 
@PM2Ring A feather for Windows 10 then :)
 
11:04 AM
Almost all the code I write for answers on SO I do in IDLE
 
My IDLE is Vim
then
or sublime text
 
@khajvah o/ \o for vim
 
For those who might be interested in this stuff: Console Virtual Terminal Sequences
 
@IljaEverilä what plugin do you use for Python autocomplete?
I recently discovered jedi-vim
 
11:09 AM
@khajvah I need a REPL though.
 
@khajvah none at the moment, except for the vim's basic "complete words found in document"
 
@IljaEverilä I am guessing you use it for small sippets
 
Aye. Used pycharm for larger projects in prev corp.
 
@khajvah meh, I need a bit more GUI than that…
 
11:13 AM
with jedi-vim and a few others, you can replace pycharm
 
I used to have some python ac long time ago, but the vimrcs have been lost in time
 
And it’s kind of a pain to start a new console, open vim and the correct Python interpreter just for this to work.
 
isn't this cool?
 
It seems nice
As to entirely replacing pycharm, how's the debugging handled?
 
I usually debug by import pdb; pdb.set_trace() but I remember there were some plugins
for more interactive stuff
 
11:21 AM
 
11:32 AM
cbg
mittens!
 
Every now and then I really do feel like creating mittens out of it
 
cbg
 
What I really dislike about this new design is that Stack Overflow lost its name and was replaced only by an icon. — poke 1 hour ago
@poke FYI: we replaced full logo with glyph only for logged in users — Paweł ♦ 2 mins ago
Can’t say if that makes it better or worse…
 
@khajvah you're entitled to your wrong opinion
 
11:52 AM
@AndrasDeak new is always good
 
I'd love to use a for-elif clause right now:D
 
How'd that even work out? :D
I confess I always have to really think about for-else and while-else anyway...
 
well, "in case the previous for wasn't broken, AND this variable is 1, do ..."
 
why not put an if block in the loop?
 
I put an if block in the else block if that's what you meant
 
12:00 PM
Or after
With some additional flags
But I get what you're after
 
@AndrasDeak I misunderstood you I guess
I am stupid, so it's fine
 
FWIW, elif some_condition: is just syntactic sugar for else: if some_condition:. It's no more efficient, but it does save you an extra level of indentation.
 
hmmmmm
thanks, I'll keep that in mind
although for-else is already mildly obscure, so I might stick to the clear one in this case:)
 
12:04 PM
even though I'm writing this for fun and for myself
 
@IljaEverilä I's be happy if I could consistently print a path as a link. Wirks fine wirh the stacktrace, but with my prints it's too random for me shrugs
 
12:22 PM
using idle... but the question doesn't tell...
 
12:37 PM
@IljaEverilä Oh, god. :)
 
1:09 PM
@AnttiHaapala Also, he didn't install the colorama module, but he didn't mention that in the question either. But I don't know what close reason to use, "no repro" doesn't seem quite right.
 
3.2????
oh, that user was here a few times
 
@PM2Ring well, ...
 
1:41 PM
pizza pizza pizza
 
1:52 PM
omg what is this vim-slime thing...? blimey
 
Well my day has improved dramatically
Thanks for the link to jedi-vim @khajvah
 
morning you kitty cats
 
This is why you shouldn't drink and govern kids
 
At least Brexit is a single thing. I feel like in America there's a new sigh every day of news
 
2:03 PM
Well, with Theresa May in charge, there is a new sigh every day - it's just not as loud and attention demanding as Trump
 
depends which one is better: one big disaster, or small mistakes every day.
 
I just think that Trump is kinda a charlatan. The one thing I am hoping for is that his decisions are bad enough to effect his American businesses then he backs off and lets people who know what they're doing take care of it
 
Basically, we'll see something of the true nature of how America is governed behind the scenes. If the Trump presidency ends up running pretty smoothly, it shows that the president is merely a figurehead. If it's pretty rocky, take solace in the fact your head of government can actually do something and your tax dollars are "well spent".
 
@corvid s/effect/affect/
  v 1: produce; "The scientists set up a shock wave" [syn:
       effect, effectuate, set up]
  2: act so as to bring into existence; "effect a change"
 
I don't know what is an English grammar
 
2:12 PM
is corvid a native speaker?
 
He's avian. I would make the assumption that it's at least his second language.
 
> Syntax error (Although im 99% sure its correct)
Deserves a price for a ridiculous question title
 
wat
vk.messages.removeChatUser(72, int(getUserId(msg[0])))
TypeError: __call__() takes 1 positional argument but 3 were given
 
@MaxLunar and?
 
but i didnt given it 3 args
 
2:17 PM
self is 1
 
vk.messages is first,
72 second, int(...) 3rd
1, 2, 3
 
and 2 would still be more than 1
 
oh, now I see.
 
@MaxLunar number of the counting shall be three...
 
@AnttiHaapala #rotfl
 
2:17 PM
\o cbg
 
@AndrasDeak :D
 
o/ @MooingRawr
 
\ / cbg
 
@poke trust me, I'm a doctor
 
2:20 PM
cbg("y'all")
 
@AndrasDeak that wouldn't work in Vietnamese, bác sĩ vs tiến sĩ
 
@IntrepidBrit cbg is a function ? I thought cbg was an expression ;3
 
(and I need to install a vietnamese ime again)
 
It's just an intrepidism, don't worry.
 
@AnttiHaapala bácsi in Hungarian is a diminutive for an old man (as in Uncle Bob)
 
2:22 PM
@MooingRawr wat? cbg is an expression, all names are expressions in python!
 
he probably meant statement
 
@AndrasDeak also, in Finnish, a GP can be called tohtori in Finnish but it is a slang use as opposed to lääkäri.
 
Oh, Antti, were you the one who was asking about JPN keyboards and what not? My friend came back with a rather rude answer if you were. I'm only telling you this so I don't leave you hanging if you were waiting on an answer from me
Basically It's a dead end on my part lol
 
@MooingRawr yes me :D
"came back with a rather rude answer" :D
I wish to hear that :D
 
cbg cbg CBG CBG C̴͍̟ͦ̇B̹̯͈̼ͭͤ̒̄G̭̼ͧͬͥ͗̓ͧ͆ ̂ͤ̍ͥͦ͑C̷B̖̯̯̤̱͙͗ͯ̕ͅG̴̻͖͎͕̩̮͋̐̂̌ C̳̱̘̔̂̓́̕͠B̝̣̺̫̺̜̓G̵ͥ̈ͭ͛̾̆͏͕̘͙͓͖͇̻͡ ̩͚̺̻ͥ̈́ͧͥ͐ͦ͢C̶̡̛̯͚̫̗̐͆̌̈́ͅB̸̢͈̙͍̰̣ͯ̐͗͂͛ͬ̚G̒̆͆̈́͐҉̤̯͙̮͕͢ C̵̸̡̦̞̭̥̹͔̙̥̙̞͔͇̖̭͕̦ͫ̑ͣ̾̑̚B̵̧͛́̒ͯ́ͥ̌̿̂͘͏̢̬͕̫̹̼̞̜̞͕͈̠͔̳̪̹̭͙G̷͙̹͖̫̏ͪ͐ͫ͝͡ ̵̵̧̛̲̰̻͎͈̠̳͓̫͓͎̫̥͚̪̦͋̌̐̆̄͒̕Ç̡͎͚̱̣̼̪̮ͤ̇̒̾̑̏̆͋ͪ̌͛̓ͤ͛ͤͯ͂̀ͅB̸̨͖̲̲̳̣̠̟͛̃ͭ̽̀͊ͫ͛̌̽ͤ͡G̚‌​̱̪̮̖̟̫̠̳̳͈̟͍̺̰̙̦͒͛̋͗̾̎͑̊͋͝͞͡
9
 
2:24 PM
"Go google it"
 
@MooingRawr gooood :D
 
>.> not even helpful.... lol
sorry
@MarcusS cbg \o how goes it
 
I̱͔͐͊̂ͧ̃̒̐ ͎̰ͣͤ͊̒͌́S͖̞̈́ͯ̋́̒̌P̻͔͕͇̜̲͌ͭ̓ͭ̄ͯ̂Eͤ̋ͯ̚A͍̳͉̖̜̙̩ͣͤ̋ͯ͑̂̿K̴̞̗͓͓͊ͥ̋̃́͌̆ ̦̝ͯ͆̔ͩT͚͉͕̺ͮ̈ͭ͛O̳̭̬̻̜̪̯͛ͯD̨Ã̩̭̮̼̘ͦ͗̍̅̕ͅY̛̙̩̪̊̍͌ͦ ̝̹̣̩̖͇̜ͣ̉F̌͂͆͛͋҉̖̠͖͉̥R̳͖̰̪ͪO̰̘̬ͮ͑͢M͕̿̒̀ ̸̳̂̋T̠̺͈̮̰̽H͂͜E̦̬̝͎̰̖͟ ̡̲̗ͬV͈̲̳͉̽̿̉̈̎͟O̪̻̟͙̰ͬ̀ͅͅIͬ́͆̃̈̊ͅD͙̺̹̲̤̐͛
 
@MooingRawr you can tell arigato to him from me, I wouldn't have ever thought about it
 
cbg cbg CBG CBG C̴͍̟ͦ̇B̹̯͈̼ͭͤ̒̄G̭̼ͧͬͥ͗̓ͧ͆ ̂ͤ̍ͥͦ͑C̷B̖̯̯̤̱͙͗ͯ̕ͅG̴̻͖͎͕̩̮͋̐̂̌ C̳̱̘̔̂̓́̕͠B̝̣̺̫̺̜̓G̵ͥ̈ͭ͛̾̆͏͕̘͙͓͖͇̻͡ ̩͚̺̻ͥ̈́ͧͥ͐ͦ͢C̶̡̛̯͚̫̗̐͆̌̈́ͅB̸̢͈̙͍̰̣ͯ̐͗͂͛ͬ̚G̒̆͆̈́͐҉̤̯͙̮͕͢ C̵̸̡̦̞̭̥̹͔̙̥̙̞͔͇̖̭͕̦ͫ̑ͣ̾̑̚B̵̧͛́̒ͯ́ͥ̌̿̂͘͏̢̬͕̫̹̼̞̜̞͕͈̠͔̳̪̹̭͙G̷͙̹͖̫̏ͪ͐ͫ͝͡ ̵̵̧̛̲̰̻͎͈̠̳͓̫͓͎̫̥͚̪̦͋̌̐̆̄͒̕Ç̡͎͚̱̣̼̪̮ͤ̇̒̾̑̏̆͋ͪ̌͛̓ͤ͛ͤͯ͂̀ͅB̸̨͖̲̲̳̣̠̟͛̃ͭ̽̀͊ͫ͛̌̽ͤ͡G̚‌​‌​̱̪̮̖̟̫̠̳̳͈̟͍̺̰̙̦͒͛̋͗̾̎͑̊͋͝͞͡
me too I can do the same
 
2:26 PM
stop messing with my lines!
 
@AndrasDeak doctor who?
 
ᴛʜᴇ ᴠᴏɪᴅ is lovely this time of year, when the leaves change color.
 
@MarcusS TIL Marcus is today void Marcus(void){}
 
Aͬͬͪ̆̃͜͏̛̛̲͙̟̫̖͖̱̳͔͚̣̩̠ͅͅF̡̭̹̞̪̟̜̮̬́ͯ̅̔͜F̶͐̈́͋ͭ̔̇̿ͯ̇͂̃ͥͫ̿̾͏̮͈͇̠͔̲̥̦̮͖̟͓͖̟̹ͅI̓̿͒ͪ͛‌​̶̮̠̬̰͔͈̺̝̮̄͒̐̑̆̆̓̚̕͡ͅR̰̠͈̜̣̟̪̤̙̩͉̱̩̺͍̤͎̩ͬͬ̆̔ͤͩͦ̍̍͐̀̚͘M̢̠̭͔̰̝̻̱͍͔̞͈͙̱͎̄͌̆͛ͧ̽ͤ̀͝ͅÀ‌​̵̷̵͍̙̭̖͈̬̮̙̫͐̃̀̍ͯ̒ͮͨ̈́ͮͧ̀ͥ͌̚͘͘Ţ̛̬͓̹̘̗̮̰͑̍̿̎̋́ͣ̄͋ͪ̃ͩ̎̚I͉͔̻͍͓͓̮̠̯̙̭̻͓̒̋͋̈ͫͤͮ̾́̚͞ͅV̽‌​̷̸͎̮͇̖͇̯͂ͯͨ̀͠E̢͓̮͇̮̼̞̘͇͓͉̬̝̱̎͒̏͆̔͊̚̕̕
 
@poke Deák :|
 
2:27 PM
meh
 
@MarcusS how do you do that?
 
can't help it, I've only one heart and a linear view of time
 
Want to try solo travel but afraid you'll feel lonely? Consider scenic ᴛʜᴇ ᴠᴏɪᴅ! For when you gaze into the abyss, the abyss also gazes into you :-)
 
@AndyK google zalgo
 
ᴛʜᴇ ᴠᴏɪᴅ: Come for the nothing, stay for the nothing. Just as all things came from and inevitably will rejoin the formless chaos.
 
2:29 PM
@AndrasDeak mwa ha ha ha ha ha ha ha #fbTrollingOnItsWay
 
@Kevin The customer service is lacking in the void, I must say
 
Did ᴛʜᴇ ᴠᴏɪᴅ come to existence from a warranty, after somebody broke the seal?
 
Worry not, all of your worries will eventually cease to be relevant.
 
@AndrasDeak It is matter / it is antimatter / it can see your past / it can see your future / it consumes time / and it will consume you!
 
2:32 PM
Python code puzzle task! Is there a way to combine this into a single format string?
>>> '{:>10}'.format('${:.2f}'.format(1234.56))
'  $1234.56'
 
no?
 
lol @AndrasDeak
 
the field length and the dollar don't seem very compatible to me
but I'm no expert, obvs
 
Yeah, I don’t think it’s possible either, but I’m curious if I may be missing some cool feature here
 
unless there's a "custom sign character" option...
which shouldn't be
 
2:35 PM
lol
 
unless you f-string it and count the number of spaces yourself:P
hmm, you'd probably have to write the number twice there, nevermind
 
I wouldn’t mind that
 
the number of spaces is 10-4-{number of digits of int(num}
10-4-int(log10(num))-1 :D
' '*(5-int(log10(1234.56))) + '${:.2f}'
off-by-one and technical debt warning
what is the problem with the original?
oh, and you need to check the sign too
)
 
@AndrasDeak ohh lol.
I’ll just file this under “not possible”
 
:D
file it under "andrasdeak couldn't do it" instead, for the time being
 
2:47 PM
@poke Interesting. I'd be tempted to use .rjust:
>>> '${:.2f}'.format(1234.56).rjust(10)
'  $1234.56'
 
@PM2Ring My example was mostly simplified
 
Here's an f-string solution, but it's using nested f-strings, so it's equivalent to 2 .format calls:
>>> f'{"$"f"{1234.56:.2f}":>10}'
'  $1234.56'
 
I'm never going to get use to saying f-string. The kiddie inside of me, won't stop giggling...
 
DSM
Morning working-from-home-while-I-recover cabbage.
 
\o cbg DSM, hows the injury?
 
2:51 PM
cbg
that -----^
can you stand/walk?
 
DSM
Pretty good so far. Still sore but swelling has gone down and now I can walk without much pain. Really I should have stayed home yesterday and gone in today, 'cause that's when it hurt most, but my notebook was at the office and I needed it to get past our many levels of security. :-/
 
Couldn't you get your minions to meet you somewhere or is your notebook locked behind some DSM security where only you can get it ?
 
just remember to keep your foot elevated and unused
 
What happened? Kick a polar bear by accident?
 
3:07 PM
Windows is such a piece of crap
 
@khajvah =O you take that back! It's a wonderful OS that sells our personal data, in exchange for a "user friendly GUI"!
 
Some random dll is missing, I googled and found out that I need to instlal smth that fails with "unspecified error"
Linux fails sometimes but at least it gives errors
 
Windows breaks: "No one knows how to fix it and they probably can't anyway."
Linux breaks: "Cool, I have the freedom to fix this. Do I know how? No."
 
Well, fixing linux isn't hard most of the tune
Time
 
DSM
@MooingRawr: as it happens, it was locked up.
 
DSM
@khajvah: I think that's a little optimistic.. I semiregularly hit problems that I'm not able to fix even though I like to think I have pretty good search-fu.
 
@DSM reinstalling packages works
 
Most of the linuxes aren't very breaky anymore. Except Arch.
Arch is the most particular-about-its-friends linux
 
DSM
@khajvah: if by that you mean that I can often reinstall packages, yes. If you mean reinstalling packages fixes a lot of the problems I encounter, you're wrong.
 
but it forced Python3 as the default Python first, so that means it's a friend of mine!
 
3:19 PM
Here's where I offer the anecdata that Arch has only ever ever broken once on me, even though I'm very haphazard with my updates. And even then, That might have been my fault and it was easily fixed via ABS.
 
I've had it really break maybe twice, in... 4 years? More?
 
Also relevant, my coworker yesterday: "I'm beginning to realize that being an Arch user is like being a vegan"
 
I've had it kind of break two or three times (e.g. I needed to reboot because I upgraded my kernel and it didn't understand that I plugged in a new USB mouse)
@KevinMGranger Lol. Somewhat accurate, I think.
Anyone know of a good dupe target for this? stackoverflow.com/q/41745389/344286 OP just doesn't understand how to import things in Python.
 
@KevinMGranger "How can you stifle that internal voice screaming at you for using ubuntu?"
 
Exactly! It's-- crap, I'm an Arch vegan
 
3:26 PM
I like my artisanal kernels
And my free-range AUR packages
 
bspoke sounds like it could be a thing
 
accessibility feature
 
Real talk, though: COPR is like AUR except they build everything for you too. It's like AUR++
 
@DSM my experience is, even the supposedly non stable arch based Antegros has never brokeb
Only I after I mess around, it might break
 
rpm hell certainly seems to be a thing of the past
thank everything for that
 
3:50 PM
Did python have something like boost's optional? like optional(x[a], default)? I know exception handling can do this, but it sometimes seems silly to have so much space used for this.
 
for a dict, there's get
 
Returning None instead of a value? If None is a valid value, then yes, you need an exception or something. Or, perhaps less cleanly, use go's idiom of value, ok = thing(); if ok: #stuff
 
DSM
When None is a valid value I tend to do NO_VALUE = object() or the like.
 
Well I have a counter and "not in it" basically means "didn't count, so count=0".
@AndrasDeak Thanks for the help, that's exactly what I needed.
 
counter is a subclass of dict
but Counter allows indexing non-counted elements, doesn't it?
>>> Counter('asdf')['a']
1
>>> Counter('asdf')['g']
0
these are exactly the bells and whistles it's useful for
if you need to keep track of counted zeros and uncounted zeros:
>>> from collections import Counter,defaultdict
>>> c = Counter('asdf')
>>> NO_VALUE = object()
>>> d = defaultdict(lambda: NO_VALUE)
>>> d.update(c)
>>> d
defaultdict(<function <lambda> at 0x7f7f866d9f28>, {'a': 1, 's': 1, 'd': 1, 'f': 1})
 

« first day (2287 days earlier)      last day (2676 days later) »