« first day (3573 days earlier)      last day (1361 days later) » 

12:00 AM
@MisterMiyagi sorry just getting around to this...been a bad day (the counting file number access thing). It's on Windows, so that might be out too.
 
12:28 AM
@biggi_ in windows you would either create an environmental variable and then change it based on the file access time
Or spawn a process which you just set to monitor said file times
Or change the file attributes themselves (which is harder)
 
1:10 AM
@MisterMiyagi Yeah I did notice, but more that instead of doing the parent + thing, I was showing that with_name method Kevin showed should work to generate that the target name that was needed (which may then be passed to rename)...
 
2:01 AM
@Kevin %windir%\explorer.exe \seperate,\select, "c:/windows/cache/foobarlib" would be better :P
Also I don't know why that cache wouldn't be in AppData (unless your using Vista or gasp XP - in which case you deserve windows staring disk cleanup to save you from yourself)
^ granted I've spent a good part of last year changing Windows Servers 2008 to something slightly more recent so don't have much of a leg to stand on
 
2:18 AM
I also have a cache folder in AppData. Your guess is as good as mine as to why I have two.
Luckily the other lead I'm pursuing with the Intern seems to be working so I don't have to solve this particular mystery
I upgraded to Windows 10 a while back, but I didn't wipe the hard drive or anything. Might be a lingering artifact of an earlier time
 
2:51 AM
@PM2Ring Ok, so what was your answer/ comments on my or the other answers to 'Pythagorean triplets wheat field'?
 
3:05 AM
@Kevin 7 used App Data too
I can guess at why two but the one in App Data is usually the one people want (yes, I know wwwaaayyy too much about Win)
 
 
1 hour later…
4:25 AM
~ Guido van Rossum
 
5:23 AM
Do people not like := ? If it existed from python 1 or 2 I dont think it would have gotten the same treatment
 
@python_learner for me, typing = is way easier than :=
 
It is not supposed to replace = as far as I understood the usage
 
5:49 AM
I can't help but wonder how much time and effort it took to write this PEP...
 
fwiw I like that
 
Maybe I understood it wrong, but instead of writing

match = pattern.search(data)
if match is Not None:
print(match)

I can now do the following?

if (match := pattern.search(data)) is not None:
print(match)
# Do something with match
Sorry, I don't know how to indent in the chat apparently...
 
6:16 AM
@python_learner The return on investment is considered low by many people. It complicates the language for little gain.
There is exactly one case in which it enables something that wasn't directly possible previously (at least not without copious nesting).
@Cribber Please take a look at the formatting guide. It also links to a sandbox for practice.
 
6:59 AM
Hey guys i'm connecting to an API
The callback URL used is 127.0.0.1/callback
127.0.0.1 is the localhost right? But what does the /callback do?
 
That depends largely on the API you are connecting to. Commonly, it means the localation /callback, just like the location /rooms/6/python on chat.stackoverflow.com.
 
I see my friend set it up for me. But does that mean /callback is arbitrary and I can put anything?
 
If your API call is telling the server "call me back at 127.0.0.1/callback", then yes. If you API call is telling the server "call me back at 127.0.0.1" and the server just assumes /callback, then no.
Note that 127.0.0.1 will not be meaningfully reachable unless that API-server runs on your localhost as well.
 
The API-server is not mine though and i'm just accessing my data from my online store
He was initially thinking of creating a subdomain but he tried that callback url first and I was able to retrieve the callback code
But my friend never touched my computer so I don't think he could've set up a new location at /callbackunless it is a standard address or I can also do something like 127.0.0.1/callbackcode?
 
Most likely (I'm guessing here because you did not specify the API) the API-server expects to do a request via http/https to the callback URL. That means the URL netloc (127.0.0.1) must have a http/https capable server running, which exposes the URL path (/callback). Unless you did set that up explicitly, you won't have such a server running.
 
7:09 AM
I am able to get the callback code though so i'm wondering how it works
 
Note that even if you set up a webserver on your machine, the API-server will still not be able to use it because its 127.0.0.1 is not your 127.0.0.1.
 
I see I think i'll have to do some extra reading on this. No way I would've been able to figure out how to get the access token without my friend lol
Feels great to be able to connect already though. Just having a big problem of automating it
Since it expires quite frequently
 
 
1 hour later…
9:02 AM
@python_learner in that case of course not. But it came in 3.8. The problem is that it makes writing unreadable code too easy for too little gain in legitimate use cases. Already some of the examples in the PEP are hard to read or atrocious for other reasons.
And Guido forced it through despite massive pushback, then got sad because this was a bad experience for him.
Well, it was bad for a lot of people, but he was the only one with agency in the matter :P
You can search the transcript for e.g. chat.stackoverflow.com/… or "asspressions" (what I call the feature)
Jul 4 '18 at 14:29, by shad0w_wa1k3r
"The result of the poll: 29 coredevs dislike 👎 PEP 572 vs 3 coredevs like 👍 it. Seems that just these 3 people generate 50% of comments. https://www.mail-archive.com/python-committers@python.org/msg05324.html" - via Twitter
This is just my bystander's perspective of course. I'm in no way involved in the development of python.
And a regular or two here likes 572 as a feature
 
Probably a dupe too...
 
Hi anybody can help me with Azure function App
 
10:16 AM
@AndrasDeak Not in a hunting mood today. Yesterday has been a long day of debugging. :/
 
 
2 hours later…
12:27 PM
Messed up my DJANGO_SETTINGS_MODULE path and getting "Apps aren't loaded yet" error message, what do I do?
 
try to unmess your DJANGO_SETTINGS_MODULE.
 
@MuhamedCicak You probably imported from one of your apps in your settings.py
Don't do that.
And also, revert changes to the setttings module path for a bit & test everything's working, then change the path and retest
If the settings.py is in a folder with an __init__.py, then make sure it's not importing anything that might not be ready
 
you could also run python manage.py check and django-admin check to see if you get any more specific details on which library
 
12:55 PM
Well here it is, I'm running scripts that use django in command line and this error only happens when a script uses models from django
I am utterly confused
Other scripts work fine, like the ones using only django.db
I'm probably extremely messing up something so I'll just come back with more details on my problem (if I happen to have any), thanks for the help
 
So either make a question on SO or search through the mirad amount that exist as it seems this is a common problem
 
Yup thanks... I actually initially thought of that as (first result on your google search, third answer) my problem but because PyCharm gave me this warning (PEP 8: E402 module level import not at top of file) I ignored to even try that. The problem was that I imported models before calling django.setup
 
Hello! Which is the standard python tool for NLP? Keras!?
 
1:48 PM
@kame I use 6 different ones: define "standard" (use-case determines tool)
For instance, NLTK was my standard and is still my standard for deep research or teaching (due to its depth). However, with production level code that must deal with spoken word and other signal processing, I have needed to migrated to 3 other tools (at least one of which is built on top of NLTK) cause NLTK has too much depth.
Then I use CoreNLP (a Java library) through wrappers and Spark for other things. I use Gensim when I have to deal with topic modeling and similarity stuff. And sometimes use TextBlob when I need a simple task or to teach. Also, just straight Python w/numpy and/or pandas for other stuff (sometimes Scikit).
So I guess what I'm saying is I use around 9 different libraries depending on where I'm working, what I'm working with, and what the end goal is.
 
2:06 PM
cabbage
How does one perform Upsert on SQL alchemy
Googling around gives vague results
with people just patching up things
 
UPSERT as in "MERGE" or UPSERT as in "insert if not exists else update"? (either way it depends on the DB more than SQLAlchemy itself)
 
insert if not exists else update This.. I am using postgres
I use the ON CONFLICT DO UPDATE when I use plain SQL
But my team asked me to migrate code to sqlalchemy
I am stuck on how to convert this upsert
 
@LinkBerest I was told that for prod instead of nltk one should use spacy instead (probably one of your three)
 
nah, but not a bad one (its too new for old government and academic jobs to consider)
16
Q: Postgresql ON CONFLICT in sqlalchemy

puredevotionI've read quite a few resources (ao. 1, 2) but I'm unable to get Postgresql's ON CONFLICT IGNORE behaviour working in sqlalchemy. I've used this accepted answer as a basis, but it gives SAWarning: Can't validate argument 'append_string'; can't locate any SQLAlchemy dialect named 'append' I've...

@AndrasDeak for 90% of production one should use anything but NLTK (its the King but you don't move the King itself very much in chess)
When learning: use NLTK (cause you'll actually learn NLP that way then all other libraries are easy to adapt to)
Typically - I use some combination of PyTorch with Spark Dataframes and numpy stuff for my NLP work now-a-days (but it also took a long time to put together the infrastructure that lets me do this - and in the Big Data systems this infrastructure is still broken regularly hence other libraries)
 
2:24 PM
hi
 
cbg
 
2:39 PM
hello
 
okay, the new blog post just....it's just.....okay, I need a break today: rbrb
 
i was looking at the SEDE and wanted to know how to extract the most upvoted answers for a certain tag?
 
@ThelurkerLurker there's a SEDE chatroom on MSO which might be able to help more (its still pretty active)
real rbrb now :)
 
what is good
 
@LinkBerest I found the solution for the upsert in the docs :-P Thanks.. somehow asking it here helps smack the brain to using more common sense :-D
 
2:43 PM
thanks - i dont have enough karma for MSO but thanks
 
@bigbounty please don't ask for help here with fresh questions on the main site as per our rules
 
@AndrasDeak Thank you. I'm a first time user
 
2:59 PM
@AndrasDeak in order to join to The Rotating Knives room, I have requested access. When do I get the approval?
 
@bigbounty Every room is read only at a minimum. If you are simply curious about what's inside, go to "info" and click "view transcript". That way you can view the contents of the room without being granted access.
 
@bigbounty you don't. Read the room's description and look at the contents of that chatroom. We don't talk there.
@Dodge they can also join the room and read the contents; permission is only needed to post messages there
 
@AndrasDeak Ah, did not know that.
 
@AndrasDeak Understood
 
3:23 PM
Hi everyone, I need help Django I am actually trying to paginate a search result which is dictionary of objects.
 
3:42 PM
@HarvindarSinghGarcha please see this recent message of mine: chat.stackoverflow.com/transcript/message/50059130#50059130
 
ok @AndrasDeak
 
Tip: make sure plt is defined before referring to it
Stick a plt = None a line before, that'll fix things up I'm sure
 
ohhh so How do I ask for help @AndrasDeak
 
@HarvindarSinghGarcha you already did :) Wait for answers on main. If you have no luck, ask here when your question is 2 days old
 
3:45 PM
okay
 
user6568562
Cbg guys
 
user6568562
I have a good practice question. I have an API that sends timestamps of a specific time zone. I'm adding these timestamps to a database. Should I convert them to utc, then add them to the database ? Should I leave them as they are ?
 
user6568562
The user is from the same timezone used in the API
 
I believe the common wisdom is to use UTC if you have a choice
 
user6568562
I guess so, and it won't be that much of a trouble
 
user6568562
3:54 PM
In any case, I need to get some sleep then decide
 
Somewhat analogous to the question of "I get a number using input() and later I need to print it with special formatting, should I store it as a string or a float?"
 
Note that technically, a UNIX timestamp is UTC.
 
The answer being "float" 99% of the time. (Or Decimal or whatever)
 
The remaining 50% of the time, the number is actually misrepresented bytes.
 
user6568562
@MisterMiyagi Oh yeah, duhdoy. It's a timestamp representing an already set date and time
 
user6568562
4:00 PM
That duhdoy was directed towards me
 
Thought experiment: what sort of timekeeping standards will be established in a scifi future where near-lightspeed interstellar travel is commonplace?
Keeping in mind that an atomic clock on earth and an atomic clock on a very fast ship will become thoroughly desynced thanks to time dilation
 
I'm sure the God Emperor can sync your watch through hyperspace.
 
Hi,anyone knows a good library for multi threading?
 
@Kevin timekeeping between such frames is meaningless in that society
 
@Janith You mean like threading?
 
4:05 PM
@Janith Please elaborate. Do you mean threading in the usual sense, or parallel processing on multiple cores?
 
The God Emperor tries to only use his tachyon antitelephone in case of emergencies because the last couple of paradoxes were a real pain to resolve
 
@Kevin Some measurement of the amount of dilation of space (if change is constant), or the degree to which it is changing (assuming that is consistent to a calculable model) would be my prediction.
 
yeah
 
cbg all
 
@MisterMiyagi yeah
 
4:06 PM
Well, then threading it is.
 
@AndrasDeak ok,but,none haven't answer it
 
@Janith if you read the rules page I linked carefully, you'll see that the number of answers doesn't appear as a criterion
 
yeah,it is 48 hours
 
yup
 
4:10 PM
@AndrasDeak Meaningless in the sense of, there's no practical reason to have such a standard? Or meaningless as in, no such standard can logically exist?
 
@Kevin the latter, but I suspect that would affect the former.
 
For the former, I posit the use case: "go to alpha centauri and mine some dilithium. Be back in ten years as measured by earth"
 
There will always be a need for "what time is it (here, now)?", same as how Newtonian physics is very useful for determining most moving things in life. Yet when you do GPS or insterstellar travel you have to let it go.
 
There's also the social problem that people will frankly not give a yam when the doodzz on some rock a couple AE away drink tea.
 
@Kevin that's a huge qualitative difference in my opinion. Each roughly stationary place of interest keeping their own time. Then you have to consider going from one to the other, for which you have to consider the way you are transported.
 
4:13 PM
I don't know about the lack of need. Let's meet at location/point in time could be a reasonable use case.
 
"Enjoy colonizing the center of your galaxy. Remember to turn on your antenna every Jan 1 12:00 AM UTC, so we can beam you the hottest memes and letters from your loved ones"
 
But note that I know jack yam about relativity, perhaps @PM2Ring has a more educated opinion on the matter
 
I have a feeling that the closest to a standard they'll have is "if two parties need to know what time it is in their respective locations, they'll meet up, sync their watches, and during their journey inform one another about acceleration maneuvers ahead of time so they can account for changes in position and relative time"
If your flight plan is "accelerate at 1g towards alpha centuari until we're halfway there, then decelerate at 1g until we arrive" then it only takes high school math to know how much time you've experienced relative to earth
 
In most cases I wouldn't expect time differences arising from relativity to be significant. Assuming reasonable accelerations and reasonable gravity.
So in the "meet me at six" sense things will Just Work, I think. Same as post people not actually wanting to sync to atomic clocks.
 
Hmm could be
 
4:20 PM
s/post people/most people/
 
Currently trying to math out how fast my alpha centauri colonists would appear to be moving if they accelerated at 1g for a year. In a Newtonian system, they'd be going at about 1.01*c. Obviously that's wrong so i guess I need to find the equation for relativistic acceleration
 
Postal services can be pretty unreliable in my 'hood. There's a good chance we already live in the post-apocalyptic future when post people do not actually want to sync to atomic clocks.
 
@MisterMiyagi I wish DHL was my postal service :(
@Kevin rapidity strikes again
I think "accelerated at 1g for a year" might be ambiguous in itself. But practically we'd expect them to accelerate with a given value in their own frame of reference, which I'd expect to be unambiguous.
 
Yeah
 
Hmm, yeah, after all as their speed with respect to your frame starts to tend to c, their acceleration with respect to your frame tends to 0
 
Sam
4:28 PM
@roganjosh I come up with my own solution to the problem we discussed before if you'd liketo see it. It feels very over-engineered but it does the job.
 
Which is preferable to the room: item, = (single_item_tuple,), (item,) = (single_item_tuple,), or item = (single_item_tuple,)[0]
 
The last one, but I propose the alternative item = single_item_tuple
 
I've used the first one but I probably wouldn't use it in production code
 
I might be misunderstanding what the goal is here
 
@Kevin pre-existing single element tuple, just confusing question
 
4:39 PM
If it's "create a tuple that's equal but not referentially identical to this other tuple", My XY indicator is blinking
 
Premise: single_item_tuple = (item,). How to unpack it?
 
@Kevin Just to get the item from a single item tuple.
...or what @AndrasDeak said.
 
Oh, so type(single_item_tuple) isn't tuple? In that case, item = the_tuple[0]
 
You're right.... single_item would be clearer than single_item_tuple
 
Also unpack using item, = the_tuple
 
4:41 PM
@AndrasDeak We release the hounds at 4PM. The alligators are scheduled for 6PM. Fluffy cats patrol the mailbox at 8PM.
 
@PaulMcG that was the first option in this question
Kevin's choice was the third option
 
It's a valid approach but I'm going with explicit indexing for the sake of future maintainers that might not know how assignment unpacking works
 
Sorry, I am reduced to lurking on this screen while wfh on my other, so I don't always have context.
 
Usually I give future maintainers the benefit of the doubt and assume they're as fluent in Python as I am, but since the solutions are so close together in terms of concision, I may as well pick the one that uses the easier technique
 
@toonarmycaptain Why do you have a single item tuple in the first place? That's generally not what tuples exist for.
 
4:45 PM
^
 
@Kevin Cheers, that's what I assumed. Of course in my case, if I assume they're as fluent in Python as I am, they'll have to think thrice about item, and twice about (item,)
Result of a .fetchone() from a sql query? Is there something I'm likely missing?
 
I do frequently throw in spurious parentheses if I think it will help me figure out what I was doing... I approve
I can't be looking up operator precedences all day, I got things to do
fetchone returning a tuple of length 1 is a permissible use case, in my eyes. It makes more sense than returning a tuple sometimes and a scalar other times.
 
@MisterMiyagi similar thing (but with lists) is what matplotlib sometimes returns when you plot things. And I never like to .pop() out items from single-element lists.
 
Basically I think MisterMiyagi is saying that if you have control over the data from the beginning, there's no point making it a tuple if you know ahead of time it will only have one element. That doesn't apply in this scenario because the sql engine has control over the data at first, not you
 
@toonarmycaptain Ugh. "fetchone" should return one item, not one tuple of one item. It's in the name already.
 
4:52 PM
Certainly you ought to convert it to a more sensible form as soon as possible, which is what you're doing
 
I know these kind of APIs exist out there in the wild. If you're the one writing them, make sure to change that.
 
I'm assuming here that fetchone is returning one row, which happens to be represented as a tuple of column values, which happens to be just one column
Which may be an unfounded assumption, since I have about an hour's worth of experience with sqlalchemy and friends
 
@Kevin Precisely.
 
Alternative: [item] = the_tuple
 
for MATLAB fans
 
4:58 PM
To please the pattern matching crowd.
 
Devil's advocate: I only dislike the unpacking approach because there's only a single element. If you have other regions of code that fetch from tables with more than one column, those can use unpacking. And if they're relatively close to this region of code, then I'd be tempted to use unpacking here as well, for the sake of consistency
Hopefully the future maintainer will look at item, = cursor.fetchone() and think "what's this doing? Oh, it's probably doing the same thing as id, phone_number, favorite_color = cursor.fetchone() ten lines up"
Zooming out, it might be nice to use an engine that represents returned rows as dictionaries rather than tuples. do_stuff_with(row["item"]) is a smidge more self-documenting than item = row[0]; do_stuff_with(item)
Likewise, models that map columns to attributes are attractive for the same reason
e.g. do_stuff_with(row.item)
 
5:21 PM
My main problem with item, = the_tuple is that a lone , is very easy to miss.
Especially when the name is longer than item and there's actual code around it.
 
True
My devil's advocate is basically depending on the reader expecting the comma to be there before laying eyes on it.
 
That's the devil for you.
 
For a long time the prince of lies could not find a foothold in our craft, based as it was upon foundations of logic and truth. Then neural networks became popular.
Now he's working for a facial recognition startup, stealthily making the algorithm racist
 
5:44 PM
@MisterMiyagi this is part of the SQL standard
Particularly since you could get a fetchone() value and just insert it into a subsequent query, as a means to escaping injection. At least, that's my understanding of why they did it
It's pretty baked into the PEP though to be changing it now :)
 
hi everyone
I have noticed an unexpected behaviour with regex
(I am new into that stuff)
this is it:
 
@roganjosh PEP 249 is my personal space whale aesop. I have no idea why it exists, nor what it's trying to tell me, but I sleep well knowing the chance of crossing one are low.
 
why re.findall is not finding CCC?
or how to make it find it?
 
Which is only half the truth, because that one crosses my path often enough. Then it's usually part of the general pollution of the seas, and there are much worse crimes against code style to worry about.
So, don't throw your trash in the sea, kiddos.
 
@MisterMiyagi To give you a plethora of different ways of binding parameters, and not insisting that each API implements them all, duh. You know at least one of the will work - but which?! Is it going to be ? or %s? Take your bets!
 
5:53 PM
@zabop Seriously? images of code? Making it hard for people to copy/paste your working example is not a good way to get help.
 
import re
txt = "GTCCTCCCGCCTCGGCCGCGCCA"
x = re.findall("C.C", txt)
sorry @PaulMcG
print(x) returns ['CTC', 'CGC', 'CTC', 'CGC'], and I would like this list to include CCC
 
help(re.findall)
Help on function findall in module re:
findall(pattern, string, flags=0)
    Return a list of all non-overlapping matches in the string.
The key word is "non-overlapping". The leading and trailing C's in "CCC" were already found as part of "CTC" and "CGC"
 
@MisterMiyagi Another point, which is probably more pertinent, is that parameterization always expects a sequence. So cursor.execute("""SELECT something FROM somewhere WHERE some_condition = ?""", parameter) is a pretty common mistake when passing strings for parameter, because it will try and unpack it character-by-character and break
 
@PaulMcG alright, thats helpful
 
@roganjosh That works for me in principle, but then why is there a PEP for DBs in specific? There are tons of common use-cases out there which are triple-Frankenstein API wastelands that could benefit from standardisation.
 
6:03 PM
I'm struggling a bit to think of something comparable. My best guess was WSGI and that also has a PEP. What examples are you thinking?
 
Plotting comes to mind, and the growing number of almost-but-not-quite-numpy libs. Serialisation/Configuration also is quite a bit of hit-and-miss in terms of dos and donuts.
 
6:19 PM
mm, maybe. But given that SQL has a huge number of almost-compatible dialects, I guess it was more pressing than libraries for plotting
I suspect there was also a back-and-forth going on to help support SQLAlchemy. IIRC there was some operator overloading or syntax changes specifically aimed in getting Numpy functional but I can't remember what they changed to make that happen :)
 
6:33 PM
Ah, they're listed in the short history. Quite a few changes, including the step argument in indexing
 
7:08 PM
@Sam this is the eval thing?
 
8:09 PM
@roganjosh Ah, that's the thing that irks me about 249. In other languages, DB support means kick-all things like LINQ. In Python, DB support is some warty API spec with lots of "Optional X" and an inconsistent naming scheme.
It's definitely something to discuss loudly at the pub.
 
@MisterMiyagi You know me so well <3
Nobody would know what I was talking about, but they'd know that I felt very strongly about something if I pull up the bar stool. The best kind of argument - utter bewilderment from the opposition
 
@roganjosh the only thing that comes to mind is the support for the @ operator which is tied to __matmul__
 
There's a number of them in the link just below that. Quite surprising developments, if they're all attributed to Numeric/Numpy
 
nothing loads on that page without JS, boo
 
"While there were miscellaneous changes, such as the addition of complex numbers, many changes focused on providing a more succinct and easier to read syntax for array manipulation.
For instance, the parenthesis around tuples were made optional so that array elements could be accessed through, for example, a[0,1] instead of a[(0,1)]. The slice syntax gained a step argument— a[::2] instead of just a[:], for example—and an ellipsis operator, which is useful when dealing with multidimensional data structures."
 
8:19 PM
Just found that. I've appended a glaring [citation needed] there
I'll only believe that if specifically parentheses were made needless in __getitem__.
And the step argument is very much relevant for built-in sequences.
It's not the same thing at all as adding new syntax for matmul
 
I'd sorta half-remembered, which was why I gave the link. The database PEP was only a specification and I think my brain just ambled off the path and started thinking about how a library can try influence the language in general, with those numpy claims coming to mind
 
hammered
 
Cheers :)
 
Before I even ask, I will say what I have tested
The regular expression is okay
I made sure that I was returning the right object and not a different object of a similar name
31
A: Get HTML code using JavaScript with a URL

Senad MeškinUse jQuery: $.ajax({ url: 'your-url', success: function(data) { alert(data); } }); This data is your HTML. Without jQuery (just JavaScript): function makeHttpObject() { try {return new XMLHttpRequest();} catch (error) {} try {return new ActiveXObject("Msxml2.XMLHTTP");} catch (error) {} ...

 
9:37 PM
"I am new to programming and I am not too sure how can I do it without jQuery." --> top answer starting with "Use jQuery:". Glorious.
 
As always
 
@JohnnyApplesauce will the question end up being python?
 
9:55 PM
I'm not sure if this is the right place to ask
Is there an algorithm that has a complexity of O(1/n)?
Or an algorithm that becomes faster as input increases?
 
Cacheing algorithms can get faster as you feed more values to the cache and get more cache hits vs. misses, but that would be going from O(>1) to O(1) at best. You never get better than O(1).
 
@Mr.Matho Where does that go, if you follow time complexity to its limits?
 
O(1) means "there's an upper bound on the runtime" so 1/N would also be O(1)....which is to say this gets confusing real fast
 
Infinite data --> infinitesimal processing time
 
not sure
 
10:01 PM
Use that Math-o-matics
 
What about an algorithm that given the starting few words of a sentence, creates a meaningful sentence of 10 words
The more words we input, the less number of words it has to compute
Can't something like that be called O(1/n)?
 
@Mr.Matho unfortunately mathematics doesn't care about what you call things
 
I guess you're right
 
it only cares whether exists c > 0 such that lim_{n -> infinity} time_to_run_algorithm(input_length_scale=n) <= c*1/n
 
@Mr.Matho no, because it still has to parse the sentence and, if anything, the amount of data it has to crunch by you giving it more words increases
 
10:09 PM
@roganjosh Assuming if we give it words from which a meaningful sentence can be formed, it should take less time than it guessing new words
 
And, I'd put a bet that it isn't scaling O(n) or even O(n^2) but I'm not the nltk guy
 
@wim , @ExoticBirdsMerchant and anyone else needing home ergo: CNET: This is the gear you need to work from home (and it's in stock now)
 
@Mr.Matho if that were true, how do you reconcile it with the obvious conclusion I posted earlier? Is there some cutoff where it suddenly flips?
 
@Mr.Matho I mean, we could construct algorithms like "estimate the prime gap size G starting at N", then we can probabilistically guess that all the numbers N, ..., (N+G-1) are all composite. The larger N gets, the more "efficient" the algorithm is. Depends what you mean by "algorithm", not to be pedantic; these are backed by a-priori statistical knowledge. Or "estimate the total number of primes with bitlength B"; the larger B gets, the more "efficient" (2^B) gets on a "per-integer" basis.
 
10:16 PM
@roganjosh Well we can't have less than 1 word as input so it can't flip
 
@Mr.Matho You could still have 10 billion words and 1 to guess
 
@roganjosh what do you mean by flips here btw?
 
I mean that it can't stay 1/n forever or you would reach my totally logical, but totally impractical, conclusion.
 
@smci by efficient do you mean a faster estimate or a better estimate?
 
@Mr.Matho I mean "faster, when counted on a per-integer basis, rather than (say) on a per-bitlength B basis, which is obviously logarithmic to the number of integers". And yes, there are both exact and approximate formulas; I was talking about about exact, but the same applies to both.
 
10:23 PM
I think this is gonna derail pretty quickly. I think smci should be able to answer that but then we might not get much further after that
 
perhaps machine learning would help
 
@Mr.Matho You're getting totally confused about what "n" means. Does it mean "s, the number of given starting words in the sentence" or "v, the size of your vocabulary of all words" or "m, the number of additional words in the sentence we are going to construct" or "h, the number of total sentence-fragment hypotheses we will evaluate, which will likely be O(~ constant^m), i.e. exponential-complexity".
 
You guys ever try Elm? I'm playing with it and it's kinda cool. It's like Haskell meets Javascript, I think...
 
@Mr.Matho perhaps it's just a straight answer that you're missing: no.
 
@roganjosh Mr. Mathos hasn't defined what "n" means. It could stand for lots of things. I showed examples where we can pick both "n" and our algorithm such that the larger "n" gets, the more "efficient" we become. This is all tautological.
 
10:28 PM
@smci Let's shut the conversation down now, then? I felt it only fair for you to give a response to directed question, but I kinda feel this isn't going anywhere
 
@roganjosh Agree totally. (This is why I rejected the idea of doing a PhD in maths, interesting as it might have been...)
 
The first rule of tautology club is the first rule of tautology club.
 
@smci by n I mean the number of words we provide as input
sorry for the confusion guys I am kinda new to algorithms and complexity myself
(just started learning about it in a discrete math class)
 
@Mr.Matho then you meant "s, the number of given starting words in the sentence" like I asked you above. Anyway, the ROs have told us to stop this discussion here, and I'm not interested in continuing in a private room. You might try CS theory.SE, or Mathematics, or their chatrooms... it must be on-topic somewhere in the SE-verse. But not here.
 
I think you may have learned quite a bit, but it's not a Python-specific question and at risk of getting the room off-topic.
 
10:31 PM
@AaronHall Shurely the zero'th rule...
 
Wherever you ask, you should spend some time understanding the basic concepts, what O(n) and O(n log n) complexity really mean, etc.
hard to have hypothetical discussions when you're probably missing the fundamental picture
 
@AndrasDeak "n" is generally a parameter that quantifies the OUTPUT or the TASK and how hard it is or how many hypotheses/candidates we have to evaluate, not the INPUT. That's why I called it "s, the number of given starting words in the sentence". Not "n".Anyway, not continuing this discussion.
 
@smci that's a valid interpretation
 
@AndrasDeak ' '.join(reversed(['argument', 'an', 'for', 'here', 'come', "didn't", 'I']))
 
@roganjosh sorry for asking in the wrong room, thank you for trying to help tho
 
10:38 PM
@Mr.Matho certainly not just my effort :) But it's perhaps best that you look into time complexity first. You're welcome to talk about python, snakes, 'n' stuff :)
 
@roganjosh Insert obligatory Samuel L Jackson meme...
@roganjosh Okay but you yourself have criticized me in the past for using language like that viz. room rules.
 
@smci I was referencing the film. I shall move it, though
 
@roganjosh We were both referencing the film, I just mentioned you'd told me and other people off for using similar language in the past, even in a jokey way not directed at a specific person. Or snake. :S
 
I don't believe that I actually have done that, but you're welcome to prove me wrong in the meta room
 
Has anyone here any practical experience doing SRL (Semantic Role Labeling) in Python, whether using AllenNLP, practnlp, cobbling together something with spacy/nltk, Stanford NLP via wrapper, AWS/Azure/GCP APIs etc.? (I already looked at the few Q&A on SO, they're very skimpy)
...seeking recommendations. Something simple, functional and lightweight, not a 1Gb deep-learning model like AllenNLP.
 
10:55 PM
How can I convert a hexadecimal string like this '\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85' to utf8 string?!
 
@PM2Ring There are plenty of existing such talks and blogs. I definitely wouldn't look to Wikipedia on that, there will be too much ideological comment and nowhere near enough practical software-engineering advice.
 
@X4748-IR Like this? b'\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85'.decode('utf-8')
 
@PaulMcG Yes.
 
Lucky guess - heading out to buy lottery ticket now
 
@X4748-IR PaulMcG see solution in chat.stackoverflow.com/transcript/message/49656866#49656866 . We should add something to SO canon. Reminds me, JonClements offered to add me to canon editors months ago but never got around to it.
 
11:17 PM
...partial self-answer to above question on SRL (Semantic Role Labeling), here is a ranking from back in 1/2019 of out-the-box NER performance for 5 major cloud NLP APIs (by an R user, but that doesn't matter): Google, AllenNLP, IBM, AWS, Azure. And I heard anecdotally that GCP made major improvements throughout 2019. Surprised AWS scores so badly (? can anyone comment?). Maybe they didn't use the higher paid tiers of AWS.
 

« first day (3573 days earlier)      last day (1361 days later) »