« first day (3475 days earlier)      last day (1458 days later) » 
00:00 - 17:0017:00 - 00:00

12:09 AM
hello everyone, is there anyone knowing django here and willing to spare some time to help me please??
 
i would like to know as well =)
 
thats real hard bro.... I almost never get answers cuz my account is new i guess
 
bro do u understand regex fine?
 
it depends for what. I used to use it in UiPath , not in python, so im afraid i am helpless
 
          for item in f:
           # section header
              match = re.search(r'IP Arp[^-]*-\s*(\w+)', item)
              print(match)
         i go this regex to get any string that starts with IP Arp - but all i get is none
 
12:22 AM
lemme check if i can do smth
 
ty bro
 
IP Arp - \w+
match = re.search(r'IP Arp - \w+', item)
guess you were doing something complicated for nothing haha
regex101.com go on this website when you want to try your expressions.
@JohnSmith is it working?
 
yeah bro it helped me thank u so much =)
 
12:38 AM
u are welcome
 
12:49 AM
hello everyone, is there anyone knowing django here and willing to spare some time to help me please??...
 
 
3 hours later…
4:15 AM
@RomanBaron your request is nominally on-topic in this room, but I have flagged it as spam because you have sprinkled it across several rooms where it was not appropriate, and repeated it here
 
4:42 AM
Hi Team
I have csv file and need to convert to json file.
I did the following way...
import csv
import json

csvfile = open('STAFF_TABLE.csv', 'r', encoding='utf8')
jsonfile = open('STAFF_JSON.json', 'w', encoding='utf8')
reader = csv.DictReader(csvfile, )
for row in reader:
row['COURSES'] = row['COURSES'].split('?')
row['STD_NO'] = row['STD_NO'].split('?')
json.dump(row, jsonfile)
jsonfile.write('\n')
But in csv, file I have multiple values with "?" delimiter in a column
But I need to conver to list any filed have muliple values with ?
In the above code, I did manually for two columns but I need to for all columns if it has multiple values then need to split to list...
 
5:01 AM
@Vijay - Please see the notes on how to format posts in chat - it really makes it a lot easier to help you if we can see your code as Python, not left-aligned text.
Lookinng at your question, you can work on this totally separate from CSV's or JSON or any of that. The csv.DictReader gives you Python dicts. So you can create a sample dict for yourself with sample data, and then experiment with it. You can read tutorials about Python dicts and see how to iterate over all the keys in a dict using dict.keys().
If row is the variable you use to store the DictReader's dict into, then you can iterate over all the fields in it using for fieldname in row.keys(): and then use the field name to access and update each dict's value, as you showed that you already can do with COURSES and STD_NO.
In fact you can iterate over a dict's keys with just for fieldname in row:, since the default iteration over a dict gives you the dict's keys.
 
5:23 AM
why is the company keeping data on who has STD's
 
5:58 AM
looks like a school or university, and the mapping seems to be from course to STD, so maybe this database is the curriculum on STDs? no PII here
 
6:17 AM
@PM2Ring thawing :D
@PM2Ring most that is happening is forbidden by the room tags so that's it :D my biz is running better than ever :F
 
6:39 AM
wow
 
6:58 AM
everything fine here?
 
@Jean-FrançoisFabre related to modbiz or topics that do not belong to the room :? ;)
 
@AnttiHaapala Ah, ok. :)
@Jean-FrançoisFabre I think things are fine at the moment. But I guess you may be responding to the flag re: chat.stackoverflow.com/transcript/message/49172567#49172567
@JoshuaVarghese Your name reminds me of the author of this excellent book about the non-European history of mathematics: en.wikipedia.org/wiki/The_Crest_of_the_Peacock
 
7:20 AM
thats gheevarghese :)
 
@Todd I guess you're being humorous. I assume that they're using "STD" as an abbreviation of "standard".
 
@PM2Ring yep.
I don't know for you but I feel that python questions are less and less interesting... Time to learn a new language. Or write a new one :)
 
@Jean-FrançoisFabre I rarely look at Python questions these days. It gets depressing rather quickly... I spend more time on Physics.SE.
 
Create a new language with python ?
 
@PM2Ring same for me, for retrocomputing, where I'm starting getting rep, after 1 or 2 years trying to contribute in vain :)
@JoshuaVarghese yeah. Swap "and" and "or", "!=" and "==" => new language.
 
7:28 AM
I don't have the enthusiasm to learn a new language. And my brain doesn't absorb new information as well as it did when I first started coding in 1970...
 
my brain doesn't absorb new information as well as it did when I first started breathng in 1971.
 
ooo, and for '==' and '!="?
 
I mean invert the tokens. Make a language where you have to think in reverse. I'd call that "nutcase".
 
Paul McG is kind of creating a mini-language, although it's probably more correct to call it a fancy expression evaluator. There's a link on the star board.
@Jean-FrançoisFabre You kind of have to think in reverse when coding in RPN languages, eg PostScript. When I'm writing PostScript it takes about 5 minutes for my brain to "click" into Reverse Polish mode, but once it does, RPN seems very natural. The only problem is when I'm using 2 different modes at once, eg a Python program that generates PostScript code. :)
 
8:22 AM
yes.. everyone should write their own language
there's a deficit in new computer languages
 
@PM2Ring Do you feel like the quality of python questions has dropped a lot lately?
 
@RoadRunner a lot has
 
8:42 AM
@RoadRunner I can't really tell, because I haven't been paying close attention for over a year. I look at the questions every now & again, and sometimes post comments, but I haven't been inspired to write an answer for quite a while.
 
All the good questions have already been asked
 
I get the impression that because fewer Python experts are following the tag that the quality of answers has also declined. I used to post comments on answers from newer answerers, pointing out minor errors, but I don't do that very often these days. But I did so a few hours ago, and was pleasantly surprised when the answerer responded to my suggestion & improved their answer. So I gave their answer an upvote.
 
I see a lot of questions where a simple search pops up good answers.. but nobody seems to flag those.. and others that I think are good and somewhat dissimilar to the ones I find on search that get immediately shut down
the time of day of the posting seems to be a factor in it
 
moderation has got the best of me. I used to refresh the python questions every 2 minutes before that. Sometimes there were non-duplicate good questions...
 
@RoadRunner yes! The frequency of RTFM questions has skyrocketed.
 
8:50 AM
one today I saw.. this guy was trying to subclass int.. so I thought I'd try and help and see if there was anything relevant with a search.. bang.. two or three high quality answers already on SO.. but.. no.. answers were popping up on the question and getting upvotes
 
@Todd That's always been a bit of an issue though. If a question looks obvious, experts may not bother opening it, figuring that the less expert answerers will be able to handle it. OTOH, if they know that there are tricky aspects to a seemingly basic question, the expert may check it to make sure those tricky aspects are covered correctly.
 
when the two or three answers already on SO exactly answered the same question
 
Yeah seems like I'm having more difficulty finding duplicates when I know for sure many exist
 
I also think that when you're starting on the site, you're more motivated in answering low-hanging fruit and you ignore the concept of duplicate. When you have experience on the site, you stop doing that or even commenting...
 
that's the sense I get.. there's a certain type of question that attracts the long timers
 
8:52 AM
@Todd same here. Makes it infinitely harder to find the proper dupe, and kinda discourages putting work into dupe hunting.
 
moderator privilege allows to close as typo when it may also be a duplicate.
only rep I'm getting nowadays is on old answers.
 
I cut and pasted the link to the answer already on here.. nobody cared.. they just kept posting answers.. probably even aware of the other Q.. maybe even pulling info from it
 
@Todd I've actually been seeing a lot of direct copy pasting from existing duplicates.
 
that's kind of frustrating though.. when you really need an answer to something.. and when you search.. you get all these low quality posts to sort through to find the good answer
 
@Todd That's another perennial problem. The newish answerers are less aware of the existing dupes, and they have an incentive to write an answer & possibly score some rep (as well as just getting more practice in writing answers). There's no rep or badge rewards for finding good dupes, so it's hard to motivate people to do it.
 
8:55 AM
it's like youtube.. you know some good video that's on there.. but when you search you get all these juvenile people who think they're funny posting pictures with the same title with them sitting there burping
 
stackoverflow.com/questions/61339485/log-in-in-python I think I would have answered 2 years ago. Now I don't even want to
 
*videos
hahaha.. i always love these scripts people come up with for log ins and that sort of thing
 
@Todd Exactly. People with experience in using the site to look for good answers understand how the deluge of low quality answers degrades the general quality of the knowledge base. But it's not easy to make the newbies understand that.
 
I wonder if they're just doing an assignment for school that isn't really intended to be used.. but then again.. maybe they think that they're really implementing a good log in system
 
@Jean-FrançoisFabre well, still more interesting than C :D
 
8:58 AM
FWIW, I was using SO via Google for almost 3 years before I decided to start contributing. And my main motivation was to help prevent the flood of low quality & downright wrong answers.
 
@AnttiHaapala barely
 
@PM2Ring We need more people like you
 
are you still keeping the faith?
 
And for the portugese language expertise too.
duplicate+3 downvotes => problem solved: stackoverflow.com/questions/61339485/log-in-in-python
 
9:00 AM
@RoadRunner Thanks. I haven't totally abandoned the site. I still respond to request here to close dupes, etc.
 
@MartijnPieters haha I guess I had missed this :D
she does know, buying a bag of Finnish candy in Sweden ;) Don't let the Swedes deceive ;)
 
talking about dupes...
 
not a django expert. Won't use gold. sry
 
after more thought, it's probably not really a dupe, just closely related
 
@Jean-FrançoisFabre :D You'll never let me forget that little incident. ;) A few days ago, I heard a French version of a classic (Mexican) Spanish song, Bésame Mucho. My French isn't great, but it's good enough to kind of understand the lyrics without consciously trying to translate them. And of course the French version flows much better than the English version.
 
9:06 AM
oh...it's not even tagged python, so no hammer until that's added anyway...
 
@Jean-FrançoisFabre Here it is, if you're curious: youtu.be/-uYVnqOdr9s
 
@Code-Apprentice same thoughts, though there still might be another dupe target, will check
 
I'm quite fond of that singer, Tatiana Eva-Marie. I guess her French accent may be becoming a little influenced by living in New York.
 
@PM2Ring ah perfect example of Portugese.... like it's spoken in Mexico :)
You may like Paris Combo: youtube.com/watch?v=ibuPuqjjCkQ
Je suis un if. Not sure it's about python statements though
 
@Jean-FrançoisFabre I also listen to a lot of Brazilian jazz, sung by young women from Barcelona. I guess speaking Catalan may be helpful with getting the Brazilian Portuguese accent right. Eg, youtu.be/EazJHMFvQ3s
 
9:14 AM
@PM2Ring is there a one-liner for mutiple substring replace?
 
@PM2Ring I recently discovered Astrud Gilberto...
 
old jazz
 
I love how the poster is very concise and doesn't confuse us with a lot of details and code on that one
 
@Jean-FrançoisFabre Yeah, they're great. Thanks for that! I'll have to check their other stuff.
 
9:23 AM
can 'cv's result in revenge?
 
@PM2Ring I linked to the tune I like best. But others are also good. And as a bonus your portugese will improve greatly :)
 
@Jean-FrançoisFabre Ah, ok. She's got a quirky voice, and a strange sense of pitch. But somehow, it works. FWIW, Astrid had never sung professionally before her 1st recording session, she was just there with her husband.
 
When i listen to other Brazilian singers i just like them less. It's the magical Getz/Gilberto/Astrud trio that does it.
 
@JoshuaVarghese It depends. If you're replacing a bunch of single characters with single characters then the str.translate method is much more efficient.
 
its a bunch of substrings
i have a dict. i want a one-liner to replace key with value
 
9:27 AM
@JoshuaVarghese They can, but don't worry too much about it. Many posts that need closing come from newbies with rep under 125, so they can't downvote. ;)
 
@JoshuaVarghese Hmm. Show us a MCVE please. There may be a better way. And this could be a XY problem.
 
MCVE? i'm a newbie in this chat :)
 
@JoshuaVarghese one-liners are overrated. Seek readable code.
 
the abbreviation MCVE stands for Minimal, Correct, Verifiable Example which is what that page used to contain once upon a time
 
9:30 AM
@Jean-FrançoisFabre is it time to open stackoverflow.com/questions/61339958/… ? he edited it
 
even further back there was another acronym something like SCSSE but I don't remember it exactly
 
@PM2Ring i was working for jean lol. i have this dict {'and':'or','or':'and','==':'!=','!=':'=='}
 
@Jean-FrançoisFabre I get that. But Brazil has produced a lot of fine singers (and other musicians too). Eg, Elis Regina. Here she is singing Águas de março with Jobim, the composer.
 
@JoshuaVarghese Jean-François, not Jean
 
name typo? :)
 
9:33 AM
No
 
@JoshuaVarghese yes. thx
@PM2Ring Jobim. Almost forgot him. Of course. Superb, thanks (too bad it's not in portugese, but nevermind :)
 
@Jean-FrançoisFabre Here's a more recent Brazilian singer (& actress) doing another Jobim classic:
Nov 10 '16 at 8:52, by PM 2Ring
@Jovito Everything, I hope. :) My favourite is Vou Te Contar, and I've been searching for the best version on YouTube. One of my favourites is by the delightful Marjorie Estiano. I'm just so pleased that people are keeping the old bossa stuff alive.
 
@PaulMcG Yes, I have tried and able to achieve. Thanks !!!
 
that one I know (Wave by Jobim)
 
9:43 AM
@AndrasDeak is [i for i in range(20) if i % 2 == 0] overrated?
all may not be overated :)
 
[i for i in range(20) if i % 2 == 0] => list(range(0,20,2)) so yes overrated 😀
ok GTG time to cook dinner for the family. Glorious times...
 
Those 2 young ladies from Barcelona are also fine horn players. Here's a recent example of them with a small group singing & playing a bluesy bebop number, Stolen Moments.
 
@JoshuaVarghese can you please state a reason when you request close voting?
 
MCVE ?
 
10:04 AM
Its becoming rare to see MCVE these days
 
@Code-Apprentice I don't think any of these even begin to answer the problem.
 
Miyagi's Theorem: "It is impossible for an SO code sample to simultaneously provide more than two out of the following three guarantees: Minimal, Complete, Reproducible."
 
@RoadRunner Copying stuff from other answers without making it clear that it's a copy and without giving proper attribution to the original author is plagiarism. When you see that happening, please flag it with a custom flag, explaining that it's plagiarism, and include the link to the original.
152
Q: What to do when plagiarism is discovered

PekkaHow should I act if I discover a user plagiarizing fellow users' posts? What if I find someone plagiarizing external resources without attribution? See also: Users are calling me a plagiarist. What do I do? Return to FAQ index

 
I would suggest using GNU make to build the program. If the source file is named prog.c, you can build it to prog with make prog. You're welcome. — Antti Haapala 24 secs ago
(in response to a question of "how can I build a program that does xxx")
 
10:24 AM
@AnttiHaapala That's not very welcoming. But oh so satisfying. ;) And now that it's deleted (hopefully) nobody will complain about the snark. I suspect that it whooshed right over the OP's head.
 
@PM2Ring I'll keep that in mind. Thanks :)
 
I have to confess that I miss the old days when we could get away with posting code golf or convoluted answers to poor questions...
5
@RoadRunner No worries. Programmers can't be expected to be experts in licensing and copyright law, etc. But we all need to know a little bit about that stuff. And it's also common decency to respect each other's intellectual property.
 
@PM2Ring I wanted to answer the question, but could only write a comment. I answered the literal question that the OP asked. I would very gladly answer again should they ask another one :D
 
10:51 AM
@tripleee is it ok now?
 
@JoshuaVarghese you mean this? It looks weird, what's with the sum and aren't you reading the input file twice?
@JoshuaVarghese not a Python question
 
it looks like using f doesnt help
its a regex question?
 
@JoshuaVarghese it's a PHP question, most modern languages have (a different dialect of) regex
 
ok
but for my answer, the sum is a fast method for even larger files
 
no, it's too slow if you read the file twice
there is no need to know in advance how many lines there are, when read returns nothing you are done
 
10:59 AM
but if i use f instead of the open there, it doesnt seem to work :(
 
with open(input_file) as lines:
    offset = 0
    for line in lines:
        if offset != 0:
            line = line.rstrip('\n')
        print(line)
        offset += 1
        if offset == 4:
            offset = 0
probably an off-by-1 but you get the idea
oh and write instead of print
 
would f.read().count('\n') +1 work?
 
no, I don't see what you hope it would do or why you think it would be useful
 
istead of the sum, i meant
 
there are several answers there with better approaches already, anyway
this one resembles my attempt above but I'm sure it could be written more elegantly
this one looks more pythonic though it's also a bit obscure IMHO
 
11:09 AM
well check now, i've edited
@JohnSmith check the room rules. use a paste
 
what's wrong ? xd
 
big code
 
anyone could help me on this one i dont get any print from print (item) the 2nd one
is just for you to see the bigger picture so its easier to spot any error
 
@JohnSmith give us an MCVE, and please don't post large blocks of code directly here. We won't be able to help with a regex parsing problem without an MCVE.
 
11:15 AM
alright ty
 
In your MCVE (that you post elsewhere and link here) you can use a StringIO to include an example file directly
 
@tripleee is it ok now? it seems faster?
 
so basically i should post my code and then share the link here?
here's the link guys of the issue i stated stackoverflow.com/questions/61342428/…
 
@JoshuaVarghese definitely should be if you only read the file once
 
needs debugging details/no MCVE stackoverflow.com/questions/61342428/…. Within the 10-minute grace period but we told OP here earlier to put together an MCVE
@JoshuaVarghese good job misleading an ususpecting user
 
11:29 AM
?
 
@JoshuaVarghese going forward please don't interfere with room moderation if you can't do it right. Pointing people to the room rules I thought you are aware of the contents
We don't tell people to post their code on SO. We ask them to post in a code paste service. Posting a poor question on SO benefits nobody.
 
ok sorry about that
 
11:55 AM
@JohnSmith I just gave you an upvote on that to cancel the downvote. It doesn't actually deserve an upvote (yet), but you were following Joshua's bad advice & didn't realise you were doing the wrong thing. So you should try to improve that question, and it may get reopened.
 
no problem does anyone knows how to tell the regex to found a string or other
 
@JohnSmith You should work on fixing that question. Please read stackoverflow.com/help/minimal-reproducible-example and do your best to follow its advice.
 
alright but iam completely begginer how dont even know i would make a small code out of that because i dont know whats the error, is just it doesnt give any error, but also doesnt print nothing
*i dont
 
could you give the input?
 
12:00 PM
I don't know what kind of help you expect if you don't even read what you were already told.
Nov 20 '17 at 20:26, by Andras Deak
> At the zoo.
> kid: Daddy, what kind of animal is that?
> dad: ...
> kid: Daddy, what kind of animal is that?
> dad: ...
> kid: Daddy, what kind of animal is that?
> dad: ...
> mom: Honey, why won't you answer him?
> dad: Darling, let him keep asking, that's how they learn!
 
it's fine im not forcing anyone to help, i know it's my job to find out my problems
 
okay?
 
The point is probably not a big thing here it should be a simple typo
 
@JohnSmith Sure. That code has some problems. It looks like you created it by pasting together stuff that you don't understand properly. It can be tempting to do that, especially when you're new, but it's a dangerous way to code. But anyway, to improve that question you need to include a few lines of typical input data and the output you expect from that data. That makes it a lot easier for readers to understand what you're trying to do.
 
12:11 PM
i understand but i thought it could be the way it was structured,the thing is the regex is fine all is fine .
 
@JohnSmith As Wiktor said, a big problem with that code is where you are doing for item in f:. That's wrong. f is your file object. So doing for item in f: loops over all the remaining lines in the file, until the end of the file. And at the end of the loop there's nothing left in f to read.
 
with item in f i get the first regex output but not the second after continue, if i replace it with item in line it doesnt show the first regex either
i was using item in line: first but now i wanted to add a string before every ip is printed, so i messed it up and now i get the string but i dont get the ip because i added the continue function there
probably based on what your're saying it prints out the string but then when it reaches the end of the file doesnt have any left to read so it doesnt store any ip on it. how could i found the string and then search all the file again to searchfor the ip and matched it together?
 
erm, there is an unguarded continue before the second print...
the entire code block containing the second print will never be executed.
 
12:27 PM
@JoshuaVarghese if you see a dupe without the generic tag please add it. Most gold badgers don't have version-specific badges
@JoshuaVarghese And again: either answer or vote to close.
 
The point of closure is to stop answers from being posted, so posting an answer and then answering is very bad form.
 
@JohnSmith You should have one main for loop that gets each line. You can have a loop (inside that main loop) that loops over the words in that line, if you need to do that. But please do like I said earlier: edit your question! Add input, expected output, and fix the indentation. We should be discussing this stuff in the comments on the question itself, not here. I've been bending the rules and discussing it a little here.
 
i didnt know it had a dupe until austin put that up :)
 
@MisterMiyagi thanks for the answers but what you mean there is an unguarded continue you mean the code after it is not in the correct Identation level?
@PM2Ring thanks i will work on that!
 
12:32 PM
@JohnSmith There are some irrelevant tags on that question, and no python tag, but there's also an edit suggestion that needs to be approved first.
 
@Kevin could you find a faster answer for stackoverflow.com/questions/61271346/… than the given?
 
@MisterMiyagi I didn't look to closely, due to the bad indentation glitch. And it's kinda hard to know if it's like that in the code on John's machine, or just a copy & paste artifact. But yeah, that sort of thing is a classic symptom of cargo-cult coding.
 
Its exaclty how i have it , when i change it it gives an identation error,but not how i posted it
 
@JoshuaVarghese Please don't randomly ping people about stuff, unless it's a continuation of an ongoing conversation you're having with them.
 
@JoshuaVarghese this seems extremely fragile. any occurrence of the search string no matter where triggers that.
 
12:44 PM
Cbg
 
cabbage :)
@PM2Ring its the continueation of the yesterday's challenge?
@MisterMiyagi yep. but kevin's solution for the challenge was pretty good for the 'impossible' question :)
 
if you mean the list juggling, none of these solutions were meant for production usage.
Code golf is not appropriate to solve real problems.
 
@JoshuaVarghese Oh, ok. Yes, there is a faster way to do what you're doing. But that's irrelevant because your algorithm is wrong. Eg, it will return True on any key or value string that contains 'image', eg 'imagerelstatus'
 
well python is case sensitive?
well if its a search for 'type': 'Image' ??
 
@JoshuaVarghese Yes, it is. That's not the point. The OP wants case-sensitive detection of the key or value 'Image', not other things like 'imagerelstatus'.
 
12:52 PM
i just updated my post could you please vote to reopen it or so?stackoverflow.com/questions/61342428/…
 
@JoshuaVarghese The point is that even a very minor change in the response would trigger a false positive.
Yes, the answer works for the provided input. So does an unconditional True.
 
"'type': 'Image'" in str(x) will be better then?
 
as long as the input data never contains the character ', yes.
otherwise, Python will flip all quotes to double-quotes in the str result
 
@JoshuaVarghese You could search for the string "'Image'" in str(x), but that's still a bit fragile, since it relies on the desired string being single-quoted. If you want to know a robust way to do these things see my answers stackoverflow.com/a/47075972/4014959 & stackoverflow.com/a/52414034/4014959 Those are for stuff coming from JSON, but it should work on the OP's data, since it looks like it came from JSON.
 
1:02 PM
any(i in str(x) for i in ['"Image"',"'Image'"]) ???
 
should i add any more information to my post?
@MisterMiyagi you was right about the continue being unguarded i just edited the post so it looks like how i have on my machine now could you see it on more time ?
 
@JohnSmith I've improved the formatting a little, and fixed the tags. The code is still a bit messy, with stuff like #if in_file: but at least it's more readable now, and the unguarded continue Mr Miyagi mentioned is more obvious. Adding that data & output makes it a lot better. It doesn't need so many lines of data, but that's no big deal. So I've voted to reopen. You only need 1 more reopen vote.
@JoshuaVarghese That looks ok, but it's hard to tell looking at nested quotes in unformated code. ;)
 
1:18 PM
@JohnSmith curious, did you use some tool to give you that text file output?
 
@PM2Ring Thanks ;)
 
wokay!
 
@RoadRunner no it's just pure regex
 
@JohnSmith Ok, it's open now. You need to reply to Mr Miyagi's comment. And make that reply in the question comments. We've finished discussing that question in this room.
 
1:24 PM
alright thank you !
 
@JoshuaVarghese You can delete your comment there. It's obsolete now...
 
ok. does the closed questions get deleted?
 
@JoshuaVarghese It depends. Duplicates can be good signposts, so they aren't deleted automatically... but that might depend on their score.
You can read about it here, and in the linked questions: meta.stackexchange.com/q/122451/334566
However, there are changes coming through in the way closing works, and also deletion of closed questions. There's some info here: meta.stackoverflow.com/q/394871/4014959
 
1:44 PM
oh the auto-opening :(
 
@JoshuaVarghese As you can see, it's not a popular concept with the regulars on meta. ;)
 
I'm sceptical, but I suppose it might work ok as part of a whole change in the close / reopen / delete workflow. It's hard to know without a real-life test. And it's hard to conduct such a test fairly if the testers are already convinced it will be a flop.
 
lol, a beta site would help?
 
@JoshuaVarghese Maybe. But you need enough old-timers who are willing to work on the beta site. And you need to convince the OPs to ask on the beta site rather than the main site.
 
2:01 PM
beta sites could work like a transparent sheet on the original site. If they feel the update is not good, just , you know, strip that sheet off. Most of the apps does this
 
One idea that's been tossed around is that all questions from low rep members should start out in a closed state, and only make them visible to people with high enough rep. Once the question has been polished up, it then gets opened so it becomes visible to everyone, and it can start being answered.
 
thats good :)
 
@JoshuaVarghese I agree, although it has a few potential problems. Eg, it needs enough high rep members willing to assist in the polishing process. And it gives those high rep people an unfair advantage: they can start writing an answer while the post is still hidden, and post it moments after the question is opened, leaving the poor low rep answerers at a disadvantage.
 
@PM2Ring I think thats a good idea. What would the minimum rep be to see the questions in closed state?
 
@PM2Ring thats a big disadvantage :(
 
2:16 PM
Yeah also you need enough high rep users around to monitor those questions. Otherwise questions are going to be left in closed state for a while.
 
@RoadRunner but what PM said now is a big disadv
 
@JoshuaVarghese Yep
 
unless, answered for those are ordered in ascending order on rep
 
Maybe the question could just have 1-2 high rep users review the question before it can be submitted
Still the same problem though
 
or pass it to moderators who are less busy?
 
2:21 PM
Moderators are busy
And their job is to do what community can't
 
maybe gold badger's can edit them, but have to wait for 10 min to answer that (provided choosing an answer has to wait 1 hour)?
 
@RoadRunner Well, high enough that they've demonstrated that they understand how the site works, and what qualifies as a good question. But not too high, otherwise there aren't enough experts, and there are too many disadvantaged low rep answerers.
The close / reopen privilege comes at 3000. That's probably too high. The edit privileges comes at 2000, that might be ok, but I think 1000 or even lower, like 500 could be ok, since these people will be collaborating on polishing the question, they aren't making big decisions single-handedly.
And 500 is when we let people access review queues, which is kind of equivalent to this polishing process.
 
well authors need a reopen request previledge, if they have edited the question
 
@JoshuaVarghese first edit always puts the question into the reopen queue
That's why cosmetic edits on newly closed questions are bad
 
2:34 PM
@RoadRunner Everyone's 1st question currently goes into the First Post review queue. But yeah, it'd be better if they were reviewed before they were open to general scrutiny on the site.
 
Nothing like getting 80 hours into a project only to come to the conclusion that you need to solve the Halting Problem if you want to meet the original requirements
 
cbg, did you try the pin? @Kevin
 
@Kevin Oops. At least that gives you a good reason to throw the requirements back at the client & tell them to try again. :)
 
Knowing Kevin I give it 75% chance that the client is Kevin
 
@JoshuaVarghese If you're saying "did you see the ping I sent you?", yeah. In my opinion, you should almost never do membership testing on a dict or list or set by doing "whatever" in str(obj). Even if you can formally prove that it will never produce false positives, it runs afoul of my own personal design principles
I'd much prefer to write a longer recursive search function that I'm sure won't trip over quote marks or whatever
@AndrasDeak You win a kewpie doll
 
2:41 PM
i get it, but we'll have to do that without sacrificing speed of program, right?
 
I'm not so sure that recursive search requires a sacrifice in speed. String composition is at least O(N) w.r.t. the size of the data structure, same as a recursive search.
And search can return early if it finds the target, but string conversion never returns early
And in any case, speed is not always the highest priority when writing programs. Sometimes readability is higher.
 
k. Whats the max size of a list, (2**64) -1?
 
IMO "sometimes" being "all the time, except right after you have identified that there is a bottleneck in your code that significantly affects total runtime"
 
well you cant expect the type of the dict returned
 
I don't think there is a strict limit to list size. Whatever you can fit into process memory should work.
 
2:46 PM
@JoshuaVarghese the type of a dict returned is dict
 
I believe there is a limit to list literal size, but that's another kettle of fish
 
i meant its structure (nest)
[1]*(2**32) produces some kind of error i cant understand
 
wow calling the fucntion inside it, never knew that
i dont know anything abou isinstance()
 
I almost never use isinstance, except when exploring a data structure of unknown composition
 
2:52 PM
@JoshuaVarghese 2**63 - 1 on 64-bit I believe
Should be in sys.maxsize
 
am on 64,but uses32 bit py
 
good OOP code can and should almost always avoid using isinstance by instead employing polymorphism
I can't extend the behavior of the builtin types, so I have to swallow my distaste and use isinstance
 
@JoshuaVarghese the limit is Py_ssize_t aka sys.maxsize
 
Keep in mind that "[1] * x fails for very large values of x" doesn't necessarily mean that x is the upper limit on the size of a list. It might just mean that it's the upper limit on the size of a list that can be created with this specific approach
 
2:55 PM
the limit is 2**63 - 1 on a 64 bit system since Py_ssize_t is a signed type
 
For all we know, while True: my_list.append(1) can go up to the size of your hard drive
 
ya thats does till it produces error
 
well, even without content a list of sys.maxsize is slightly more than 8 EiB in size
It's difficult finding a system that can store that.
And being allowed to waste it all on one Python list.
 
Hmm, true. a terabyte is, what, 2^39 bytes? So it's unlikely that you could construct a list with 2^63ish elements
But it's the hardware's fault, not Python's :-)
 
2:59 PM
wow
 
@JoshuaVarghese Diagnostics tip: when discussing errors, mention the error by name where possible. "That works, until it produces MemoryError" is more useful than "That works, until it produces an error"
 
i'll be careful from next time
 
Ooh, EstimateHowManyCasesNeedManualIntervention.py is finished running. Here's hoping it's under three digits...
Pray for me, provided divine intervention can change the outcome of an event that has already happened but hasn't yet been observed
 
prayer takes time to compile :P
 
Programming is a lot like praying to a powerful legalistic being who gives you exactly what you ask for and not what you wanted
Welp, the result is in the triple digits... But I suspect that quite a few of them are false positives, and I can get the number lower still.
 
3:18 PM
@AnttiHaapala why do you say that? They all show how to get the string value of a choice in a ChoiceField. That seems like a beginning to me.
 
@Code-Apprentice "how can I install Python in my android phone": "here are some duplicates: download Python for Windows, get Python source code..."
 
@JoshuaVarghese that's recursion
 
When a method calls itself, that technique is referred to as recursion.
It is one of the more confusing programming concepts for new learners.
 
@AnttiHaapala I don't follow
 
3:33 PM
@Code-Apprentice that the problem is that given that, how do I.
 
ok
I still don't follow. The linked questions give a possible first step in getting to the solution. That is a beginning.
 
ok where can i find about that more?
like its limits
 
@JoshuaVarghese first learn about recursion, then recursion in python
 
The limits of recursion are well documented :-P
IME It's usually 999
 
hmm disregard that again :D
 
3:38 PM
Most likely you were asking about its limits in terms of what category of problems the technique is useful against. The answer being "trees, mostly"
 
@Kevin 1000
Python recursion support is bad.
 
I would much prefer an unlimited recursion depth, iff it stays responsive to ctrl-c
I get quite enough unescapable thrashing when I work with threading, I don't need any more bottomless pits to fall into
 
@Kevin will this work? dpaste.com/3BT9024 (yesterday's challenge)
its sad threading cant be stopped, it it executes a while true loop without break
 
I once tried writing a Thread subclass that would listen for keyboardinterrupts and exit at the appropriate time. IIRC I had... Mixed results
 
@JoshuaVarghese Yes. But if you turn this around (treat finding the result as the exceptional case) it is more general.
 
3:50 PM
@JoshuaVarghese Looks valid to me.
 
def finder(lis):
    try:
        return finder(lis[0])
    except TypeError:  # if indexing fails
        return lis
 
Where "valid" means "returns the correct answer for all sample inputs provided so far"
 
I was forced to get good at recursion after learning haskell
 
Additional work may be required if you want sensible answers from inputs such as [[[],1]] and [[["1.5"]]]
(The answer is allowed to be "I don't care about those inputs an never expect to encounter them")
 
4:13 PM
Nothing like changing two lines of code to see if it fixes one's program that takes 45 minutes to run
At 1:00 I'll be a genius or a fool
(outcomes not mutually exclusive)
 
my life experience has consistently taught me that I'm always simultaneousy both. I find never-before-seen ways of showing the world that I'm a fool. I can only imagine it takes some level of genius to be that foolish
 
@PaulMcG Have you seen Jinja's sandbox? It might be related, there's definitely some interesting stuff with string formatting. github.com/pallets/jinja/blob/master/src/jinja2/sandbox.py
 
00:00 - 17:0017:00 - 00:00

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