« first day (3656 days earlier)      last day (1513 days later) » 

01:59
Trying to get Python and lua to talk to one another with sockets -- the lua client can talk to the lua server, and the Python client can talk to the Python server, but that's it. I'm going to blame... IPV6.
02:19
for connection in socket.getaddrinfo(*args):
    #just get the first one, it probably doesn't matter which it is
    break
s = socket.socket(*connection[:3])
I think I figured out why half my connections are falling into a black hole
 
5 hours later…
07:13
cbg, I want to have a user configurable variable in my code that will be accessible in all my scripts for a project, is there a better alternative than setting env variables?
@roganjosh Thanks I just changed my approach and simplified it
this variable's only purpose is to act like an optional parameter for a set of functions, these functions will do some logic based on the value set
Both seem to get the folder variable properly but i'm wondering why the {folder} in the code is highlighted in red?
I wouldnt count much on the syntax highlighter tbh
wild guess is it thinks \{ as being escaped
my editor also shows "color of syntax error" for the first one, but it works fine
I don't understand so much how it works but when I do something like f'{directory_main}\' i'll get EOL while scanning string literal error
But 'f{directory_main}\blah' works fine
I guess i'll read on strings again find escape characters confusing
07:36
Could I ask a question about python fixture scopes?
pytest
What is the difference between scope function and session?
function: the default scope, the fixture is destroyed at the end of the test.
session: the fixture is destroyed at the end of the test session.
08:10
@whatsnext do you know what scope is, in general?
as in, the scope of a variables? For example, in nested functions?
09:51
I am getting this error for the very first time and I do not know what it is about: `AttributeError: 'str' object has no attribute '_sa_instance_state'`

I want to display user posts in a flask app with SQLite as my db
@GitauHarrison read the traceback to see where there's something._sa_instance_state and see why something is a string when it shouldn't be
This is my app set up dpaste.com/CF7YLX27P
@GitauHarrison good for you
The apparently comes from post = Post(body = form.comment.data, author = user.username)
@AndrasDeak Any idea what I am missing, or why str is the problem? I thought that when I add user and post to the db then I can query the db and retrieve a user's post
Well, I know nothing about SQLAlchemy, but my first google result tells me that you should be passing in a User object as author instead of a string
10:00
@GitauHarrison unfortunately I don't know the tech involved, and I don't know how important the ten stacks are between the code you showed and the actual library code that raises that error. I know that strings don't have a ._sa_instance_state attribute, so the error is correct. You are probably passing something with the wrong type, or not using some kind of switch that tells the library that you're passing a string, or something like that.
@python_learner Thanks a lot it helped a lot
@python_learner When an 'r' or 'R' prefix is present, a character following a backslash is included in the string without change, and all backslashes are left in the string
I always thought the backslash was treated as part of the string
That is right. Thing is `author` is a `str` object. Maybe that is where the problem is? I mean I have these two lines:
`user = User(username = form.username.data, email = form.email.data)` and `post = Post(body = form.comment.data, author = user.username)`.... and `author` directly gets data from the `user`
directory_new = f'C:\Users\115313612\Google Drive\Test\Financials\Test Accounting\Test Transactions Excel Files' gives a SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape error though
you need an r string for that I guess
If I do a double backslash on the first backslash directory_new = f'C:\\Users\115313612\Google Drive\Test\Financials\Test Accounting\Test Transactions Excel Files'
It will work with the output being all double backslashes
So there must be something about the f-string
10:14
hey guys i am banned from asking questions on stackoverflow so, i am asking it here
, i am getting an error when i run this code:

import ftplib
session = ftplib.FTP('ftpupload.net','username','password')
file = open('hello.jpg','rb') # file to send
session.storbinary('STOR hello.jpg', file) # send the file
file.close() # close file and FTP
session.quit()

the error is :
ftplib.error_perm: 553 Can't open that file: Permission denied
my general thought process is to always use rstrings for windows paths
Output will be: C:\\Users\\115313612\\Google Drive\\Test\\Financials\\Test Accounting\\Test Transactions Excel Files which is correct
@python_learner Yeah still interesting though will check it out
@Pherdindy rf''. Umpteenth duplicate.
@Praveen - you probably are using FTP username and password that are either invalid, or are readonly creds. (And I assume that you are not sending them as 'username', 'password' but as username, password)
What python_learner has been telling you
10:17
@Pherdindy It is in principle sufficient to only escape all \ that form an escape sequence. In a regular string literal \U indicates the start of a unicode escape sequence, so fixing the first directory is fine. However, raw string literals are much more robust for windows.
And no need for f if you have a simple string literal
@PaulMcG no dude i use the real password and username, i just changed it to ask this question
Ok, just checking
@Praveen do you actually have permission for that file?
10:19
@Praveen does the file exist in cwd?
i mean its just a file in my pc a jpg file
"hello.jpg "
@Praveen please post the full traceback then, or at least indicate which line triggers the error.
ok i will wait
Traceback (most recent call last):
File "C:\Users\Praveen\Desktop\ftp.py", line 4, in <module>
session.storbinary('STOR hellp.jpg', file) # send the file
File "C:\Users\Praveen\AppData\Local\Programs\Python\Python36\lib\ftplib.py", line 504, in storbinary
with self.transfercmd(cmd, rest) as conn:
File "C:\Users\Praveen\AppData\Local\Programs\Python\Python36\lib\ftplib.py", line 399, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
File "C:\Users\Praveen\AppData\Local\Programs\Python\Python36\lib\ftplib.py", line 365, in ntransfercmd
hellp.jpg?
sorry its hello.jpg
i edited it
10:21
The error is coming back from ftplib, so it is most likely permission in the FTP part, not on the open
ok so what can i do? is there any alternative?
Credentials. (username/password)
creds?
credentials.
I see that makes sense what I thought was that I could just go with an f-string instead of r-strings since I thought that it would function the same except that f-string could handle expressions
10:23
as in "street cred[entials]"
@Pherdindy hint: you can have both
@Pherdindy f-strings are f-strings. r-strings are r-strings. fr-strings are both f-strings and r-strings.
Roses are red.
violence is blue
someone has already told all of this to you chat.stackoverflow.com/transcript/message/50723847#50723847
Ohhh I didn't get that at first was still googling it lol
Didn't know you could combine rf :/
i use the real username and paswword
10:31
What we are saying is that, on the FTP server you are accessing, the username/password you are using does not appear to have write privileges, or at least not write privileges in the current working directory (on the FTP side). So you may have to do a CWD FTP command to change to an FTP dir where you do have write access.
ohhh i get it now its in read only mode i guess hmm...
@AndrasDeak Much appreciated! I have been able to fix it. Instead of post = Post(body = form.comment.data, author = user.username) rather I should have referenced the author who is a backref in the User table. So, this fixed it: post = Post(body = form.comment.data, author = user)
If it were a local permissions issue, you would not have gotten past the open statement.
Sometimes, FTP servers are set up with an "incoming" directory that users can write to. Try doing a session.voidcmd("CWD incoming") command before calling storbinary. (pretty sure that's the command, I haven't used ftplib for a while)
Oh wait, there is just session.cwd("incoming")
You can also try session.dir() to see if you can at least list the contents of the FTP server directory.
10:39
ok i will try tht
ok so there are alot of files they are:

drwxr-xr-x 3 0 0 4096 Oct 19 05:39 .
drwxr-xr-x 3 0 0 4096 Oct 19 05:39 ..
-r--r--r-- 1 0 0 690 Oct 19 05:39 .htaccess
-rw-r--r-- 1 0 2 0 Oct 19 05:39 .override
-rw-r--r-- 1 0 2 0 Oct 19 05:39 DO NOT UPLOAD FILES HERE
drwxr-xr-x 2 99 99 4096 Oct 19 06:12 htdocs
I think the "DO NOT UPLOAD FILES HERE" file is interesting
its empty lol
so we can ignore it
(I'm joking)
lol
it worked the thing is i had to mention /htdocs/hello.jpg
From the timestamp, it looks like it was created recently, perhaps in response to someone trying to upload files to this directory.
10:43
session.storbinary('STOR /htdocs/hello.jpg', file)
Or precede your call with session.cwd("htdocs")
Ok, I'm leaving for a bit - good luck
So i'm guessing jupyter notebook is just giving me a false positive on the f string
\{folder_old} is highlighted in red when it shouldn't
@Pherdindy why not? You escaped the leading brace, so it's not a field in the f-string
11:12
It is though, backslashes don't escape braces
escaping is done by {{doubling}}
oh crap, you're right, sorry
>>> f'{42}\{42}'
'42\\42'
This is a case that was supposed to raise an error, right? Misplaced backslash.
Confused the hell out of me at first
Yeah it does the backslash and the 2nd {42} has a red color to it
so you're right, it's a bug
I didn't write that highlighter, I promise
Lol I just wanted to concatenate 2 strings together
please someone answer this thread here stackoverflow.com/questions/45272716/…
11:21
@lone_coder ah, the elusive denvercoder. Good luck!
@Pherdindy so use the string concatenation operator
Ended up looking around for an explanation for an hour but good to know
i could live reading the stdout from ping but not from executable
and if you want to concatenate paths, consider using os.path.join or pathlib
i could read stdout from executables but not lively. like its only capture at the end of the program. i tried to use readyReadStandardOutput and connect it to slot. still wont work. my question already asked on stack but none answer them
@lone_coder if the question is "why don't I get output from <someapp> but from <otherapp>", the answer very, very likely depends on knowing the rough workings of <someapp>.
Rough guess: <someapp> detects its output connection and adjusts its buffer accordingly.
11:27
yeah. i've also had the same idea. maybe there's some method to output this <someapp> properly. but all I could find is print() method. because <someapp> is a compiled python executables
@AndrasDeak thanks i'll look into those barely touched the os library docs lol
i tried to use sys.stdout into console and it did the same. printing out only when the program is done
@lone_coder can you modify <someapp>?
yes i can
A) Try flushing sys.stdout, i.e. sys.stdout.flush() after writing. B) Provide an MCVE <someapp>.
11:30
ok. will try
@MisterMiyagi OMG. it works!. thankyou master. arigatou~
i think i should re apply to computer science major again
12:05
wow, today is one of those days. Nvargus-daemon crashes constantly. Looking up how to read the crash log I find: askubuntu.com/questions/434431/… And now the apport-unpack crashed while trying to read the nvargus-damon crash. Hopefully it doesn't crash while reading it's own crash log.
Nope, it crashes trying to read it's own crash log. Ugh what useless software
hello, I need a little help with statistical analysis of time series data. I need to compare different resampling strategies, which I do with pandas. To compare I subtract the resampled data from the original data. The aim is abviously to get that difference as low as possible, but what metric is best for that?
I think variance is pretty close to what I want, only that it would use the mean instead of my target 0. Is there a name for something like differences_timeseries.pow(2).sum() / num_entries?
are you looking for chi-square tests, perhaps?
@YPOC second power summed over num_entries is not a nice metric because [a, a] gives you a^2. If you add an sqrt outside the sum you get the quadratic mean (a.k.a. root mean squared)
12:22
@MisterMiyagi The Chi-Square Test is quite close to what I want, but problem is that it divides by the expected value, which in my case is 0. But I think I found a few terms that will help me googling. Thanks!
Hmmm does anybody know how it can be that threading.activeCount() shows me 2 threads, but my traceback in gdb has around 30-40 New LWP, which I read as Light weight process = thread?
Actually, I guess what you wrote is the second moment, so scratch that
@Hakaishin well, are you reading it correctly?
@AndrasDeak Yes, the second moment lloks pretty much like what I have in my code
I just still had a recent mean-specific discussion in my mind, sorry
I want to to set a try and except /-->try do something if variable exist
is the exception then an AttributeError ?
12:28
@Amundsen why are your variables dynamic?
How are those maybe-existing variables defined?
the easiest way is to check in your interpreter what happens in the exact situation you need
@AndrasDeak I mean how would I know if I am? threading.active_count shows 2 and gdb shows 30-40 lines with [New LWP some_number] which as I read LWP is the term for thread in kernel space
you get a NameError when you try accessing a variable that's not defined, but AD has a better line of thinking here.
How can a user in Flask app post several comments without the need of signing or log in? I am trying to have a user post a comment in a flask app several times using the same credentials during subsequent visits but I, get the error SQLAlchemy Integrity error. I have this script that I am working on dpaste.com/G4U37EPUU but cannot figure a way to allow for several same-user commenting
@ParitoshSingh Unless the variable they are looking for is a missing attribute of an object, then would give AttributeError. (Also concur with AD's probing question.)
@AndrasDeak i have a flask view function which returns a server response as an error so I dont know how to replicate into a "normal function"
12:32
@Amundsen I can't really relate that to your original question but I also don't know flask
@Amundsen The technical answer is "NameError". The slightly condescending answer is "don't".
13:27
green eggs and morning cabbages, folks!
 
1 hour later…
14:53
hello i need help i want to track all opened browser tab to see which tab opened by student in exam time in python is this possible in django web app
It's a web app? Of course that's not possible. Imagine if websites could tell which tabs you have open in your browser...
@Aran-Fey so can you advise me which one can i use
You'd have to force your students to use an app written by you instead of their browser.
you could possibly force them to use your VPN and monitor all network traffic that way. But even so, the best you'll be able to do is to figure out that they've made a DNS request for google.com - they may just be googling some music to listen to, while writing the exam. Otherwise, force them to use your browser. But neither technique really stops a student from googling the answer on their phone
if you really want to airgap that too, then you'd have to spoof cellular towers around where the student lives. That would be a CRTC/FCC/equivalent violation depending on where you implement this. You'd also be accidentally forcing people who live near your students onto your fake cell tower which has hilariously bad ramifications (imagine if someone wanted to call 911, but couldn't, because they didn't know that their phone connection wasn't their phone connection)
Hot take: If students can pass an exam by quickly googling the answers on the side, what even is the point of that exam?
15:01
at that point, it might be easier to design an exam with questions that don't have answers online (eg: how would you design a system to <blah>)
@Aran-Fey great minds, bud!
@Aran-Fey the real answer
@MecaTheclau exercise in futility, I'm afraid
15:17
The amount of hoops I've had to jump through to get two programs to talk to one another with sockets... It's no wonder that neophytes try to use files instead
Two demerits to the LuaSocket documentation for having an example of a TCP server and a UDP client, but not a TCP client or a UDP server.
@Aran-Fey hard to google questions are hard to grade
priorities
But presumably there are lecture notes so ctrl-f is enough
I'm tempted to yell at Python's socket docs for not describing what AF_UNSPEC does, but I guess I can't expect them to document every Unix flag.
the docs aren't very receptive to yelling, I find
15:28
OTOH maybe I can expect them to document the one flag they use in their example code
on the other hand, it's not like they care
@Kevin "don't you worry your pretty face about that flag"
i just downloaded pycharm and moved my code from vscode to there. my eyes instantly burning. the fonts are quite hard to read. also the coloring is really bad
Well that flag is why getaddrinfo returned two connection objects instead of one, and it turns out the one that the example code chooses is not the one that the lua client tries to talk to
@lone_coder use an IDE you like
15:39
When it comes to IDEs it's more like "use the one(s) you dislike the least" IMO
3
@AndrasDeak I'm new to programming. is there anything I will miss significantly from using vscode instead of pycharm?
I wouldn't know
Surely any can't-miss feature that one IDE invents will be quickly stolen by every other IDE
It's one big incestuous feature mishmash
@Hakaishin you just read my mind. thanks!
15:45
Conversely, if a feature is not stolen by every other IDE, then surely it must not be a true can't-miss feature
yeah functionality patents are dead, it's all about implementations you gotta keep secret
and yes I know that's not how patents work
Yesterday I read that Commodore went out of business partly because of a troll that held the patent for "using the XOR function on the screen buffer"
Which describes like 25% of the things you can do to a screen buffer
im sure they dont consider themselves a troll
rather clever on their part :P
@ParitoshSingh spoken like a true troll :D
Well they were gunning for a fat licensing fee and instead killed the company they were trying to parasitize, so it wasn't exactly a masterstroke plan
15:55
@Kevin did times change or could something similar still happen?
patent trolling is still a thing I think
AFAIK the specific algorithm in question is not so common in modern true color systems. I'll try to dig up my source so you can decide for yourself
Man after fixing dozens of bugs in the last few weeks I wonder how software ever works. Like the prototype of this software worked well months ago, but I keep fixing bugs and thinking, how the **** could this ever have worked :P
But yeah patent trolling in general is alive and well
*in the US, I suspect
15:58
@lone_coder Hard to imagine that a popular IDE such as this would not support customization of color themes and fonts...
The US is fertile ground for sure
it does have option for color scheme. but vscode is just better on it IMO.
@AshwinPhadke pardon?
@AndrasDeak Good resource to check out : practicepython.org
16:04
how cryptic of you
hehe, don't let those crawlers in on what you say, so put it that way :-p
16:23
That's patently ridiculous
slightly related to patents, but in India someone holds the PS5 trademark even before Sony did, (I read this a week ago, so things might have changed)
I would consider that a troll as well
While looking for the above links I encountered several comments sections that argue that Commodore's demise was a sure thing even before this final nail in the coffin. Other causes include: very bad management, DOOM.
Inevitable DOOM?
If DOOM did not exist it would be necessary to invent it
brb, patenting PS{x} for all integers x > 5
I played the latest DOOM with my 15-year-old on X-Box One the other day. It sure has changed...
16:30
I'm open to ideas for patenting all rational and real PS{x}es as well, if anyone can figure out how to count them
rationals are easy
Hah, I'm patenting PS{x:roman_numeral} for x > 5 first!
Ok, google agrees that rationals are countable. I wonder if there's a closed-form formula to convert them to integers and back...
brb, submitting PEP for integer format notation qualifier in Roman numerals
# Return only common elements from these two lists
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

list_common_elements = [number for number in a for num in b if a==b ]
What I am not taking into consideration here? Is it that I am checking the entire list instead of elements?
16:35
Tip: when you see "common", "disjoint", "in", "not in" or "unique" in a problem statement, think "I'll use sets"
@Kevin there's the traditional math.stackexchange.com/a/773215/303264 proving that rationals are countable
@PaulMcG I do not want to use set.
@AshwinPhadke lol
your list comp is completely wrong
The number line diagonal thing is a classic, surely, but it's a pain using it to find the millionth rational because you have to iterate over a million+ integer pairs and check them all for coprimeness
@Kevin you're going to patent them anyway, right?
@AshwinPhadke 1. a==b is completely wrong, 2. calling two variables number and num are a bad idea
16:38
I need an O(1) approach so I can patent troll at full efficiency
@AndrasDeak how do I improve that statement
@AshwinPhadke by using sets?
@ashwin how do you feel about the "in" operator
@AndrasDeak no other way without sets?
a double loop will probably not give you what you want
@AshwinPhadke there is, and it will be a lot slower and uglier
16:39
@Kevin Aaah, wait lemme try
Since 1 is repeated in A, should it be reported twice as being "common"?
Although, hmm, even if you use in I feel like there's a possibility of duplicates
@PaulMcG without duplicates
It might not turn up in this example because b has no dupes
Whatever you come up with, test it against a = [1,1,2,2,3,3]; b = [1,1,3,3]
And can you share why you don't want to use set?
16:40
@Kevin depends on the problem spec
I'm guessing the desired result is [1,3]
@PaulMcG Well I am learning list comp and don't want to just call sets and claim I understood.
... But without a problem spec, I can only guess :^)
list_common_elements = [number for number in a for number in b if number in a and number in b ]
you can use add two Counter.collections and then do a list comp, that is still a set in a way I guess
16:43
The above statement by me works but prints it 8 times , IDK why
I think it's fine to try some brute force stuff just to see how things might be done in a crude but intuitive way before moving on to other topics. Like iterating over a list with for i in range(len(seq)): before graduating to for obj in seq:.
@python_learner That would add another statement right?
Your latest attempt might be better with this (but you still get dupes - can you see why?):
list_common_elements = [number for number in a + b if number in a and number in b ]
@PaulMcG [1, 1, 2, 3, 5, 8, 13, 1, 2, 3, 5, 8, 13]
Now it gets printed twice but with dupes as you said
read it wrong, sorry
16:46
So number in a+b is just saying sumber in a number in b? TIL
No, for number in a+b is creating a temporary list that is b concatenated with a, and then using all the entries in that.
Actually, if you want common numbers, then you only need to iterate over one list or the other.
So just iterate for number in a ... etc.
@PaulMcG Ah, well but say if I have more lists then this would be a very long list then.
Ultimate brute force proposal: [x for x in itertools.count() if x in a and x in b]
3
Takes only a countably infinite amount of time to complete
stared it for posterity :)
If you want to practice with list comps, I think commonality of 'n' lists is not a good exercise. Perhaps you could try using a list comp to select the odd numbers out of a list of ints. Or to iterate over a list of dict keys and create a list of the corresponding values.
16:50
In my college they asked us to generate patterns, [1,2,4,8,16,....] things like that
I find that I don't often use comprehensions with multiple fors all that much in my serious projects
I don't think they're super essential to having a practical grasp of list comps
the only time I used a multiple for list comp was to flatten a 2d list
then I realized itertools.chain does that
@PaulMcG Thanks for the suggestion.
@AshwinPhadke Consider that part of learning is also to honestly realise which things should not be done with AwesomeThing.
@python_learner My next task is to generate random two lists and find commons
@python_learner My next task is to generate random two lists and find commons
16:53
sneaky message starring cbg, folks
I thought it was not possible to send the same message twice
@MisterMiyagi Yeah once you know most methods to approach you then understand which exactly to use.
@python_learner lol it just appeared
17:06
CBG
17:38
anyone use streamlit? Any ideas how I can dynamically update the choices in a multiselectbox?
basically, if the user selects an option from the multiselect, I want to remove some incompatible options
user reposts copy of his own closed question stackoverflow.com/questions/64430010/…
17:54
^closed
Thank you friend
and my gosh, the help pages are not helpful to explain close reasons... :/
You're right. I think there should be a page where it lists the reasons to close, as we see them as 3,000+ rep users. This page should of course be visible to sub 3,000 rep users
Haha yes XD I was looking for this one to show the user. I guess I'm in a bad spot for making recommendations now
18:01
[Help/on-topic] etc. are even magic links
@AndrasDeak Even knowing what to look for, it took me a second scan to find "too broad, unclear, incomplete or primarily opinion-base". :/
The best page seems to be stackoverflow.com/help/closed-questions, which I guess no-one looks at before their question is closed.
@MisterMiyagi yup
Speaking of opinions: Would you, respected room/6 lurker, on seeing the hypothetical await sorted(async_iter, async_key) expect the sorting to happen concurrently?
hypothetically, if i tried to answer, i'd say that i still dont know what the heck async actually is and continue ignoring it till it becomes a problem. it's day 600 without any incidents so far.
@MisterMiyagi can you sort concurrently?
18:38
@AndrasDeak I cannot, which is why I hope no-one expects it. :P
Though in principle one could do various concurrent-sort schemes, such as doing the iteration and key(item) translation concurrently, and sorting items as they come in.
@MisterMiyagi that kind of binds your hand with insertion sort, right?
^ closed
@AndrasDeak basically yes. give or take some optimisations.
I figured you can bisect the insertion point which would probably make it n log n
But that might already be implied by insertion sort. I never did CS.
18:52
The bisect module makes this pretty painless.
That won't help me divine CS jargon :)
19:04
Yes, I left out the entrails-of-a-goat part (for brevity)
unfortunately I've run out of goats...
@MisterMiyagi - if you are going to await, wouldn't you need something like an async_sorted so that it is awaitable? Then I would definitely presume that the sorting is done as results come back from the async_iter, ordered by await async_key(returned_object). (Did I get all that right? I'm still jabbing about in async-ronicity.)
that's how I read his question; no way that builtin sorted would do async too
@PaulMcG That's basically the gist. The devil is in the details of concurrency, though. Consider that async_iter advances much faster than the async_key functions for each item – should the next item only be fetched after the async_key has completed?
Yes. You're welcome.
19:29
I don't think async by itself does any throttling of events - just round-robin'ing of processing by I/O. If async_key were slow compared to async_iter, I would have to use some kind of (FIFO?) queue to limit the number of returned values from async_iter, else I would eventually get all the unsorted values in memory, all waiting for their turn to be async_key'ed.
Like if I was going to dish out money to various states based on how many electoral votes they have, that is a fast dict lookup (a fixed value per state), so async_key would probably be faster than async_iter. But if I wanted to hand out money based on a db lookup of how much donor money came from each state, that would probably be very slow, so async_key would then be slower than async_iter, and I would very likely consume the whole iter before even computing the first key.
The naive throttling is just to run await async_key(item) inside the async for item in async_iter: loop – one key computed per item fetched. The naive concurrency is to launch a new task per item which eventually returns the key – possibly many keys computed while an item is fetched.
20:05
is there a way to escape the { in an f-string?
ha
9 hours ago, by Aran-Fey
escaping is done by {{doubling}}
same as escaping in a format string, for what it's worth
whoa! Hang on a sec, though. What if I wanted to print the value of a variable, within a brace? For example, if a=5 and I want to print {5}, doubling gets me {a}, not {5}
f'{{{a}}}', probably
the first {{ are a literal brace, then {a}, then }} a literal closing brace
mind. blown!
Do check it; I've already lied about escaping today
20:08
I just did. It works
I shall name my D&D character's first born child after you, for this
4
the traditional goat sacrifice will do
current status: I'm splicing raw LaTeX in python fr-strings for streamlit to render it using KaTeX
@inspectorG4dget I do that with matplotlib annotations
20:17
matplotlib can do LaTeX? what? you're destroying my mind today, sir
Looks like crap, hard to maintain. Probably better to build the string from bits if possible.
@inspectorG4dget yes, its renderer uses tex-like syntax on its own, but you can set text.usetex=True in the rc which will trigger actual latex compilation
oh?! much thanks. I'll have to remember this for the next time I'm on matplotlib (which shouldn't be too far away)
There are many ways to set the rc params, one is plt.rc('text', usetex=True) if I recall correctly. What matters is that this sets defaults, so you must call this before the plotting you want to do, and it will affect all subsequent figures.
and if you want fancy latex in there you have to also set the latex preamble in the rc
duly noted. Thanks. Starring to bookmark
I always thought matplotlib was like a haphazard bunch of razor blades held together in a makeshift container made by tying together ends of a thin handkerchief. Today, I leaned that that hanky is just the handle of the bazooka
21:07
@GitauHarrison You will need to say what the underlying RBDMS tech is. I feel like this features into your old questions but I can't remember the specific details. My guess is that you're having issues with a None value going into a unique column; some dbs will allow it, others will not
And actually, I'm pretty sympathetic if that's the issue because it's driven me up the wall in the past. It could be the underlying issue when you were working on your database migrations
21:26
@GitauHarrison ok, scratch my previous comments, I've now backtracked to this. <I thought I'd picked a reasonable starting point for catching up :/ >. SQLite won't suffer from my previous comment about None in a unique column.
 
2 hours later…

« first day (3656 days earlier)      last day (1513 days later) »