« first day (2747 days earlier)      last day (2198 days later) » 
00:00 - 18:0018:00 - 00:00

6:02 PM
but merely logging in doesn't do it :(
you need to be "active"
 
Does anyone know of a reference for writing decorators for asynchronous functions?
 
1. learn the difference between `asyncio.iscoroutine` and `asyncio.iscoroutinefunction`
2. there is no step two
 
@KevinMGranger Thanks!
 
Stop using the room as a sandbox @cᴏʟᴅsᴘᴇᴇᴅ
 
Can you believe it works here and not in the sandbox? That isn't something I could've figured out just in the sandbox
 
6:09 PM
Yes
 
6:29 PM
@Ajit honestly I don't like this use of a parameter that's just a flag, I would return true in the else block of the exception handling instead of introducing this parameter
 
if anyone can take a look and help :)
 
Welcome, Proxy! Have you read the room rules yet?
 
wim
what works here and not in the sandbox room?
 
Rawing's [mcve] userscript...
 
"Don't ask for answers to your recent Stack Overflow questions. Those who can answer are already watching the queue on the main site."
"If your question is eligible for a bounty (>= 48 hours old) and hasn't received a useful response, then you may link to it."
 
6:36 PM
(oh nice, it stopped working again)
 
wim
yeah that's the annoying thing about the python gold badge, it makes your javascript stop working
 
@KevinMGranger yeah but a long time ago so i most likely forgot them :)
 
you can remove it then :P @KevinMGranger sorry
 
6:50 PM
@MartijnPieters Meta is scary, so let's continue here :D
 
Sure, np.
I'm about to arrive at my station however :-(
I'm sure the room here is going to be interested though.
 
So my current understanding of the situation is this: The reason why you're in favor of keeping the python-2.7 tag is because it makes the question easier to discover for people who also use python 2. Okay. But wouldn't it be better to have all the answers - python 3 as well as python 2 - in the same place?
How far would you take it? Two categories, python-2 and python-3? Or should we take it further and also separate python-2.7 from python-2.x and python-3.4 from python-3.5?
 
@cᴏʟᴅsᴘᴇᴇᴅ Thanks I realised the flaw in my reasoning. Since I cannot do much about it in the first place, there is little point in even measuring it.
 
Cabbage :)
 
6:58 PM
@Aran-Fey ... regardless of whether or not they should there are still a ton of python2 projects in active developement (often huge codebases... with lots of contributors(the huge codebase makes switching to python3 less than trivial))
 
wim
$ echo "my_canned_input\n" > my_file
$ cat my_file - | python3 -m timeit -n 1 "a = input()"
1 loops, best of 3: 37.1 usec per loop
 
@cᴏʟᴅsᴘᴇᴇᴅ Maybe it depends on how you post your message? Clicking "send" vs pressing Return?
 
wim
can just write more lines in file if you want to increase the timeit runs
not impossible, but kinda stupid question in the first place.
 
@JoranBeasley Well, I'm not saying that the OP isn't allowed to ask for python 2 solutions. I'm just saying that the preference for python 2 solutions shouldn't be expressed through the question's tags.
 
in flask, how i can return the result of a query even if a join is null?, like this

tickets = Ticket.query.join(
Status, Ticket.status_id == Status.id).\
join(EmployeeA, Ticket.created_by == EmployeeA.user_id)

There are Tickets result, but if the join is NULL, the tickets get empty
 
7:01 PM
Yeah, I think that is a sign I need to take a break @wim
 
The whole point of SO is that posts are supposed to be useful to a broad audience. The python version the OP happens to be using shouldn't have a big influence on which answers can or can't be posted.
 
any yet it is
a python3 answer probably wont work for pyton2 (and vice versa)
I woul.d like to think most people are capable of figuring out the nuances and fixing it themselves .... but that has not been borne out by evidence
to follow that argument to its logical end then , shoudl any language be used or should we only be discussing ways to tackle a problem (IE i could take a c or javascript solution and implement it in python no problem)
 
Nah, that'd be silly. The differences between those languages are far too big.
But as far as python2 vs python3 is concerned, I guess it depends on the question. Some things will have the same solution in both versions, others won't
 
Usually, when I answer, I check the version tag (if it's there) and then post a solution accordingly. And I think others do the same. So, IMO the version specific tag is pretty important for both, the answers as well as users seeking solutions.
 
We're getting sidetracked though. This isn't about answers, it's about tags
The tag description literally says "Do not use this tag simply to convey the version of Python you're using, unless the question concerns an issue specific to Python 2.7. Use the more generic [python] tag."
Last time I checked, flattening a list of numbers (at least I think that's what that OP wanted) wasn't a question specifically about python 2.7
So either the tag should be removed, or the tag description should be updated
 
7:14 PM
most users dont have the ability to know that they need different print versions... so how would they know ... all they can do is mention the version they use
 
I guess that's a question for meta :P until then, (again IMO) the best possible way to edit such tags is to keep the version specific tag and add the version agnostic tag.
 
I think that in an Ideal world @Aran-Fey is totally right ... but i dont think most OP's can recognise the difference
(it doesnt help when i post super cryptic answers to unclear questions either im sure)
 
Hey guys can anyone help me out? I'm trying to understand how to open a file, but with a code that would open on a different computer, without me having to keep changing directory names
 
It's generally quite hard to open files on someone else's computer.
It sounds like you already have code that does this, but you find it inconvenient, because you have to change directories a lot to use it. Can you share that code, so we have a better idea of what you're trying to do?
 
data = pd.read_csv('C:\\Users\\Gabriel\\Documents\\GitHub\\Database\\TransUrb\\' + file_x + '.csv')
#data = pd.read_csv('C:\\Users\\danielmota\\Documents\\GitHub\\Database\\TransUrb\\' + file_x + '.csv')
I keep commenting and removing comments when I'm workinng from home and then from college
 
7:23 PM
these are not remote files?
 
Oh, so you don't need to open the file on your college computer from your home computer, or vice versa. I thought this was a networking problem.
If you only need to open your home file from your home computer, and your college file from your college computer, that's easier.
 
Perhaps you could keep a configuration file in your project, separate from your program, that defines computer-specific properties, such as the document directory.
 
user9693188
@AndrasDeak Please leave poor @BOi alone. I am TheOneWhoMade and plan on leaving you guys alone.
 
Then your program reads from that configuration file.
 
7:25 PM
@Pheo thanks, no promises though
 
The path looks the same. Minus the user name. Why not grab the username thats logged in to make the path?
 
user9693188
@AndrasDeak Your welcome. Bye.
 
yeah I already do that, there is a Database, and my code is at a different directory
 
@Pheo take care
 
@Pheo because I want it to be able to run in any computer as long as if u have the dataset
 
7:27 PM
You shouldn't have to comment/uncomment anything at all, if you use my or Zack's approach
 
wrong reply lol
I saw sometinhg like ("../database")
But never understood it
 
You should be able to use relative paths here, certainly
 
is that what they are called?
 
Yeah.
 
import os
os.getlogin()
Would be my approach. If the file path is the same
 
7:31 PM
If you're not sure how to find the relative path to your database directory, you could use the os.path.relpath method:
>>> database_path = "C:\\Users\\Gabriel\\Documents\\GitHub\\Database\\TransUrb"
>>> current_path = "C:\\Users\\Gabriel\\Documents\\GitHub\\MyCoolProject"
>>> import os
>>> os.path.relpath(database_path, current_path)
'..\\Database\\TransUrb'
This tells us that any script inside the MyCoolProject directory, can access the TransUrb directory, with the relative path '..\\Database\\TransUrb'
 
I like Kevin's relative path approach better though. Especially if the file your looking for is in the same folder structure on both computers.
 
@AndrasDeak re: other day.
 
Mm hmm I'm assuming that the folder structure is identical on both computers for all the directories that encompass the project's files
 
In Zack's approach I would have to use the result from os.getlogin() in the path right?
 
I would think so. They both look to be a github repo.
 
7:34 PM
yes they are the same repo
the difference between the computers is that one ins Win10 and the other Win8
would i matter?
it*
 
Not for the purposes of reading files
 
Shouldnt on either approach.
 
Nice thanks very much guys!
 
os.getlogin() is likely just looking at the windows environment variable %USERNAME%
 
@JoranBeasley That's the exact spot in the docu I had in mind, since I went trough it just last week =)
 
7:36 PM
I'd be inclined to use the relative path approach if you ever intend to move the project anywhere else on your computer. I like to keep my source-controlled projects in c:\programming\github. If I tried to run your project with the getlogin approach, it wouldn't be able to find c:\\users\\Kevin\\Documents\\Github, because that's not where my github directory is.
 
Absolutely your approach is better in that sense. Way easier to scale that
 
# Taste question (rule: only 80 chars per line):
def (very: str, many: str, arguments: str, in: str, this: str, func: str) \
    -> str:
# vs
def (very: str, many: str, arguments: str, in: str, this: str,
     func: str) -> str:
(ignore the lack of name for the function)
 
I like to avoid using the line continuation character \ where possible
 
@rlemon thank you! Same here and already deleted
 
he came in with two accounts today. both are deleted.
just thought I'd toss out the FYI, because apparently they troll here as well
 
7:43 PM
:| At least they made a very convincing point
Thanks, I much appreciate it :)
 
putting the argument list on two lines is a bit of a bandaid solution, in my eyes. If my function signature is real long, that's a design problem.
 
Every function signature is long with type annotations :)
 
@Kevin Same, but pep8 suggests using \ if parantheses can't be used, which is what happens here.
well, the actual one is def sort_by(self, group: str, reverse: bool=False, manipulate: bool=False) -> list: in a class - I can't really get it shorter. I really tried to, too.
 
DSM
@Arne: I've hit exactly this situation, and I prefer to see #2.
 
Well depends on whether you interpret "if parentheses can't be used" as "if you can't add more parentheses to make it work", or "if you can't add more parentheses, or make use of existing parentheses, to make it work". You already have parens, they're mandatory in every function definition.
 
7:47 PM
Burn the backslash, it only begets suffering
 
Assuming the 80 character rule largely exists for the benefit of people still using monochrome text-mode monitors from last century;

And assuming that category of people is probably still using Python 2.6, at best;

Then if you're using type annotations, that category of people can't run your code, so you shouldn't care if they can't read it, and you should ignore the 80 character rule.
 
You will laugh, but part of the code runs on 3.7
I think i'll take #2 then
 
vimdiff et al. and split screens still benefit from narrow lines
 
People with modern monitors that tile their screens with narrow vertical windows of 80 characters, are encouraged to get acquainted with the maximize button
 
@Aran-Fey This is really silly. But it activates only when I first open the tab, then close it, and then hit ctrl+z to open it again
I don't know why, but w/e
 
8:01 PM
huh.
The script only starts running once the entire page has finished loading, so that might explain it? Maybe?
 
so the page never completely loads when I actually open it?
I have to close, and then reopen it again
what is being done differently through the ctrl+z that is not otherwise done?
 
is ctrl+z safari for ctrl+shift+T?
 
*shrug* idunno either, it was just an idea. I know that Firefox for example loads the page from cache and doesn't do a complete reload, so it's possible (albeit not probable) that it makes some kind of difference
 
that reminds me, I should go decimate my 947 tabs
it would do wonders for my RAM :|
I'll probably run out of delvotes
 
are you going to literally close one tenth of them?
 
8:08 PM
wellactually, 9/10 :P
 
The reverse-decimate!
@Kevin I couldn't put parantheseses anywhere around the -> ret_type: part and have it be valid, which is the problem in this case. Oh well, more fodder for my 100-char-per-line-pls lobbying.
 
you shouldn't need to?
 
put parantheses or do lobbying?
 
I think Kevin(non-MG)'s point was that the "split inside parens" rule can be applied to your case, even though the overfull part is not inside parentheses, i.e. #2 is pepeighty
 
oop
 
8:21 PM
a true classic
 
spot the vim user
 
where??
 
but yeah, I guess excessive typing just makes signatures look bad and I have to live with that =/
 
excessive typing makes keyboards break
 
This is why you could declare the names on one line and then types on another in K&R C, but noooo, that was weird...
 
8:24 PM
=|
@KevinMGranger K&R C?
 
K&R C also did about as much ahead-of-time type checking as python
 
Meh, 11th degree polynomial not "that" special (actually the rounding wouldn't ever be required as a 11-degree polynomial can always fit exactly through 11 points).
 
@paul23 but it is a little overkill for Hello, World
rounding might be necessary because floating point math
 
You could use scipy's fitting algorithm to make any polynomial (or any mathematical series) for any string :P.
 
8:37 PM
In real number math, the 11-degree polynomial probably gives exact integer values for the domain, but float != real
 
Wasn't python adaptive in that it tries to use fractions for math?
 
if it tries it isn't trying hard enough
 
are you thinking of Decimal ?
 
@KevinMGranger nah I was confused with "bigint"
 
9:16 PM
cabbage
user image
5
 
cabbage
 
Our government might fall soon :D
 
eeh, just found a post where a high-rep user posted a shorter answer than mine with no additional info 45 minutes later, and somehow they ended up getting a 100 rep bounty for it :|
 
sometimes shorter = easier to understand
 
9:27 PM
I smell a meta post
 
cbg ppl
i am trying to print and replace text in same line from PyCharm console.
print('text' , end='\r') goes to next line
i am on windows 10 , python 3.6.5
even print('text', flush = True) dint do the trick
text
text
text
text
like this
or texttexttext...
tried on IDLE and CMD console too
 
9:43 PM
@RobertGrant you're confusing me with someone else
 
geez. I thought django-reversion would be nice. It's not.
Their documentation is a little too long to get a jumpstart on, and I find myself tripping over everything
 
I don't think I can repro on linux
 
"print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream."
i dont know whats wrong.
I saw one question like this yesterday
today i am trying a countdown timer
so i need to flush out that print o/p on console.
 
how about leaving end='' and starting each new message with '\r'?
 
:42256229 you mean for i in range(0,4) : print('\rtext', end='')?
still the same
and when i print('\r\r') i see two line o/p
carriage return is fine right?
its flush thats not working?
 
10:06 PM
However the below code kinda works on CMD console.
for i in range(0,100):
    print(str(i), end='')
    os.system('cls')
 
I think this has come up before, and it turns out PyCharm is doing something funky
 
yeah.may be
same thing on IDLE though , so I dont know if I can blame PyCharm alone
rbrb folks.
pls let me know if you guys have solution for print with flush
 
10:23 PM
@MooingRawr you need a sticky note for that?
 
10:36 PM
look at those timestamps:
umpteenth variable variables dupe stackoverflow.com/questions/47657807/…
 
Question:"Gatorade or water" ? Oops.... I mean should I use "four spaces or tab"?
 
Man, tabs seem quicker though....
 
if you're using a proper editor you can customize it to include 4 spaces when you press tab
 
10:52 PM
Ha Oh, I'll check it out.... It may already be doing it actually now that you mention that!! It's always the simple things!!
 
I really wish elastic tabstops were a thing
 
@Aran-Fey Congrats on the gold badge, happy you can hammer now!
 
@Aran-Fey it's the Fully Correct™ solution and thus won't be adopted by anyone
 
Thanks! I just wish people would tag their questions properly... half of the time the hammer doesn't do anything
 
@Aran-Fey that's when you ask for a retag here
 
11:02 PM
I think y'all would get tired of my constant retag-pls spam real soon :p
 
maybe :P
I can't speak for the others but I wouldn't mind much, and even if it became excessive we could just trash the obsolete ones
 
@KevinMGranger I think most people just don't care enough to even consider the possibility that something better than regular ol' tabs might exist :/
I'm still evaluating my options - I optimistically thought that if I edited the tags and cast the first dupe vote, surely another gold badger would come along and hammer it. So far, it hasn't worked out that way. But I'll keep trying for a little longer before I start asking for retags
 
Just make a duplicate account and also get a gold badge o that :P
 
I don't need two badges, I just need edit privileges. How much rep is that?
 
11:09 PM
2k but that would be abuse
whatever you can't do with your own account is abuse
 
it's not like I was seriously considering it :p
tag hierarchies would be nice... I'll go upvote all the meta posts from 5 years ago in a vain attempt to convince the SO devs to implement it
 
visited 2000 times... but only 6 upvotes on the answer. Not sure if that means it's helpful or unhelpful...
 
That thing got three stars as well.
 
some askers favourite their own posts stackoverflow.com/users/2627569/sara?tab=favorites
 
11:24 PM
Yeah I used to (long ago)... but what about the other two
 
OK, managed to get below 300 tabs, to be continued tomorrow :D
 
...you're trying to tell me that 900-something number wasn't exaggerated?
 
@Aran-Fey if your hammer itches there's a bot over in SOBotics which listens to dupe comments and can ping you depending on tags
@Aran-Fey it was exact
closed 129 SO tabs so far (includes chat and profiles and meta too)
 
11:41 PM
@AndrasDeak browser tabs?
 
yup
started from 947 altogether
 
That's all?
How do you have enough ram for that many? 20 bog my machine down
 
most of them are never loaded
 
In other news, it's the 25th anniversary of Mosaic
 
I made a program to open new tabs, that must have opened hundreds. Particularly as I could not stop the thing...
 
11:49 PM
new firefox handles a bunch of inactive tabs very well
it only takes 6 of my 8 GB of memory :P
 
Lucky you. My old PC crashes for the privilege of starting the browser before the machine has had time to cool down.
Lucky I scrapped the thing. it sounded like something really powerful once it got going...
 
Welp, broke my thumb earlier today and typing is hell. Work is gonna suck for the next month :<
 
@Simon Like a John Deere tractor?
@chrisz ouch, that sounds awful
hope you get well soon
 
Honestly doesn't hurt that bad, just the cast is impossible to type in lol
 
Good thing we live in the future youtube.com/watch?v=uyV0IVItlM4
 
11:58 PM
Possibly a tractor might be a little louder
 
rhubarb
 
00:00 - 18:0018:00 - 00:00

« first day (2747 days earlier)      last day (2198 days later) »