« first day (2889 days earlier)      last day (2062 days later) » 
03:00 - 23:0023:00 - 00:00

3:09 AM
cbg
 
 
2 hours later…
4:55 AM
cbgs
 
cbg
 
Great answer on that square region means question. I got my answer working but yours is twice as fast
I might revisit that some day to try to find something faster
 
5:41 AM
Thanks! Yea those are the fun types of numpy questions, the ones where it's just shuffling things around
 
6:33 AM
cabbage
 
cbg
 
7:01 AM
That challenge of wim's yesterday sent me quite far down the rabbit hole. Apart from not finding the answer to the original question, I now also wonder 1) what actually happens if you call a class to create an instance: A() (hint, it's not A.__call__), and 2) what happens when an exception is raised.
 
@wim You wanna update your answer before I post the bounty? You might get downvotes from people who don't know what you're talking about
@Arne A.__call__ is called when an instance of A is called. So when the class A is called, that call goes the metaclass's __call__.
 
ahh
 
type.__call__ is also where the mechanism that calls __init__ after __new__ is
 
7:16 AM
Morning guys
looking for a way to download multiple files(.jpg) with a single action, single click I mean...I was reading that http does not support more than one file download at once...but I bet there's a solution for that...
 
7:34 AM
That doesn't sound like a Python problem.
 
@user2357112 oooops, true, my bad ! sorry :(
 
 
More than enough
 
8:37 AM
Cbg
 
8:58 AM
This seems rather close to the question you asked and self answered some 3 years ago: stackoverflow.com/questions/32835576/…Ilja Everilä 10 mins ago
 
 
1 hour later…
10:27 AM
cabbage
 
10:41 AM
Cbg
 
10:57 AM
cbg
 
11:32 AM
This question cracks me up. Totally not robots.
 
12:00 PM
Il didn't find this link
 
Got removed already. =(
 
> im working on a project named AUTOMATIC EVALUATION OF SUBJECTIVE ANSWERS with use of NATURAL LANGUAGE PROCESSING as its domain and python as a base programming language?but i'm not sure of NLP techniques used?
^ the question in all its glory
 
12:15 PM
If one makes such a model, he/she won't need to find a job for the rest of his/her life haha
 
A question I answered on the 4th got edited with a whole new set of requirements, effectively making it a new question. Classy.
 
Relish the opportunity to help that OP twice (-:
 
The second lesson I will give is: you cannot extract unlimited generosity from strangers online
 
12:39 PM
I mean, if you cycle your strangers effectively...
 
... Then you eventually poison the well and all of the bright-eyed helpers become jaded like me
 
cabbagey
 
No longer tempted, I just got it.
 
Avoid temptation by giving supreme executive control to your psychological id. At least one third of me thinks this is a great idea.
 
1:30 PM
@davidism Is it different from the OST?
 
Yes, new full orchestra performances. Nier and Automata
 
I've heard a lot of praise about Nier Automata but the only thing I actually know about the game is "two robots go on an adventure"
 
wim
@Aran-Fey haven't had the chance due to too much real work. will try and do that sometime today
 
That's what I forgot to add to my wishlist
Thank's Davidism 😃
 
Hmm, I'm disappointed that a google search for Yoko Taro shows a picture of him without his trademark spooky moon helmet. He was doing a good job of maintaining that mystique.
 
1:43 PM
\o cbg
 
What other full-face-mask celebrities have been foiled by google... Deadmau5, for one. Kudos to Daft Punk for thus far eluding the internet panopticon.
 
@davidism I didn't see this on my twitter feed.. thanks for the post :D I'm going to see if I can get my hands on it.
 
@davidism sweet, they even deliver to germany. thanks for the heads up!
 
I follow @kuraine (composer of the Celeste soundtrack) and she posts good music stuff a lot. That's how I found out about this.
 
off-to-vacation rbrb =D
 
1:53 PM
\o
 
2:17 PM
\o
 
@Kevin Lordi holds out I think
I mean \o
 
.....
you ruined it Andras
sit in the corner for a bit
 
^ why? So the troll can snicker?
 
?
 
2:24 PM
I ditto that question mark.
 
I see @ad in the corner snickering with delight that he messed up the pattern
Think of me like Jar-Jar Binks. I break in occasionally with attempted levity. Sometimes it just ends up annoying.
 
thy are awkwared
:-p
 
Anyone reading Stormlight Archive?
I know there are Mistborn Fans in this room. I assumed that would extend to Stormlight Archive... but maybe not
 
I got two chapters into Mistborn but it did not grab me
 
my wife is a fan
she's big in to fantasy in general
 
2:35 PM
I was going to say "Like Taravangian, some days are better than others". But I won't say that now.
 
But you technically did.
 
lol
 
shh
 
Today's word of the day is "apophasis"
 
Thanks for that, Kevin.
 
2:39 PM
TIL that chrome doesn't resolve environment variables in it's url unlike IE. Another reason to like IE.chan
 
Is... Is that a desirable feature
i would prefer www.not_a_phishing_site.ru?id=%PATH% to not be able to send data about my local environment to deep web assassins
 
True, but my use case was dealing with file:/// local file grabbing internally.
 
or www.super_safe.cn?id=%rsa_private_key%
 
On the other hand it's probably not a security vulnerability if it only resolves environment variables that you manually enter into the address bar. if <a href="www.not_a_phishing_site.ru?id=%PATH%"> simply passes the literal characters %PATH% as the id, I guess that's fine.
 
would it support file:/// as the starter only? i wonder if we can make a site that would cause a vulnerability. Perhaps not sending it to the servers and just allowing it locally to download....
 
2:46 PM
"copy this url and paste it to your address bar"
so no, IMHO interpolating env vars in the address bar is never acceptable
 
"Apophasis" reminds me of Quadrophenia, but the only parts in common is the "oph", so I guess that's an example of apophenia
 
I'm also curious on how IE would resolve %app%something%data%
 
3:00 PM
Hmm, what href do I put in an A tag to make it navigate to the same page you're already on, except with a query parameter? href=".?foo=blah" didn't do it
 
So you're not looking for the not the pound (hash) sign with id?
 
No. Ah, whatever, I'll just hardcode in the file name.
 
cabbage
 
pastebin.com/s5GmNebs demonstrates how IE handles environment variables in A tags. On my machine, it interprets them literally, so clicking on a link of this kind can't leak your data to deep web assassins.
If you subsequently highlight file://whatever_path_goes_here/test.html?id=%PATH% in the address bar and press enter, it evaluates the argument, and the JS can see your path data.
So. Pretty much what I predicted I guess
 
The word of the day is absolutely not apophasis and if anyone tries to bring it up it will not be discussed
 
3:08 PM
MooingRawr's question of "but does this behavior occur only for urls starting with file://?" remains unanswered
I welcome anybody with a web host to upload it and test it with http://
 
#forScience :D
 
Tried for a bit to get it to work in jsfiddle, but I expect the window object is sandboxed
Time to look up how to deploy plain html files to IIS
Ah, I just need to put it in wwwroot... You don't have permission to save in this location. Contact the administrator to obtain permission. Buddy, I am the administrator.
 
If the first argument of my function can either be an str or a dict and it gets something else, I should still raise a ValueError rather than a TypeError, right? My reasoning is that the problem is that it's not the type per se is the problem.
 
Ok, got it working. Result: http://localhost/test.html?id=%PATH% does not reveal your path data to the javascript environment, regardless of how you navigated to that page. So the apparent answer is "it only works for file://"
 
DSM
3:41 PM
Early lunch cabbage for all.
 
cbg for DSM
 
DSM
@MooingRawr: it's time. We need to limit the number of pitchers somehow. Eight pitchers? In a 1-0 game?
 
4:17 PM
mmh, i want to program tic-tac-toe, but i don't now in what type of variable(s) i should initialize the board. i guess a single string containing 9 digits is the most ugly one. which topic(s) should i read to make an educated choice?
 
why not 2D arrays?
 
yup, numpy arrays would make indexing convenient
 
thanks @shad0w_wa1k3r @AndrasDeak
 
4:36 PM
Some more subtle cringe for the visually conservative among us (cc @poke, @DSM :P) meta.stackoverflow.com/questions/374024/…
 
Meeeeeeeeh
 
According to extensive A/B tests experienced users stopped twitching a few days ago, signalling that it's time for the next set of minor design changes to be rolled out to the site. — Andras Deak Aug 13 at 13:45
 
Why do they keep making these random design changes without anyone asking for it, and without anyone telling anyone about it?
 
Tim explains in comments (...) that people don't know about their privileges (...) so they need to be harrassed [not his words exactly]
 
wtf
There’s a notification when someone unlocks a privilege!
I just need to click on it and get full information about it
And how is editing tags much different to editing the question..
 
4:43 PM
Think of poor New Contributors who need all that hand-holding. Imagine if they get to 10k; we can't just suddenly let go :P
 
Think of all the poor people who are being bombarded by too many permanent buttons and icons
 
Are any of the responsible designers even using SE for anything?
 
wim
@Aran-Fey
>>> if 1:
...     del __builtins__
...     print(123)
...
123
>>> print(123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'print' is not defined
^ block vs line
 
morning cabbage
 
4:55 PM
@wim Yeah I get it now, thanks. I think your answer would be a lot better if you explicitly stated that CPython only looks up the builtins at the start though. Would've been a much clearer explanation with much less text. At least in my opinion
 
How can I perform an intersection on one column pandas dataframes by row? I have multiple single column csv files that i read into dfs. Each one has the head/column 'people' and then a bunch of rows with names. In my final df I want only the names that occured more than once.
I've tried merge, join, and concat on people but am getting empty or full concat results
 
DSM
Why not concatenate them into a big df, count them, and then keep only the ones with multiple counts?
 
Making any usable element less visible is never a good design decision. You should visit this site for help with such choices. — Rob Aug 15 at 21:04
 
wim
@Aran-Fey I thought I did explain that.
 
DSM
If you know that you only want the ones which occur more than once (and you'd never care about only keeping the ones which occur more than three times, say) you could even use duplicated() and then drop_duplicates() to avoid manually counting anything.
 
wim
5:03 PM
That's the second paragraph, right?
 
@DSM that's what works!
 
@wim Well, it doesn't say that it's only looked up once
 
I'd like to also make a third column called count and list count and then drop duplicates ?
 
wim
@Aran-Fey why would it be looked up more than once? how would that even work?
you want the implementation to insert a lookup on __builtins__ name in between every line of your source code? that would be insane
 
DSM
@ex080: experiment with duplicated, drop_duplicates, and value_counts. See here, for example.
 
5:07 PM
@DSM thanks!
 
@wim Creating a new bound method object every time you access a method is also insane, and yet python still does that, so...
 
@Aran-Fey: Well, it used to, anyway. There's an optimization now.
 
I'm afraid I can't read that :/
 
wim
@Aran-Fey sorry my answer was not useful for you
 
No need to apologize. I'm sorry you invested so much effort into it only to end up deleting it
 
wim
5:16 PM
Yes. I won't make that mistake again.
 
Not sure if that means "I won't invest so much effort into an answer again" or "I won't answer your questions anymore" or "I won't delete my answers anymore", but I hope it's the last one
 
is numpy ~200mb big?
 
wim
It means I won't invest effort into answers for users that don't appreciate it
 
DSM
If the answer is good but it's the answer to a different question, you could always post a self-answer. I'd be far too lazy to do that myself, of course - just the other day I was annoyed that the OP accepted an answer which didn't even match her code's expectation or her description and just walked away because life is short.
 
@wim If you just amend the 2nd paragraph to clearly state that it's only looked up once, I'll give it an upvote
 
wim
5:20 PM
You are perfectly able to amend it yourself
"I think your answer would be a lot better if ..." <-- when you find yourself in this situation, just edit the answer
 
I don't want to force my opinion on you, and I certainly won't undelete your answer just so I can edit it
 
wim
there, it's undeleted, feel free to edit however you see fit
 
But I will tell you that I appreciate your effort, and I re-read the answer at least 5 times trying to find something I'd misunderstood or missed, because I wanted to reward you for your effort with an upvote
 
wim
Sorry, what I'm trying to say is that I think it's already crystal clear, so I don't really know how to edit to make it better. But I wasn't confused about the REPL/exec code example from the question in the first place. So you're probably in a better situation to improve it with an edit.
 
@DSM LOL :D It's okie I already shifted my mood from summer ball to winter pucks :D
 
wim
5:28 PM
editing is never "forcing an opinion", unless you edit it again after the author someone rolls back your edit.
 
Yeah, then it's a waste of time
I made a major edit, let me know what you think
 
wim
you don't think the exec examples with passing the name '__builtins__' explicitly are useful?
this is much closer to the module use-case than an indented block, because it uses the same loader to create the code (SourceFileLoader)
 
5:44 PM
I think they're more confusing than helpful, because people might be confused why exec(code, {}) works even though there are no __builtins__ in that dict. But I can only speak for myself, and I already knew how/why all of that works
You can add them back in if you want though, it's not like that'll make the answer bad
@wim Nobody knows that except for you :D
 
wim
OK. In that case, your edit looks fine.
 
DSM
@MooingRawr: sky's not the right shade of blue for me to feel support for the Blues just yet. :-) .. wait, not those Blues.. ehh, you know what I mean. :-P
 
When the summer blue gets to deep then you know you are right for the winter Blues :D
 
Just got an accept on an answer from two years & seven months ago. Gotta play the long game B-)
6
 
6:00 PM
cabbage
This might be tricky. Is there any way to dynamically modify/decorate a function with signature f(a=1) to accept a keyword argument b OR accept all keyword argument as if originally defined as f(a=1, **kw)?
I may be overlooking something obvious.
 
I haven't found a way to modify a function's signature yet. The best solution I know is to either replace the function's __code__ object with another function's, or to replace the function with another function altogether
 
You could write a decorator that accepts keyword arguments, then completely discards them:
def accept_keyword_args(func):
    def _f(*args, **kwargs):
        return func(*args)
    return _f

@accept_keyword_args
def frob(a=1):
    print("Got value:", str(a))

frob(23, b=42)
#output: Got value: 23
Problem with this approach: this also discards a if it was supplied as a keyword argument. frob(a=33) prints "Got value: 1"
 
Well, but I want to do something with the keyword in func :)
 
@Kevin That's easy to fix with Signature.bind though
 
I suspect it's impossible to refer to a name in a function and then inject an argument by that name into the parameter list at run time, because the parser needs to know at compile-to-bytecode time what the scoping is for each name you're referring to. Maybe?
The bytecode will assume that the name you're referring to is nonlocal, so injecting a local name into that scope after the fact won't help.
 
6:12 PM
Basically, what I am trying to do is write a decorator that binds objects to a function as if the function had these names/values as keywords, but such that they are not visible to the user when issuesing help(function). Here is what I currently have, line 46 does not work because bindings might have keywords unnkown to f. paste.ofcode.org/YzxZJj3rbd3VjvEmxaNWrx
 
import dis
def f():
    x = 23
    print(x)
def g():
    print(y)
print("Dis for f:")
dis.dis(f)
print("Dis for g:")
dis.dis(g)
the x in print(x) is loaded with LOAD_FAST. The y in print(y) is loaded with LOAD_GLOBAL. If you magically changed g's parameter list, the byte code for print(y) will still try to do LOAD_GLOBAL, so I don't think it would even try to check the local namespace.
 
Hmm, making names available in the function should be easier than adding parameters... We can probably replace the function's globals or something
 
everything in the code attribute seems to be readonly though
 
DSM
Can't you replace all of __code__? Sure I've seen that.
 
(note: everything I have written in the last five minutes is at least 50% conjecture)
 
6:15 PM
@DSM haven't thought of that yet
the problem with adding keywords via code is that help(f) would show the bound variables as keywords again...
is the code paste making clear what I am trying to do?
 
I'm fuzzy on the details but I think I get the gist of your goal
 
The problem I am trying to solve is that setting up a big invariant data structure inside a function might be the part that takes longest. I don't want to recreate that data structure every function call.
 
Can we approach the problem from the other end? Rather than having a small parameter list which we inject new values into, have a large parameter list which we omit parts of during help calls?
 
I could just make it a keyword, but then users may think that variable is part of the functions interface
 
DSM
Why not just separate out the creation of the big invariant data structure into a function and then lru_cache the call?
Don't get me wrong, solving the problem in the direction you're trying is lots of fun, but I don't know I'd use it in production. :-)
 
6:20 PM
@hide_variable_in_help("expensive_object")
def frob(a,b, expensive_object = make_big_object_once()):
    ...
I feel like docs.python.org/3/library/… might come in handy here
 
@DSM I'm a little fuzzy headed how exactly that would work with LRU cache. @Kevin that would do, as long as we'd figure out how to hide the variable.
 
DSM
And I guess my question is why not move expensive_object = make_big_object_once() inside the function, handling the signature problem, and then add @lru_cache(None) before def make_big_object once, avoiding the need to create hide_variable_in_help.
@timgeb: something like this).
 
You are right, this is no fun but probably the obvious way to do it. :)
 
This should work as long as you're using CPython and the function doesn't need to access any global variables that can change value (because it creates a snapshot of the globals at decoration time)
 
wim
I would do this with a callable class
 
6:31 PM
Hello Guys, can someone guide me on this please; Trying to extract data from API, but running into this problem,
for device in data:
fqdn = device['name']
if fqdn not in entries:
entries.add(fqdn)
print("\nDevice: %s" % fqdn)
for ips in device["dynamicFields"][0]["values"]:
try:
ipaddress.ip_address(ips)
print(ips)
except ValueError:
print("Not Found")
Trying to print all IP Addresses associated with device, But want the device name to print only once.
Can anyone please help me how to write it in a more easier way? When I try to print on a csv file, my fqdn and ips value start falling apart
 
wim
class MyClass:
    sane = False
    def __call__(self, *args, **kwargs):
        if not self.sane:
            # do your expensive setup stuff
            self.sane = True
        # do your usual stuff

f = MyClass()
 
DSM
Ehh, if we're manually writing the cache ourselves, might as well use a function attribute. No need to invoke class machinery.
 
for device in data:
    fqdn = device['name']
    if fqdn not in entries:
        entries.add(fqdn)
        print("\nDevice: %s" % fqdn)
    for ips in device["dynamicFields"][0]["values"]:
        try:
            ipaddress.ip_address(ips)
            print(ips)
        except ValueError:
            print("Not Found")
 
@wim right, but it would be cool if I could modify existing functions with that.
 
wim
6:35 PM
well, that's just, like, your opinion, man.
 
@Aran-Fey cool
 
@Aran-Fey Apologies, I overlooked it when I wrote it first time.
 
wim
I don't like functions that are stateful but pretend not to be stateful by abusing stuff like the function dict. Rather just use a callable class, because it's clear to the world that this thing has state.
 
@KaranM I don't really see anything that could be improved in that code. Looks about as good as it gets.
 
wim
I also try to avoid lru_cache these days for similar reasons. The stuff in cachetools is much better anyway.
 
6:39 PM
@Aran-Fey I am not able to print them on csv file though :(
 
I was wrong, you can't change parameter list documentation using functools.wrapper. That information comes straight from inspect.signature, which gets data from func.__code__.co_varnames, which is read-only.
 
DSM
@wim: I was going to ask if you felt the same way about cache decorators. On the one hand, points for consistency I guess, but on the other, yeah, I don't think I'm going to follow your path on this one. :-)
 
wim
lru_cache is a pain in testing.
 
@KaranM Well, we don't know what your csv file is supposed to look like, so we can't exactly help you figure out how to write it. We're going to need a Minimal, Complete, and Verifiable Example - some example input and the corresponding csv file.
 
wim
in fact, decorators in general are kind of a pain in testing, but caching decorators especially so.
 
6:44 PM
@Aran-Fey I tried something similar earlier, but didn't think of copying the function explicitly.
I guess that's the best we can get in terms of a bind decorator. Too bad it has the flaws you pointed out.
Btw, I would not mind using a callable class if I had not to type it out myself, i.e. abstract the process somehow.
 
@Aran-Fey I did create a MCVE, stackoverflow.com/questions/52303720/…
 
DSM
Today's unexpected decision of the day: I think I'm going to continue using decorators.
 
Karan, we try to ask people not to segment their questions between the main site and here, it creates fragments of answer and possible attempts to solve the question. Your question is still fairly new though, perhaps checking back in a day or two if you don't receive an acceptable answer ?
 
Ugh, I hate that seen_add answer so much
 
@MooingRawr Sure, Thank you! :D
 
wim
6:51 PM
well scientists are notorious for having messy and untested code, and then needing someone else help to untangle all the hidden mutable state once the codebase is at 20k LOC... :D
 
My experience with scientists is that they flat out refuse to use variable names consisting of more than one letter.
 
also, it's not really a good thing to edit your question with more questions, generally people feel it's a bad question for future readers. A possible solution is to write your question as: "My end goal is to put this in a csv but currently I'm trying to print it out to verify before adding it to a csv, but it's not printing correctly, how can I print it out and possibly get it into a csv file, I've tried this and this".
 
@KaranM You've edited your question twice already, and the 2nd edit suddenly asks how to write the data into a csv file. It looks an awful lot like you're making a chameleon question there
 
This allows future readers and current readers to understand what the purpose of this post, rather than be stringing along for the ride..
 
wim
@timgeb until they need more than 26 variables 😂
 
6:54 PM
If there's too big of a jump between your current problem and the end goal, then break up your questions and ask separately but that might be a bit finicky. Just some food for thought I guess.
 
@wim Python3 allows unicode identifiers :D
 
My bad, I didn't pay heed to my question, once I started getting near to my task, went on editing and asking more.
 
@wim I explained to a guy what it would probably be easier to debug his function if his variables were not named a, b, c, ... He proceeded to rename them alpha, beta, gamma.
*what=that
 
@MooingRawr Will update it. :D thank you
 
@Aran-Fey can you explain to me why help(f) does not show the kwarg foo with your solution?
 
6:57 PM
No worries, life is about learning new things. People don't like XY questions or as Aran said it "chameleon" questions because maybe someone has a different solution than you that is easier or what not.
 
@timgeb Because it's a global variable :) The 2nd argument for types.FunctionType is a dict that represents the global scope, that's where foo is
 
wim
@timgeb well, someone had better tell the scientists to move off Python 2.6 then .. :)
 
Code of Conduct Review: I hate leaving comments like this because I don't want to come off sounding condescending. Even though this instance ended well, what do you guys think? stackoverflow.com/questions/52319772/…
 
Ah, got it. We can't make it actually a kwarg of the copied function but then let it look like the old function with something like functools.wraps, can we?
 
@Aran-Fey oh fancy solution, I like it alot
 
6:59 PM
Y'all are making me worried with your CoC reviews
 
note that I do not abbreviate it
 
All I see is "Is this comment that's a dozen times friendlier than anything Aran writes acceptable?"
 
@piRSquared nothing wrong with your comment at least from me
 
thx both
 
It's a nice way of saying, "have you tried it?".
 
wim
7:00 PM
the "Typing this comment is likely more effort than typing an explanation but I believe you will be better off" part is meta and could be removed
 
good point
 
hmm might be a bit condescending, but you could play it off as an example on how easier trying and understanding it might be.
 
@timgeb Well, there's a bunch of problems with that. First, foo is a global variable in f's body, so if you want to turn it into a parameter (a local variable) you have to completely recompile the function's source code. And secondly, the parameter would still exist even if you hide it under a fake signature, so things like f(foo=set()) would be possible
 
I know my intentions were good. But that is often different than perception. So your feedback is valuable.
 
I give up then. That decorator would have been awesome.
 
7:04 PM
OP seem to have taken it in a good stride, so I would say it's not as bad as you think ?
 
7:49 PM
@davidism blurgh?
 
github.com/pallets/click/pull/1014 Was this a coincidental Robert Grant?
 
8:04 PM
Cabbage
Waiting for a 20-minute test run
 
@Code-Apprentice cabbage :)
 
How are you?
 
I'm fine. I hope you too!
I'm reading "Asking" and the subtextes of it
I admit that I should have done that a long time ago, but late is better than never I guess.
 
8:27 PM
is it bad coding that a function loads a module, or should i write in a docstring or comment that this function requires a certain module and avoid it in that way?
 
Imports usually go at the top of the file. You can sometimes write imports in functions if you know what you're doing.
 
wim
8:40 PM
> is it bad coding that a function loads a module
yes
if I'm missing a dependency, I want ImportError at import time, not at function call time.
 
you and your neediness
 
What if it's an optional dependency?
 
^ and sometimes you'll get to know only at function call, depending on your IDE
 
I recently wrote a script that computed things then optionally plotted them using mayavi, and I was tempted to put the mayavi import into the plotting function (not to be used in some computing-y scenarios). I ended up writing a check to see if mayavi works (being importable wasn't even enough, because some installations of mine can be imported but can't be run). Of course this all wouldn't have happened if vtk+mayavi wasn't a huge pain in the yam
my current workflow is 3.7 unless I need mayavi because then 3.5 :|
 
wim
code with optional dependencies should go into submodules
with the necessary imports remaining at module level
@shad0w_wa1k3r I don't buy that.
 
8:50 PM
How does the IDE concern import errors?
 
@Aran-Fey import with an if statement at top? then your conditional dependency should still be at import time :D
 
I was talking about runtime exceptions, some IDEs would catch those as well, AFAIK
 
Unless you are saying if product_is_finished: import x well then then x would be in another module that handles after the product finishes, in long story short kevin'd by wim.
 
If said import is only being used in that single function...
 
8:53 PM
no clue what you are miniranting about but all the power to you I guesS?
 
is there an easy way to stack multiple png's on top of one another?
 
@piRSquared yeah, they're called gifs
 
hehe
@piRSquared programmatic or manual?
 
/longsigh_shouldve_anticipated_response
Yes, Yes.
@shad0w_wa1k3r programmatic via python
 
you can always imageio.imread -> stack -> imwrite
 
8:55 PM
img 1
------
img 2
Thats what I was just about to explore
is imageio better than pillow
 
it's what deprecated scipy.ndimage.imread suggests as a replacement
 
@Null That just makes it more interesting. I assume this is just an exercise. If not, there's a numwords module you can install.
 
@PM2Ring it's an exercise
 
@Null In that case, be grateful you're doing it in Python & not in C. :)
 
9:04 PM
done
 
@AndrasDeak that worked perfect. But I used numpy.vstack I didn't see another stacking and I guess it shouldn't matter
 
@piRSquared there's hstack/vstack/dstack and stack
 
tyty
 
you need either vstack or stack+axis kwarg, I think
 
I meant in imageio
 
9:05 PM
oh, I meant numpy :) If imageio has one that's even better
 
@piRSquared I'd probably do it in PIL, since that's what I know. It's pretty fast at pasting stuff. It might be faster to get Numpy to do the stacking, but then there's the ovefhead (and extra RAM) of converting PIL Images to Numpy arrays & back again, although that's pretty fast too.
 
I forgot to mention that I first heard of imageio 5 seconds before I suggested it to you
 
lol
scipy recommended replacement... I'll follow blindly
 
well they know their stuff better than I do
 
If you need to handle arbitrary PNGs, you'll need to handle palette-mapped images. The easy way in PIL is just to convert them to RGB.
 
9:24 PM
Currently, I'm generating pngs via matplotlib and I simply want to stack them. They're all the same size so easy peasy
 
plt.imread?
closing as no MCVE
 
^ doh! i'll stick with that. I'm assuming plt.imsave works as I hope
 
If matplotlib can write PPM and you're on a *nix system, you can stack them with ppmcat.
 
@PM2Ring does looking at the numwords module ruin the fun?
 
@Null Maybe. OTOH, numwords can do lots of stuff that a simple number to words program doesn't need to do.
 
9:37 PM
@piRSquared never used it, but should be straightforward enough
 
so if i'd play codegolf writing a numbertoword-function would yield a better result than the module?
 
@Null Well, you'll learn more that way. ;) Doing it correctly can be a little tricky. It's not super-hard, but it's not an exercise for raw beginners either.
 
In Hungarian the numbers are straightforward, but we need to watch hyphenation. It's [onethousandtwohundred] but [twothousand-twohundred]
 
ten one, for eleven sounds strange
 
you don't hyphenate between 10^(3n) - 1 and 2*10^(3n) but you hyphenate the rest
@Null I was 12 when a relative asked me how old I was and I told her I was "twen...teen"
 
9:51 PM
hehe :D
base 5 would be a more logical system
 
stackoverflow.com/q/10181932/1222951 ancient no mcve junk with 6k views
 
Let's Golf: i = 90843750293845234509; What is the most succinct way to sum the digits without turning i into a string?
 
then you could count with your fingers higher than {10}_10
 
Cabbage all. I could do with some help regarding a question I asked over a week ago stackoverflow.com/questions/52156583/… The other 403 question linked definitly does not solve the problem
@piRSquared Oooh nice :) Sorry for spoiling that but I am desparate at this point
 
we could count to 5*{5}_5, imagine the possibilities lol
 
9:54 PM
@Simon you left a comment to your answerer 13 minutes ago :P
 
Yes with an answer using requests, showing code that does not work :/
 
details, details
 
"details"
@AndrasDeak Why have you not asked why I didn't reply earlier?
Because the site has been offline till today (I forgot to note down the API key) so I couldn't use it/test anything :D
 
in german we have milliarde for billion, not a fan of it...
 
@Null same here
 
10:02 PM
t = 0
while i:
    i, r = divmod(i, 10)
    t += r
print(t)
 
s=0
while i:
  i,j=divmod(i,10)
  s+=j
s
hah!
rbrb for drive home
 
Rbrb
 
ghostcabbage here :)
 
i like picnic :)
 
10:14 PM
>>> i = 90843750293845234509
>>> import math;sum(i%10**(n+1)//10**n for n in range(int(math.log(i,10))+1))
90
 
Mr Agana is sadly the only cool anagram of "anagram"
 
>> i = 90843750293845234509
>>> f=lambda i,s=0:i+s if i<10else f(i//10,s+i%10)
>>> f(i)
90
 
Nice.
 
oops, missed a > (ca-rot? as in 90 degrees)
 
10:36 PM
brief cbg
 
Very brief cbg; how's your back?
 
better... needing to be somewhat careful leaping around to jump up to cap'n's top shelf where I know he's keeping the proper cookies but otherwise, not too bad thanks :)
 
Glad to hear that :)
Hope it keeps improving
good night
 
thanks for asking... take care yourself
night
 
03:00 - 23:0023:00 - 00:00

« first day (2889 days earlier)      last day (2062 days later) »