« first day (3221 days earlier)      last day (1731 days later) » 
01:00 - 18:0018:00 - 00:00

1:29 AM
cbg. anyone here?
 
2:17 AM
Sunday morning cabbage
 
cbg
how goes it?
 
Hi @Dair
 
bronze badge in tkinter... do you use tkinter at work or for any hobby projects?
 
nice.
 
2:24 AM
Thank you. Are you using tkinter?
 
I don't, I remember working for a group that used tk for their application tho
 
 
4 hours later…
6:19 AM
Is there a way to remove a an empty list [] from a list of lists using the remove function? I know how to do it by creating a new list, but can the remove function achieve this?
 
➜  ~ python3
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> l = [[], 1, 2, 3]
>>> l.remove([])
>>> l
[1, 2, 3]
 
6:38 AM
thanks
 
6:55 AM
cbg
 
7:18 AM
That would drop any 0 values
 
realized :)
 
Also, I kinda feel it's an exception waiting to happen but my editor is being painfully slow to load
 
i see..
 
I formalised my switch from Chrome to Firefox yesterday and if anything, it's worse on memory. I don't know what's going on; I have 14 tabs open, 1 of which is YouTube and combined it's taking up 1.5GB of RAM. I don't see how Andras has 800 tabs open
I thought it was because Chrome launches each tab as its own process but this seems excessive. It's really causing issues with my laptop (hence why I now can't seem to open Spyder)
 
user10984358
what should I google if I want to know which functions can the key argument be used with? key as in sorted(seq,key=itemgetter(1)) or max(seq,key=lambda x:int(x))
 
user10984358
7:25 AM
also just outta curiosity does he really have 800 tabs open?
 
Well, short of me flying over there to verify, yes, that's what he said
 
user10984358
haha, my laptop would be on par with rocket engines (at least the fans would) if I have anything more than 10
 
user10984358
@anky_91 can you I see the deleted message if you may??
 
user10984358
I just want to know what approach was taken
 
I don't even know how my little laptop copes with me anymore. It's never below 85% RAM use unless it gets a treat and gets rebooted, and usually I'm running servers in a VM that I just keep battering with requests
 
user10984358
7:29 AM
even internet explorer
 
user10984358
I resorted to using defaults for everything so I can minimize RAM usage
 
But, out of it all, the biggest RAM user is consistently my browser and something feels very wrong with that
 
@TheNamesAlc I didnt get you
ohh
 
user10984358
@roganjosh your message above this
 
[i for i in l if i]
 
user10984358
7:31 AM
that was what I thought of when I saw that as well
 
user10984358
0 is an implicit false, yeah
 
yes
 
user10984358
any suggestions for the question I asked
 
user10984358
not that it is of huge importance
 
@TheNamesAlc Don't do max(seq, key=lambda x:int(x)). Just do max(seq, key=int)
 
user10984358
7:34 AM
noted
 
user10984358
so what functions takes the 'key' argument ?
 
user10984358
so far my searches yield me key word argument (kwargs)
 
@roganjosh What OS are you using? Andras is using Debian.
 
This is on Windows 7
I ended up having to close Firefox and went from 87% ram to 48%. Somehow both Chrome and FF seem to have memory leaks
 
it's called a "cache" nowadays I believe
 
7:37 AM
@TheNamesAlc You can use any single arg function that returns an orderable value, often an integer. It just depends what you're trying to do.
 
What's cached though? Even if I didn't have YouTube open, just static pages, the processes continue to grow. However, if it is a cache feature gone wild, maybe I can cut its wings
On that point, maybe I need to run a full virus scan
 
@TheNamesAlc Sorry, I misread your question. The functions which take a key function are max, min, the list.sort method and sorted, and itertools.groupby
 
Curiously, my memory usage was also at 87% and closing firefox made it drop to 29%
 
What OS is that on?
 
Win10
 
7:44 AM
Note that sorted copies its list arg and then sorts the copy in-place using list.sort. So it's more efficient to use list.sort if you don't need to preserve the order of the original list.
 
It's crazy the cut of resources they take. It also looks like opening and closing a tab in Chrome keeps the process alive. And closing the browser doesn't kill all the processes. Killing them in task manager doesn't stop you restoring the closed tabs when you reopen the browser, so they have no reason to be running
 
Don't know about Chrome, but with Firefox it just takes a while for all the processes to shut down
 
Perhaps I'm just being characteristically impatient when I close the browser and expect my memory to be freed :P
 
Hmm, seems Firefox stores most of its cache on disk... I just cleared 1GB of data but my memory usage only dropped by ~200MB
 
8:10 AM
Hi everyone
I solved this particular problem in two ways
T = int(input())
for _ in range(T):
    N = int(input())
    array = list(map(int, input().split()))
    array.sort()
    print(len(array[1:] * array[0]))
Thats the first way and it got partially accepted (passing two sub-tasks out of three)
T = int(input())
for _ in range(T):
    N = int(input())
    array = list(map(int, input().split()))
    print(min(array) * (N-1))
Thats the second way and it passed all the subtasks(fully accepted)
Can anyone tell me why ?
 
I'm guessing it's because the test cases are terrible, because I'm pretty sure both of those solutions are completely wrong
 
@Aran-Fey What would be the correct way to solve it ?
 
Never mind, the 2nd solution is correct. I keep being tricked into thinking that these codechef problems are difficult when in fact they're super easy
 
@Aran-Fey Why is the first one incorrect?
 
you probably meant to write print(len(array[1:]) * array[0])
your parentheses are in the wrong places
 
8:20 AM
@Aran-Fey Oh yeah, this was a really dumb question
The test cases passed so I didn't bother to look at the syntax
Thanks, any further optimizations that I can apply to the code(2nd one)?
 
Mostly stylistic improvements... variable names should be lowercase, you shouldn't give a variable that contains a list the name "array", and you don't need to convert the the iterator returned by map to a list to begin with
num_test_cases = int(input())
for _ in range(num_test_cases):
    num_numbers = int(input())
    numbers = map(int, input().split())

    print(min(numbers) * (num_numbers-1))
something like that
 
Thanks for all the help, I didn't even know that you can call min on a map object@Aran-Fey
 
You can call min on any iterable object... just like you can call list on any iterable
 
Cool, I will remember that
 
@RaphX You can even get min to do the mapping for you, although it probably won't improve the speed by much. Eg, min(input().split(), key=int)
 
8:36 AM
int(min(input().split(), key=int)) to be precise (and WET)
 
Oh yeah. :)
 
@PM2Ring That would be great! Thanks!@Aran-Fey@PM2Ring
 
And it's not that WET, since there's only a single extra int call
 
Let's agree on humid
 
Ok. One thing that annoys me with these problems on CodeChef, HackerRank, etc, is that they encourage new coders to scatter input() calls through their code. I don't like that style. I prefer to gather & validate input as early as possible in a script or function, so all later parts of the code can be confident that the data they're working on is clean and sane.
 
8:48 AM
"WET"?
 
Seeing input calls hiding in the middle of code makes me feel uneasy, like seeing a trapdoor in the floor of a bank vault. :)
@JennaSloan Opposite to DRY
 
We Enjoy Typing, Write Everything Twice, Waste Everyone's Time <- take your pick
7
 
I'll just stick to subroutines
Now I have subroutines that have subroutines that have subroutines that have subroutines that have subroutines that have errors
 
@JennaSloan Good idea. A classic example of WET coding is where you have a few blocks of code in a row, with almost the same code copy & pasted in each block. You have to read it carefully to check what's been copied and what's been changed, and to figure out if the changes are all as intended or if some are typos. The obvious solution is to rewrite the code to use subroutines / functions instead of the stupid duplicated blocks.
 
9:17 AM
@RaphX Everything is relevant until it is determined not to be. Always check your assumptions. If you think you haven't made any, check again. Debugging is a matter of correcting mistaken assumptions about how your code runs.
 
@holdenweb Got it, it seems that I need to check with other test cases apart from the ones mentioned on the sites
 
9:35 AM
Hi
 
Hello
 
I want to create a function in my console
def a():
print(1)
when calling a it returns <function a at 0x00FA9540>
 
It's unlikely that you actually called it. How are you getting that output? From the REPL or from print()?
 
that's because you didn't call it. to call a function, you need to use the brackets too (and pass the arguments as needed). So, a() and not a.
 
@ParitoshSingh You are right!!! Thanks
 
9:38 AM
@RaphX PLEASE don't call lists arrays
 
no worries
 
is it possible to call functions from the console, which are saved in a file?
At first I have to import the file right?
 
sure, if it's saved as a python file, you can just import it
 
I wanted an editable table in HTML but editable dataTables brought me perilously close to having to learning PHP to understand the examples. So I went with bog-standard contenteditable='true' and reconstruct the table with pandas on the back end. It feels like I'm scraping my own site to handle requests :/
 
all is fair in love and war and html. citation needed
 
9:41 AM
@roganjosh weird. At least firefox closes down for good. Usually seconds, at most 15 or so
 
Most of Chrome does too, but it looks like it can get orphan processes, possibly if my laptop goes to sleep or something
 
Fox has never done that to me
 
@ParitoshSingh It actually works really well... until at some point it won't. But today is not that day :P
 
I'm using dev edition but that probably doesn't matter for memory
 
I assume it's down to the OS. Aran-Fey clearly could replicate the memory hogging issue with FF too (but I don't know, maybe he has a bazillion tabs open too)
 
9:44 AM
5 GB in userscripts
 
haha
 
@AndrasDeak Sorry :D, I have a habit of doing exactly as the question asks hence the name, I won't from next time. I know they are pretty different.
 
With no types and confusing names your code becomes hostile territory
 
I will follow a more descriptive naming pattern(representative of the things I am storing) from the next time instead of ambiguous names. I think that would be better.
Juat as Aran-Fey did while showing me an alternative solution
 
And you don't have to name your variables by type, but if you do use the right type.
 
9:53 AM
Ok
 
@RaphX see also a short chat here
 
@RaphX That's definitely a good idea. You need test cases that show the code does perform correctly on nice data. The test cases on the site generally do that, but it doesn't hurt to make up a few more. But it's a good idea to also have some test cases that verify that your code doesn't mess up on nasty legitimate data.
Of course, with these coding contests, the data is guaranteed to be legitimate, eg if you have to do stuff to a bunch of numbers you don't need to check that you are reading numbers. But (for example) if you have to find the maximum of a bunch of numbers you should make sure your algorithm performs correctly if it's fed negative numbers, or a bunch of identical numbers.
 
10:33 AM
@RaphX, this advice has several good reasons behind it:
1. If everyone uses the same name, misunderstanding is less likely;
2. There is a specific `array` type, defined in the `array` model, for which that specific name (without qualifiers like "ndarray" from numpy) should be reserved.
It may feel like we're piling on, but it's all intended to help (otherwise people wouldn't be spending the time). It's hard in the beginning, and we've all been through it.
Forcing yourself to do things "the right way" means that you get into good habits that, with enough experience, become automatic.
I taught myself the guitar, never had any lessons. I enjoy it, but I'm a crappy guitarist.
 
10:51 AM
Understood thanks everyone!@AndrasDeak@PM2Ring@holdenweb
 
 
1 hour later…
12:09 PM
Huh, the docs for numpy.random.normal appear to be broken. That's the first result I get from search, other links from google work.
 
Do you know if they're aware that searching "numpy random normal" gives a broken link as the first result?
Eh, I need to read this, it looks like it's a big change
 
Indeed. And might be worth raising an issue (search first for closed ones), in case they can tell google and duckduckgo
 
12:39 PM
See also NEP 19
 
Thanks. I hadn't come across this change. I'll take a proper read shortly and I'll raise on github if I find that they don't know about the broken links
 
12:55 PM
I need to get better at keeping on top of library changes :/
 
1.17 has some major changes, more than usual
 
1:25 PM
Hello, can I ask some array and matplotlib help?
 
Hello. You're best just asking the question and people will answer/review it if they can. If it's a big (> ~15 lines of code) example, then use something like pastebin and put the link here
 
1:57 PM
I have a 2d array that's accessable like data[1,1], what's the difference of calling data[1,0:1] vs data[1,0]
it seems that the former returns a list
 
no, it returns an array
 
nvm, what's the intuition about the data[1,0:1] syntax?
that it returns a subarray rather than the element?
 
Similarly how with lst = [42], lst[0] is 42 and lst[:1] is [42]
@mavavilj it's called a slice
 
I see this gong to ax.plot(data[0,0:1], ...
 
@mavavilj you probably should be doing something else
 
1:59 PM
what you mean?
 
Why plot a single point? You can plot multiple at once.
 
the precise line is: line, = ax.plot(data[0, 0:1], data[1, 0:1], data[2, 0:1])
so it just seems like initialization
 
Initialization?
Do you have a more complete example? I just suspect an XY problem
 
The line: line, = ax.plot(data[0, 0:1], data[1, 0:1], data[2, 0:1])
works
but I don't understand why it's that way
I can't find documentation for ax.plot
 
@mavavilj probably matplotlib.org/3.1.1/api/_as_gen/… for 3 data args
 
2:04 PM
what does the line, mean?
 
It "works" but passes 3 single-element arrays to plot
 
that it omits the second return value?
 
@mavavilj no, it means the returned 1-element list is unpacked into the name line
 
is , some operator?
 
If there were more than 1 items returned by plot it would error
@mavavilj it triggers tuple unpacking on the left-hand side
It's equivalent to line = ax.plot(...)[0] except it raises if there would be more than 1 item
 
2:06 PM
but is , some operator?
 
I don't think so
 
or it's like "I expect tuple, but 'wild card' other than the first"?
 
@mavavilj no, as I said it would raise an error if there was more than 1 item
[line] is a single-element list, (line,) and line, are both a single-element tuple
 
I don't understand how it means unpack
 
>>> [line] = [42]; print(line)
42

>>> (line,) = [42]; print(line)
42

>>> line, = [42]; print(line)
42

>>> line, = [42, 43]; print(line)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-58-9c3cf45dd31b> in <module>
----> 1 line, = [42, 43]; print(line)

ValueError: too many values to unpack (expected 1)
 
2:08 PM
that seems like bad syntax
 
it's a basic python thing, not a matplotlib or numpy thing
>>> var = [42]; print(type(var))
<class 'list'>

>>> var = [42]; print(type(var), len(var))
<class 'list'> 1

>>> var = (42,); print(type(var), len(var))
<class 'tuple'> 1

>>> var = 42,; print(type(var), len(var))
<class 'tuple'> 1
so it's a combination of ^ that with iterable unpacking on the right-hand side
actually, I'm not even sure "unpacking" is the right word here, sorry
 
@mavavilj no. You have a 2D array, so the , separates which dimension the slice works in
 
@roganjosh Hold on, different comma. Please read it all.
 
Ok, I did read it all and I thought that was where the confusion was coming from
 
ah, OK
10 mins ago, by mavavilj
what does the line, mean?
in line, = ax.plot(...)
 
2:19 PM
20 mins ago, by mavavilj
nvm, what's the intuition about the data[1,0:1] syntax?
Followed by multiple questions about whether , is an operator
I think that is where the confusion lies tbh but I could definitely be wrong
 
could be
13 mins ago, by mavavilj
or it's like "I expect tuple, but 'wild card' other than the first"?
Frankly I don't get ^ that at all
 
We're aligned on that one :)
 
@mavavilj let me try one last time. First, what happens is a call to ax.plot where a 2d array is sliced in a weird way that gives you three one-element 1d arrays each. data[0,:1] and data[1,:1] etc. are all 1d arrays, equivalent to [data[0,0]], [data[1,0]] etc, respectively.
Now, when you pass two or three 1d arrays to `ax.plot` you get a "line" (in this case a line with a single point, because you're only passing a single coordinate triple). This line object is returned in a one-element list. What then happens is that this one-element list is unpacked on assignment into the name `line`. Equivalently you could've done
lines = ax.plot(...)  # should return a 1-element list
line = lines[0]  # take the single element
this is what was compressed to a single line by using line, = on the left-hand side, which worked due to the tuple syntax I explained above; you're creating a single-element tuple (line,) to which the contents of the right-hand side get assigned to. Since there is only one item in the list on the right side this will work, assigning that single item to the name line on the left side.
I can't explain this any better without you reading a good python tutorial and the numpy indexing docs I linked earlier
 
I can't explain it better than that either, but you also can also just ditch matplotlib altogether and just look at the data you're trying to plot
Once you think that the data itself makes sense, then add the plotting functions
 
@AndrasDeak The docs don't seem to have a special name for it. docs.python.org/3/reference/…
Assignment of an object to a target list, optionally enclosed in parentheses or square brackets, is recursively defined as follows.

If the target list is a single target with no trailing comma, optionally in parentheses, the object is assigned to that target.

Else: The object must be an iterable with the same number of items as there are targets in the target list, and the items are assigned, from left to right, to the corresponding targets.
 
2:34 PM
okay I think this is some kind of "tuple is a 2-list" thing
IIRC python had that kind of "syntactic sugar"
 
@PM2Ring thanks for the sanity check
@mavavilj no, it's not
I mean, I have no idea what you mean, so probably not ;)
 
^ :P
 
consider (a, ) = [1.0]
and then (a,b)=[1.0,2.0]
there's an association between tuples and lists?
 
Association?
 
no, it works with any kind of iterable on the right-hand side (and native sequence on the left, I think)
 
2:37 PM
nvm I now understand the syntax
it's just a bit lousy to write it a, = [1.0]
because I've learned to think that returning (thing1,thing2) is grossly different from returning thing1, thing2
 
you can definitely put any kind of iterable on the right-hand side, even things like python 3 zip and map objects or generators which are not reiterable
 
except maybe in python
 
@mavavilj yes, in python a comma usually creates an implicit tuple
And yes, it can be confusing, so a, = [1.0] is frowned upon by some. It's "cute" but it can be confusing.
 
Ok, so I was wrong over the comma issue. I totally missed it on my phone. Sorry
 
@mavavilj No, they're the same. A tuple is created by the commas, not the parentheses. The parentheses are sometimes needed to resolve ambiguity, and for the zero length tuple.
But I agree that it can be helpful in some cases to use the parentheses even when not necessary, to improve readability. And the case where you have a 1 item tuple on the LHS of an assignment is one such case.
 
2:45 PM
cbg
 
OTOH, doing return a, b is preferable to return (a, b). And return(a, b) is definitely out, because it looks like a function call.
 
After SO and reddit have committed seppuku, I need a new website to waste my spare time on
 
@Aran-Fey Are they going any time soon?
 
Seppuku implies honour. That's not what's happened to the main site. But I'm in the same boat as you :)
 
@Dair No, they turn into zombies after they die. They're dead to me, but still desperately cling to life
 
2:56 PM
Aug 28 '18 at 21:39, by PM 2Ring
We need to build our own Stack Overflow with blackjack and hookers.
 
*nods* Sounds like an improvement to me
 
Dang I use reddit all the time and I didn't realize it was dead.
 
It's started randomly redirecting me to www.redditinc.com/advertising for some reason
 
I don't use SO much but that's just because I don't have any particular useful domain knowledge to share...
@Aran-Fey wat that's weird
 
It also immediately logs you out and reverts to default settings (light theme, RIP my eyes) if your internet connection hiccups for a second
 
2:59 PM
I parked a domain name in the past that I was going to use and it was just a page of ads because I didn't end up using it. Maybe it's along that vein.
 
basically they desperately need to hire some programmers who know how to do their jobs
 
@Aran-Fey Remember that time that reddit was briefly open source?
 
nope, that may have been before my time. I haven't been on reddit for very long
 
iirc, their contribution policy was pretty strict and as a result I never contributed haha.
And not only was it strict, but I had no idea how to use elastisearch or any web framework
 
@Aran-Fey wanna share?
 
3:02 PM
Sorry, not following. Share what?
 
> I need a new website to waste my spare time on
Misread that twice :| sorry
 
Yeah, I haven't found one yet. Open to suggestions :)
 
I heard twitter is in full bloom...
 
Oh man, it really is the end of days if twitter is the alternative to SO :/
 
To be honest I have no idea how twitter works and I'm not sure if it's worth finding out :D
 
3:06 PM
maybe instead of wasting time on the internet you could waste time in nature?
waste time trying to prepare for an internet apocalypse where you have to resort offline documentation for everything?
 
No internet, no technology.
 
@Dair on my lunch break, I go for a walk around a llama farm in the valley. Inevitably, though, I do have to spend some time on the PC doing work, and SO used to be a little refreshing to try solve problems here and there that weren't tied to work
 
@roganjosh awwww
 
I'm not saying no computer lol, just no internet. As in do it for the challenge
 
@Dair Not a bad suggestion, but I'm not a big fan of 30 degree heat (:
 
3:11 PM
@AndrasDeak I'll grab you a picture tomorrow if the walk is actually open now :)
 
Thanks!
@Dair and I'm saying if the internet goes away your computer will be useless
 
@AndrasDeak Not really sure why you think that. I went off internet and got stuff done. I've noticed that your mileage will vary depending on what you're doing.
 
What kind of stuff? With what goal?
 
It's almost like Andras doesn't have a selection of movies/series/music/books/mangas downloaded to his PC. Weird.
 
@AndrasDeak I wrote a small stack based language in Rust (completely works) and tried doing some GA stuff in Rust (with questionable success, but frankly I got busy before I could do some serious debugging). It probably would go easier with Python. I needed internet to download Rust and a random number generation library (it isn't in the standard libraries for Rust, surprisingly).
 
3:16 PM
Yeah, sure, there are isolated things you can do with your PC. Movies and media as you said, or offline games you already have downloaded. But I believe the 95% of things you'd use your computer for would go away with an internet-less apocalypse
 
@AndrasDeak Probably hard to ssh in HPC cluster without internet access tbf
 
You never hard to look up the language docs once to make it?
 
If you write a stack based language, what will you do with it? Distribute via github?
 
Real talk: With no internet I'd probably make more progress on my programming projects than I do now
 
@AndrasDeak Use it in the GAs
 
3:17 PM
@Dair and what do you use the GA for?
 
@AndrasDeak Generating programs.
Tbf I don't have a customer :P
 
I could go on but I'm probably not making my point very well :D
most of what we do is intertwined with the internet to the point that none of it would make any sense anymore without internet
our isolated computers would work and could be used for certain trivial tasks, but why we waste all that time would just be gone
 
I might be a rare exception to that rule, but I mostly spend time doing fundamental number crunching...
 
Where do the numbers come to you from?
 
@roganjosh "Numbers" Say I want a genetic algorithm framework to generate a "Hello, World" program in brain*****
 
3:21 PM
You can't crunch numbers unless you have them accessible. So, presumably a memory stick. What put the numbers on the system that you take the file from?
How did you get Brain**** installed?
 
@roganjosh I wrote an interpreter for it lmao
 
Well, Dair is the person to be around in the apocalypse it seems :)
 
Ok... So before I go down a rabbit hole, you'll probably use the internet at some point. But I'm saying more like make it a game to minimize it. Like if you plan a project out and download all the stuff you think you need see how long you can go programming without it. I guess it depends on the project but if you use the internet once to download the tools you need I think you can go for extended periods of time (3 days to a couple weeks)
 
it's a game that I certainly wouldn't want to play, personally
 
ok it was just a suggest for alternatives to SO and Reddit haha.
 
3:28 PM
Well, sure, it definitely occupies time :P
 
and i'm personally not going to do it again soon because last time i did it I forgot to respond to some critical emails in time haha.
@roganjosh I use Zeal btw for offline documentation, there is also Dash
 
I was programming for a couple of decades before I had internet access, although in the last few years of that period I did have FidoNet. I guess without net access I'd do a lot more ray-tracing.
 
4:30 PM
Hi again everyone
I wrote a code for a custom strip function(acc to a book question)
import re
test_expression = ';Sample expression;'

def remove_leading_trailing_space(exp, separator = ' '):
    regular_exp = '^' + separator + '+' + '|' + separator + '+' + '$'
    exp =  re.sub(regular_exp, '', exp)
    return exp


print(remove_leading_trailing_space(test_expression, separator = ';'))
Is it ok regarding code standard or do I need to improve anything? I am trying to follow everything I learnt today including the advice I received here
 
Most obvious: remove whitespace from around keyword =
And I'd use f-strings or str.format
 
I know next to nothing about regex but the name of the function suggests to me that you could just do .strip(). I have no idea what the function actually does.
 
Removing leading and trailing "separators". I wouldn't call it "separator" though.
and yeah .strip only won't work for multichar separators, but for that case RaphX' code is buggy
 
Regex Version of strip()
Write a function that takes a string and does the same thing as the strip()
string method. If no other arguments are passed other than the string to
strip, then whitespace characters will be removed from the beginning and
end of the string. Otherwise, the characters specified in the second argument
to the function will be removed from the string.
It is an exercise involving regex, I am aware of strip
 
> whitespace characters
That's more than ' '
 
4:40 PM
@AndrasDeak Didn't get this point
 
\t, \n
google regex whitespace
 
In terms of the regex, I cannot help. But it seems that "remove_leading_trailing_space" is not what that function actually does
 
@roganjosh indeed
 
Yeah would 'remove_leading_trailing_whitespace_chars' be better?
 
Not for me
remove_leading_trailing_characters would at least stop me jumping to conclusions
 
4:42 PM
^
strip_regex or regex_strip
 
@AndrasDeak I googled it, I guess now I can simplify it further
@AndrasDeak Yeah this seems like a better name, I was trying to describe it too much
Thanks everyone!
 
5:09 PM
I thought that was a mod thing?
 
I guess I haven't spotted it being used by people other than mods
 
5:44 PM
I do not know about this person that you address as u, whether or not they ran your code. But I know without running that it does not fix anything, because it does not address the problem that OP was experiencing. — Antti Haapala 1 min ago
 
foo = Foo()
s = json.dumps(foo.__dict__)
os.system("echo {0} > ./build.json".format(s));
^ Code found on SO. SO. Let that sink in.
 
sigh... that's the problem with SO.
People are asking "what's wrong with my code"
 
And you're not allowed to say "everything"
 
... or that "it was written by a clueless n00b"
like, in C land I was just trying to find an example of how to do realloc right, and instead I found 2 pages of search results of "why is my code wrong"
 
"u" is like a partial "Q" from James Bond, but picked up from the pound store checkout.
 
5:48 PM
Your software engineers were so preoccupied with whether or not they could, they didn't stop to think if they should.
 
@Aran-Fey let that sink. FTFY.
 
I'm going to have to get SLURM to play well with pipenv, iirc last time I tried this it was not trivial...
 
why would a scheduler of all things have to play with pipenv?
 
I don't play with pipenv at all.
 
Path issues or something? In my experience things Just Work, both with slurm and SGE
there are standard things you have to source for MPI and whatnot, but user-specific things usually work for me
 
5:51 PM
@AndrasDeak Because I wrote a thing that uses pipenv for installing everything. I want to just have it install the stuff with pipenv and then run the job. I might just have to gut the pipenv for the slurm script in favor of vanilla pip...
 
Your scheduler-based job will install something??
You install stuff, and the scheduler activates your env and runs it.
 
Wait, so does pip install before the scheduler? or after?
 
Come again?
Install stuff yourself. Scheduled job only runs.
 
ok. I'm going to take that as pip install in a slurm script is ran and then the scheduler dispatches that stuff.
 
Whaaat?!
I'm saying the opposite
3 mins ago, by Andras Deak
You install stuff, and the scheduler activates your env and runs it.
Have an env in your home, whichever machine that uses it will activate
Worker nodes compute. Period.
Some clusters might even restrict network access for workers
 
5:58 PM
ohhhh... an env in your home... I'm definitely going to need to reread those SLURM docs.
 
Well...if your cluster says that's OK go for it, but I've never met jobs that install before running
 
01:00 - 18:0018:00 - 00:00

« first day (3221 days earlier)      last day (1731 days later) »