« first day (3504 days earlier)      last day (1458 days later) » 
00:00 - 19:0019:00 - 00:00

12:18 AM
what's the deal with await and stuff
 
 
4 hours later…
4:15 AM
Folks, I'm trying this string interpolation:
file_name = f"my prefix {my_dictionary["id"]}.csv"
I get an error with a squiggly red underline under id. The error says "invalid syntax".
At the same time, this line [same idea, less syntactic sugar] works just fine:
file_name = "my prefix {id}.csv".format(id = my_dictionary["id"])
 
wim
4:32 AM
you used double quotes in double quotes
make one pair of them single quotes instead
 
hey btw, I think stackoverflow.com/questions/52497739/… is distinct from the question it has been marked the duplicate of
@Theo async io
 
5:14 AM
@aadibajpai no it is not. It shows both oneshot and default in answers.
 
I bet this is more of a Win shell question than a Python question. This works:
subprocess.call(["schtasks", "/delete", "/tn", "'mytaskname'", "/f"])
notice that /tn and 'mytaskname' are passed as separate arguments. Although, I see them as one argument which has name and value.
This doesn't work:
subprocess.call(["schtasks", "/delete", "/tn 'mytaskname'", "/f"])
The shell complains that it got an invalid argument/option "/tn 'mytaskname' ".
 
wim
5:43 AM
@aadibajpai I agree with you, reopened. @AnttiHaapala what looks like the default version does not actually work (requests.utils.default_headers() returns a copy, mutating it does not stick)
 
5:56 AM
@wim it is the one under, the session one
@wim I think they all should be made into one... the other does not even specify that it needs to be "one shot"
now all this does is there are two sources describing how to do the one thing.
 
wim
6:36 AM
I saw that too, but it's still different. Then you have to pass the session around. Other OP commented:
I understand your way to set header,But now I have finished coding,and I have hundreds of requests.get in my code,so I want to a simple way to golbally setting — 白稳平 Sep 25 '18 at 13:10
that's pretty clear that they don't want to use explicit session(s), even though you or I would probably consider that best practice
 
7:04 AM
@wim No graceful ones. Coroutines are regular, synchronous code (iterators) under the hood. If one blocks, everything else in that Thread (event loop + other coros) are blocked as well.
You can try timeout mechanisms that work for blocking code, such as signals.
If possible, try to run the offending code in a thread. All event loops have mechanisms for that. If the code is written as cooperative (async) but isn't (blocks), that might need some hoop hopping, though.
Ideally, fix the code so that it does not block.
 
wim
7:30 AM
How would you do e.g. reading from stdin or raw_input with a timeout
I can do it with threads and signals, like that, just wondered if asyncio had a more convincing story here
 
8:25 AM
for trio, it seems that trio.wrap_file(stdin) will give you an asyncronous file handle. Something similar is possible with asyncio.
these work with threads behind the scenes, so you likely cannot timeout the actual read operation. You should be able to cancel waiting for the read operation, though.
In general, async support for files and file-like objects appears to be poor; the OS' don't provide the appropriate non-blocking calls.
 
9:23 AM
Umm.. guys, in python, if I want to use regular expression to extract integers littered around a text file, what regex do I use?
I tried using
for line in file:
    num = re.search("^([0-9]+)$", line)
 
@d4rk4ng31 pythex.org is a good resource to try & test your regex on the fly
 
But it somehow doesn't work, as in num remains None
Hmmm.. lemme try. Thanks :)
 
@d4rk4ng31 That will only get you digits-only line (e.g. "42", but not ",42 ")
 
can you please provide a sample of the file?
 
Yeah, that's what I want..
 
9:26 AM
the regex you have shown is for a line including nothing but digits
 
Umm...no the file is hidden from the users (as in us)... Stupid college
However, all they have said is...
 
but you must have a specification on what you need to do, no?
 
@d4rk4ng31 You have to do num.group(0) if you're using re.search
 
also, you are reading the file, so you must have access to it
 
The file contains a normal, like entirely normal text (they hinted at a chapter from a storybook), with integers scattered around
 
9:29 AM
So lines such as "Slay thee 5 trolls", or "Slay thee", "5", "trolls"?
 
@MisterMiyagi Only the code has read access, as in the code is to be submitted online...
 
@MisterMiyagi There you go... perfect
 
hello guys , I need some help understanding a piece of code
 
because your regex says ^ (start of string) and $ end of string, your regex will refuse to match things that contain any string which has non digits.
i personally highly recommend using regex101.com
 
9:32 AM
ordinal = lambda n: "%d%s" % (n,"tsnrhtdd"[(n/10%10!=1)*(n%10<4)*n%10::4])
how do this works ?
 
sigh, ugly code.
this looks like something only good for golfing
 
@shad0w_wa1k3r Thanks
@ParitoshSingh Umm.. then how do I skip to the first digit?
 
@ParitoshSingh Yes , it is : here
 
@d4rk4ng31 The question is what you need to match. Likely, you need to skip any characters and just match the remaining digits.
 
@d4rk4ng31 you dont, you only tell it what to match. the regex itself is doing the searching and skipping for you. the pattern in regex is to denote what you want to match
 
9:34 AM
Still can you explain ?
 
@AdvilSell can you clarify what parts of it you understand?
 
Well, in its entirety, the assignment is to make a list of all those numbers...
 
aye, and you'll probably want to use re.findall for that then
but as your first step, your goal should be to get it to match one output correctly. do this, go to regex101.com or the other link shadow shared. pythex.org
write a dummy sentence there, such as the one miyagi showed
and get a regex that matches what you want as your first step
 
@MisterMiyagi why is there a '::' there instead of ':' to splice the string ?
 
start:end:step_size
 
9:37 AM
@AdvilSell 1st week in python man.. sorry
 
@ParitoshSingh ah , yes
 
Available Packages
Name        : python
Arch        : i686
Version     : 2.6.6
Foo...
 
@AdvilSell slice, not splice
 
@AndrasDeak yeah , sorry !!
 
@AdvilSell there are so many things wrong with that. Forget about it
 
9:40 AM
@AndrasDeak why ? can you please tell
 
Code golf is not meant to be used for any real problem.
it's terrible as a coding style
You can follow the codegolf link to see if there's an explanation, or ask the author of the code golf code
Similar with an explanation codegolf.stackexchange.com/a/74047/45297
 
@d4rk4ng31 you're fine! we all start somewhere. :)
the reason i'd suggest those sites is because they give helpful suggestions that explain what the regex is doing, which will help you learn on your own a lot better than if we were to just give you the solution.
 
@AndrasDeak Got it , thanks !! :-)
 
Yeah, I saw that.. The popup is really helping.. Thanks a lot man :)
Umm.. just help me out here...
`^[a-zA-Z0-9]$`
This regex will just get me the first character or digit from the line right?
Cause the site is not showing a single match😅
 
@d4rk4ng31 Do you know what ^ and $ mean in regex?
 
9:50 AM
Start and end of line right?
 
Yep. Now think about this: Is the first word of a line adjacent to the line start and line end?
 
Ah.... right.....
Got it! Yay ..... ([0-9]+)
That site really helped me
Thanks a lot guys :D
 
Real regex expertise is knowing when to use it (i.e. almost never)
4
 
10:06 AM
Well, guys, my submission got accepted, and a pop-up appeared with an equivalent solution which I can't make the head or tail of..
print( sum( [ ****** *** * in **********('[0-9]+',**************************.read()) ] ) )
What the heck is that?
Got it... Yay!!😅😃😃😃
 
the stars make it impossible to make sense of what's going on
 
+1
 
for us in any case
 
But my classmates pinged me the corrected version..
Its a basic list comprehension
 
i take it its not stars in the corrected version :)
 
10:14 AM
print( sum( [ num_list for num in re.findall('[0-9]+',<filename>.read()) ] ) )
 
i'd call that a bad solution
 
Wait, I missed something
 
dont leave your file handlers open, and definitely dont do everything in one line. If you've written something that uses with to open the file, and is better spaced out, your solution is better.
 
Oh. Okay
 
there is no beauty in cramping things in one line, the goal should be to write code thats easy to understand
unless you're code golfing. at that point, all bets are off. :P
 
10:17 AM
XD :P
 
10:28 AM
And if you're going to reuse the same pattern it's better to compile it
 
10:49 AM
Hi guys, I will try to reproduce the issue somehow, which I'm guessing will be necessary for a bug report (and will aid in understanding the problem anyway). Is there any way to reproduce and recompile old code that was rendered? Alike some sort of "history" functionality?
 
Your spyder's ipython shell should have a history. The built-in REPL has limited functionality along these lines, but if uparrows work in your REPL then the history is there. You can do a reverse-search with ctrl-r at least on linux.
 
If you're in IPython you can use %save file_name ~0/ to save your current history to file_name, ~1 for the previous session.
 
Thx guys I'll get it on it
 
11:29 AM
how do i post multiple json objects in flask
 
I was trying to run a Python tkinter application on android using Pydroid 3. I want to know the reason that why the GUI gets distorted? Not all widgets get small nor big. Some get big while some get small why?
Is there any way to remove this distortion?
 
what's tkinter
 
(Please don't suggest to use Kiwi)
 
@greatisgreat google it
@Abhijeet.py you should probably ask the pydroid people. Look at their issues etc.
 
@Andras Deak Is there any other way to run Python on android?
 
11:34 AM
i do not suggest kiwi i suggest you make use of retrofit and use flask or django for making a rest api with python
 
I wouldn't know
 
@greatisgreat I don't want to be so complicated when my program is simple and I have a default Library.
 
then i dont think there are any other options
 
@greatisgreat Tkinter is the option itself, I just have to rewrite the code for the GUI to fit the screen of the android. But, that proves to be a bulky task.
 
@AndrasDeak i think you should do what Andras suggested
 
11:41 AM
I was unable to find any way suitable for python.
Ok, one other question - How can I create an app shortcut for my app on the android?
 
@Abhijeet.py Kiwi? Do you mean Kivy
 
@Peilonrayz I may like Kiwi in future but, I just want to run tkinter on android this very moment.
Yes, the same Kiwi/Kivi
 
@Abhijeet.py this is the python room.
 
I don't understand why there is no official way to run the python programs on android? Why third party tools like pydroid and qpython?!!
 
@Abhijeet.py what is even "official"? The only "official" thing is CPython.
If you have android problems ask in the android room.
 
11:48 AM
@AndrasDeak Yes, I am referring to the CPython>
 
if you can find a way to compile C code on android, you can go crazy with cpython on your device, I'm sure
 
Ok! I got your point.
I think I am making wrong questions here? Sorry, but it was not intentionally.
 
@Abhijeet.py yes
9 mins ago, by Abhijeet.py
Ok, one other question - How can I create an app shortcut for my app on the android?
^ not a python problem
 
Oh! I forgot to write "python program" in that text.
 
lol
 
11:52 AM
What is this IoI
 
@Abhijeet.py Irrelevant.
@Abhijeet.py not IoI, but LOL. Short for "laughing out loud", an old internet abbreviation.
it's like when you kids say "yeet", just better
 
Ok!
 
Oh, this keeps getting better and better I'm gonna rofl xD
Sadly there is no good way to write android apps using python @Abhijeet.py many have tried, but the tools and compilers/transiplers etc have gone outdated and unsupported
 
Doesn't Android ship with a JVM? Seems like a job for Jython!
 
Is there any way that I trigger them to start (i.e. my python program on pydroid) using a small C++ program ?
 
12:01 PM
@Abhijeet.py are you asking how to start a program in android?
 
@AndrasDeak Yes, but more specifically a python program? Please understand its not an android's but python's question.
 
If you want to start the Instagram app on android, does it become an Instagram question?
 
@AndrasDeak Have you considered to publish your collected wisdom of moderation someday? There's some deep pondering to be done between all the paddling.
 
Once upon a time, I dreamt I was a butterfly, now I do not know whether I am a butterfly, dreaming I am a man.
 
Ok! I will not ask any question from now involving the word 'a-n-d-r-o-i-d'
 
12:06 PM
xD
writing these two letter gives me much more pleasure than it should xD
 
@Abhijeet.py some of it can be on topic, which is why I didn't tell you to stop when you started asking. But yeah, at with this problem there's no point continuing here.
 
@Hakaishin xD
 
@MisterMiyagi does the boot hitting someone's buttocks make a sound when there's nobody else to hear it?
 
The answer is not 42, is it?
After careful pondering on my buttocks, I'm very positive that boot is gonna be painful even when there is nobody else to hear it.
Hm. My toy compiler/interpreter has just grown a function evaluation.eval_evaluate(..., :Evaluate). Not sure if that is a good or bad sign...
 
I heard you like to eval so we put an eval in your eval so you can eval while you eval
 
12:17 PM
Remember to tell me "I told you so" in a few weeks. There is a TODO for making it self-hosting, so evaluation.eval_evaluate(..., :Evaluate) might eval evaluation.eval_evaluate(..., :Evaluate) might eval evaluation.eval_evaluate(..., :Evaluate)...
 
SOK
Hi guys. Im using Pycharm and i have imported a query for analysis from a SQL database. Is there anyway i can setup my code to "save" the data from the sql rather than running it everytime i make adjustmentsto the code? it takes about 4-5mins each time i re-run the code. I am trying to get the debugging setup but can you set it up to achieve this?
 
have you considered to pickle.dump the data after querying it, and trying to pickle.load before doing the query?
 
SOK
I havent heard of that so I will have to look into it!
 
Hi
How do I download file from google drive using credentials?
 
@BlackThunder Did you try the google drive Python API?
 
12:30 PM
Saw it but can't understand how to download file after applyng the credentials
I have the both google drive link and credentials
 
SOK
i just realsied you can jump back to cursor which could solve my problem
 
needs more focus (multiple subquestions) stackoverflow.com/questions/61913125/…
 
12:50 PM
I hate it when I find a good solution of something I did myself. I wrote small parts of configargparser just to now discover it :(
 
1:12 PM
Guys I am writing a program that collects requests. So the user in puts a start time and and end time(eg: 9:00 -1:00). And if there are no other requests within that time then that request is accepted. Otherwise we have to print that currently that slot isn't available. So how to implement this. Any idea guys
 
@MisterMiyagi This doesn't seem so bad to me - a new user is confused about an object being callable. The subquestions pop up during the discussion in the comments, but to me the main question reads pretty clearly.
 
Does somebody know, is there a way so pycharm can see my parser args which I added with .add_argument() when using autocomplete?
 
@ManuEThomas I don't know if you will get much in the way of "how to implement this." But when you check a new request, you will have to look for any overlapping request, not just ones that fall inside that time window.
 
@PaulMcG Yea. But how to implement this. any idea?. Seems so complex
 
Google for "python find overlapping time ranges". But if this is too complex for you, why did you choose to write such a program?
@Hakaishin Argparse returns your parsed args as a namespace. I've seen PyCharm do some neat intuiting of dict keys, but not the mapping of keys to "attributes" as is done in a namespace object.
 
1:28 PM
àhm. Meaning?
 
TL;DR no
 
haha, dammit
@AndrasDeak What are some of your favorite SFW expletives? Just poped into my mind when writing dammit and hoping it's ok
 
salad language offers "yam" and "tomato"
 
Neat
Is there an easy way to hand pick specific files to be included into a whl? some line like file=[a.py, c.py] which I could put into my setup.py?
uh find_packages has exclude, perfect :)
hmm, somehow the exclude does nothing for me
ah, exclude only excludes packages not files. Nvm guys, just talking to myself, akwardly moves into corner
 
1:57 PM
@PaulMcG I admit to being an old, pessimistic fart on such questions. Been bitten too many times when more and more questions started popping up with every attempt to answer.
 
2:07 PM
grrrrr, my arch nemesis CACHING
I had the setup syntax right, but didn't realize it used a cached version of setup.py
 
@SOK you'd only be able to iterate the cursor once so it's unlikely that it will be repeatable for you
 
It's a perfectly valid problem, but there's something funny to me about "after I fetch data from my database, I'd like to store it for later in some kind of base for data"
 
man I'm so confused. When I build my whl I see 2 packages which get included and the other one which I excluded doesn't get included. Now in Pycharm I uninstalled my package installed this new one. But somehow the ignored packaged is still there, how can that be?
is there a way to introspect a whl?
 
5 minutes is a long time but I'm wondering if the old hadoop cluster I worked with is the equivalent of being born with a silver spoon in my mouth. I imagine there's a lot of data processing going on in the query
 
Preferably a gui winrar style where I can just open the whl and see what's inside :P
 
2:20 PM
aren't wheels just zip files?
 
@Hakaishin borderline. As Paul said I suggest "yam"
 
A page on my work project can take five minutes to process if the user picks all the most computationally expensive options
 
ah, so glad I figured it out. When you remove a package from a wheel and the install it on top of the old one and then uninstall it, the excluded package wont be listed in the top_level.txt and so it wont get uninstall and still linger around
 
@Hakaishin Are you compiling code? If not build a source distribution not a build distribution.
 
well it's complicated. I was compiling this code for another project which needed it in compiled form. But the current project doesn't need it it compiled form, but I got that so it's handy. But pywintypes is not installed so I had to exclude a part of that when building the whl. Probably I am doing this all wrong, but it works so welp :P
man I'm not sure if I'm overengineering stuff and I should just revert the last 1.5h back and just use the code in my file or if should keep going down this rabithole
 
2:45 PM
^^ I go through this about 1/week (maybe 1 every other week)
 
3:14 PM
I am rethinking my whole love affair with generators. Writing a method that returns a generator of 3 items seems a waste when I could just return a list of the same. Especially when I look at calling code that has to jump through next() or list() hoops just to get the first item. Especially when generators silently yield nothing when you accidentally try to iterate over them a second time.
 
yay! I was finally able to JIT compile a := 3:2 and a * 2! scuffles back to his garage
 
What language?
 
^. I don't know what that statement means but I'm intrigued
 
I think he hacked a parser that understands : as division (or Decimal creation?) and 2! as factorial
The birth of MPython. In the best spirit of gunshowcomic.com/513
Not sure how JIT comes into the picture though... MPyPy?
 
Let's call it constant folding at runtime.
It's not screaming anymore, since I decided to base the syntax on my limited grasp of PyParsing instead of the other way around.
 
3:26 PM
All the hallmarks of Silence of the Lambs. Thus, MPyPy is born
 
good job, anyway
 
Speaking of which, I've updated plusminus to address the DoS bits involving deeply indirected and recursive formula expressions from last time, and added more set notation support. Not yet released, but I dropped the current code in the online evaluator.
See CHANGES notes for 0.3.0.
@MisterMiyagi If this work is in a repo somewhere, I'd be happy to look at it and give notes.
 
@PaulMcG There's something wrong with the way formulas are outputted; I defined b @= a + a and the output of vars shows it as 'b': "(a'+'a)"
 
Well, that's not wrong exactly, ugly might be a better word.
 
And it seems you can still DoS the calculator by creating a cycle between 3 variables: a @= b, b @= c, c @= a throws a RecursionError
 
3:41 PM
@PaulMcG I've found generators to react badly if you don't commit to them. Either it's generators almost all the way down or not.
@PaulMcG I still have to do some cleanup. Will ping when done.
 
@Aran-Fey Hmmm,... I was pretty sure I had trapped on the recursion issue. Is it actually a RecursionError, or do you get a message like Exception: illegal recursion? If the latter, that is okay, that means my code detected it and avoided it.
 
What an odd job advert. I don't think I've seen anything so vague
 
@Abhijeet.py Because Android is written in Java (there's also no "official" way of running C++ or C# or Rust or ....). However, my 4 ways currently include: Kivy (this might be what you meant - only good way for Jupyter notebooks) which I think you said you didn't want (not sure what Kiwi is) & BeeWare which I use with some student projects, is probably what you want, & just got a big grant
To be fair: 80% of the time I either write a Java Wrapper that calls Python or start using a webservice for the UI with Python on the backend. Note, I've never found that QPython is that great but can say it works & never used PyDroid at all.
 
@roganjosh Who cares? I'm in!!!
 
@PaulMcG Please can we get early disclosure on the nature of Dark Matter when you find it?
 
3:51 PM
Only after I call my broker
 
@PaulMcG Looked like a real python recursion error to me
 
Ok, I'll check it
 
@PaulMcG always a catch :/
 
....and when I have to use anything but the webserver or Java wrapper (literally the Java app is now the thing making the calls to a server): I charge more because its a nightmare (C# and Xamarin always ends up worse mind you....it shouldn't but it does)
 
@Aran-Fey You are correct, sir. Compare with a @= a + 1, that is a recursion that I catch.
Also, this is caught: a @= b + b; b @= c + c; c @= a + a. But not your simpler version.....
 
wim
4:03 PM
@MisterMiyagi Hmm, I couldn't get it working repl.it/@wimglenn/ImpureAccomplishedHexagons still blocked even with the wrapper.
 
Not sure if someone has mentioned this already, but for some reason the buttons only work on the 2nd click. The first time I click, all that happens is that all the buttons in that "group" shrink. Clicking one of the shrunk buttons then works as expected
actually it's not even the whole group, only the buttons in that row and the row above
 
Yesterday I fixed a bunch of legacy Python 2 codebase to work on a modern system. Earlier I changed Cobol to Java: why does 2 days of writing MS Word proposals seem like the worst job ever? ;P
 
@wim Was afraid of that. Found a ticket that mentioned something similar. Give me a moment to try something...
Ugh, scratch that.
So, in principle what should work is that the stdin I/O happens in a task completely separate from your cancellable code. The two communicate with an Event/Queue. Problem is that your stdin task has to be spawned at the root of your application, since everything in its nursery becomes uncancellable.
 
4:21 PM
@Aran-Fey In plusminus? I'm not seeing that at all (using Chrome). Retrying using MS Edge... even Edge works ok
 
Yes, I probably should've pinged you there, sorry. I'm using firefox
 
Not seeing this in Firefox either.
On desktop? Phone?
 
Laptop. My OS is Manjaro
 
Hmmm, I don't have a Linux desktop handy, I'll try FF on MacOS - also not seeing button-shrinking...
 
The only other browser I have installed is Brave; it works correctly there
 
4:27 PM
Huh repo'd on Arch. When I open the developer settings it resolved the issue instantly - until I refresh the page
 
Is there a dev console to see what's happening?
 
These are the most vanilla buttons you can get, just plain ol' HTML with a JS onclick method attached.
 
There isn't even any CSS, is there?
 
Someday I'll be able to spell CSS, but this day is not that day
 
@Aran-Fey What's the exact link, please?
 
Thanks :)
 
oh, one of my browser extensions is at fault
 
@wim This approach works for having a timeout on the "press x to not die" logic, but the process will live on until input is provided.
 
all the extension does is change some colors (automagically creates a dark theme), so no clue how it has any effect on the buttons' sizes
 
Ah, seems like a bug with Dark Reader for me
 
4:37 PM
I am actually curious about <input type="hidden" name="k" value="95gbkvjk2wrj">, though. Is that a CSRF token?
 
Its just a hacky way I can have multiple people use the same web server, and keep track of their own defined vars without stepping on others.
 
Ah, fair enough :)
 
All just in an in-memory dict, all gets flushed whenever I restart the webserver.
 
wim
@PaulMcG why would you use a generator just for 3 items? tuple or list seems much better choice (indexable, reversable, length, membership check...)
 
4:56 PM
Oh for a while I was on a use-generators-everywhere kick. Going back and reviewing code from last 4 years on the current job with a critical eye.
 
wim
I see
 
You always find the worst coder ever when you have to review your own code
 
wim
there is a relatively large overhead from setting up the generator, so outside of "streaming pipeline" use cases I generally would prefer lists unless it's really warranted for memory reasons
 
I remember a very good paper written on the subject of generator usage, wonder if I still have it (was on C# mind you but also written by Jon Skeet and there are similar considerations)
 
wim
@MisterMiyagi hmm, that does seem to kinda work, it left my terminal in a sort of messed up state though.
and the the code looks pretty gnarly, I don't quite understand all the setup. maybe the thread-and-kill solution is the best way after all 😒
it's rare for something so conceptually simple to be so difficult to implement in Python
if trio is using a worker thread behind the scenes anyway, then you are gonna get all the same baggage regardless
 
5:20 PM
Yes, the entire non-socket I/O thingy is borked in the async world.
It's the big fat elephant in the async living room, doing the dubstep dance. And it just waltzed right over your code.
 
wim
I wonder if anyone has ever tried to get a PR in for adding a timeout kwarg to builtin input.
seems "on brand" for Python and an obvious/useful enough feature to have in stdlib
 
@wim file a bug report
maybe chat on python-ideas first
 
wim
there is even a stdlib TimeoutError which input could raise
 
what's the concurrency implementation?
 
wim
5:36 PM
I don't understand the question
 
threading?
Anytime I've ever considered timeouting anything there's some way of doing concurrency... required by the solution...
 
May require the addition of async input to the language.
^^ snark
 
5:53 PM
Meh, I'd be happy with cancelable Threads. CPython can do it anyways, would be a useful feature to have officially.
That would even solve the problem for async, since they use Threads for these things as well.
 
6:21 PM
Any suggestions for syntax to clear the definition of a variable in plusminus? I want to avoid using a keyword, like Python's "del x". Right now I using an assignment with no right hand side: x = But not super happy with it.
 
hmm
x<-- :D
 
Unicode operators are fair game, though an ASCII synonym would probably be required for it to be useful. (But unicode-only suggestions might suggest a good all-ASCII synonym.)
 
💥x
 
How about modifiers? x
 
plusminus actually already defined '<-' as a valid synonym for '=', since it suggests that you are actually storing a value into a variable, vs. asserting equality
Is that x in a greyscale?
 
6:26 PM
no, I'm just struggling
'\N{combining short stroke overlay}x'
the problem is that if I evaluate that the repr gets messed up so if I copy it here I'll get the overlay on the single quotes :D
 
@PaulMcG how about some "undef" value? x = undef
What could possibly go wrong, eh?
 
>>> '\N{combining short stroke overlay}x'
'̵x'

>>> print('\N{combining short stroke overlay}x')
x
the latter is an actual x
I'm certain it wouldn't be a nightmare to implement
 
Well if I pick a keyword, then that precludes its use as a variable name. The only reserved words for now are "in and or not True False mod", plus any function names a parser dev might choose to add (and those aren't really reserved so much as just pre-defined, and could be overridden).
 
The result of \u0338x leaves to be desired. :/
x\u0336 it is!
 
what's plusminus? (a language or are we talking just standard deviation or tolerance or any of those other definitions of ±)
 
6:38 PM
plusminus is a pip-installable lib I am writing (using pyparsing) as a safe replacement for eval(). But it has morphed into more of a symbolic algebra thing, going beyond just Pythonish arithmetic expressions, to include unicode operators and variables
 
ahh...that sounds fun ;)
 
There is a live demo at ptmcg.pythonanywhere.com/plusminus , which various folks here have been doing some hacking at to help me find holes in my defenses.
 
unicode:  x, ascii: \x7f x
 
It also allows you to add your own operators and builtin functions. The examples include a dice roller, permutations syntax, financial operations, and date expressions.
 
on that note: I stole that unicode character because its what Wolfram uses as a plus or minus operator
....I stole it a long time ago for writing stuff in LaTex but still could apply here
 
6:42 PM
I thought about supporting something like upper, lower = 10 ± 2
 
Cabbage. I see that tabs vs spaces question has 2 reopen votes. Oh well.
@LinkBerest-GoodbyeSE But LaTeX has \pm for ±
 
I connected it with a Perl Interpreter which I hacked into one of my LaTex programs. It was a while ago and nobody had told me about IPython at the time....and it was really, really bad code
 
@PM2Ring it's held that for ~20hours so we might get lucky and have them age away
 
It would let me run something like perl make_documentation.pl random_program.java or .cobol or .pl documentation_for_program.tex and auto create some documentation (super useful at the time because I couldn't get any support & had to make a ton of documentation for a company but horrible, horrible band-aid solution to that problem)
 
But it gets really complicated if ± is used more than once in the expression. 2 ± 3 ± 10 yields 4 values.
 
6:53 PM
mathematically speaking 2 \pm 3 \pm 10 should be 2 values: 15 and -11
 
What about -5 and 9?
 
that's if it were 2 \pm 3 \mp 10
 
@PaulMcG that ^
the only sane way to make sense of +- is to assume that it's either always the top or always the bottom value
so you'll get things like (a +- b) (c +- d) = ac +- ad +- bc + bd
 
Am I the only one who interprets 10 ± 2 as a gaussian?
 
I'll add it to the "maybe next release" list. Right now I can do multiple assignments, to support short cuts like a,b = 1, 3. But you need the same number of expressions on LHS and RHS. There is at least one stdlib method I can think of divmod that returns a pair of values.
 
6:58 PM
@MisterMiyagi yes
 
Now I feel lonely. :(
 
without a sigma count we can't talk
 
00:00 - 19:0019:00 - 00:00

« first day (3504 days earlier)      last day (1458 days later) »