« first day (1556 days earlier)      last day (3385 days later) » 

12:12 AM
You could get all the results then use a dict comprehension to parse them as you want.
 
 
4 hours later…
Dan
4:16 AM
cbg
 
cbg @Dan
 
Dan
@MattDMo how r ya?
 
not too shabby - yourself?
 
Dan
4:45 AM
@MattDMo sorry for dropping off the planet, I'm doing alright
 
5:21 AM
http://stackoverflow.com/questions/28018140/python-delete-item-in-a-‌​list-within-a-list/28018186#28018140
 
6:11 AM
from __future__ import braces
 
not a chance ;)
 
cvd
that adam smith question
just another exmaple of "I have code that works for this example, how to fix it".
@AdamSmith ah your edit is wrong :d
 
Cbg
 
6:40 AM
cbg
 
7:07 AM
no one up?
 
7:17 AM
Up to what? :p
 
coool
 
i need an answer and it seems so simple.
i am in x folder and i have a python file here. i have a folder which is child of current folder and i have to import that file.
assume child folder name is child.
i tried import child.loggers and i tried sys.path.append("path/to/child") and import loggers
its not working
 
from child import loggers?
 
after appending to sys path?
 
7:22 AM
Dunno. Yeah, why not
 
yeah, that should work
 
I'm more saying AFAIK import child.loggers isn't valid syntax
 
from talogging import loggers
ImportError: No module named talogging
 
Maybe stick an ____init____.py in your child folder
 
Did you put __init__.py there?
 
7:23 AM
that would be underscore underscore init underscore underscore dot py
 
You'll also need __init__.py in your x folder
 
why is that?
 
It's implicit Python magic
Basically it's a magic file name that turns a folder into a Python module
You need it as well as the sys.path thing, unfortunately
 
just checked
i have a init.py file already there
 
With the underscores?
 
7:26 AM
yes yes
 
Oh yeah, I see the bolded init :)
 
and this same code works on some other machine
weird..
different python version?
 
Nah that shouldn't matter
 
Are you sure you need the entry in sys.path to make it work?
 
well this exact same code works on some other machine
 
7:30 AM
anyway, sorry, I'm not an expert at Python's import system
 
thanks for trying anyways
well it worked
just changed the version from 2.5 to 2.7
and instead of running file from different folder, ran code from same folder
 
Yeah the import system seems like deep magic
 
Cbg
 
cbg folks!
 
what is cbg?
 
7:44 AM
@Ffisegydd cbg
 
@AjGauravdeep sopython.com/salad
 
haha, nice.
 
cel
 
one question guys
 
cel
@AjGauravdeep just ask :)
 
looking for a place to copy past the crazy output
too bug for here
 
cel
Best thing would be to narrow the output down to the important parts, so that it fits into the question.
 
2015-01-19 00:18:27.051 Python[28226:1718748] -[__NSCFString objCType]: unrecognized selector sent to instance 0x7f959641d110
2015-01-19 00:18:27.235 Python[28226:1718748] *** ObjC exception 'NSInvalidArgumentException' (reason: '-[__NSCFString objCType]: unrecognized selector sent to instance 0x7f959641d110') discarded
 
cel
Yea, that may be fine. Just add it to your question. It's hard to help here, without knowing the context.
 
- (id)initWithEcid:(NSNumber *)\
thats the function definition
.initWithEcid("3118376226067")
i am calling it with somewhat like this
 
Cabbage!
@AjGauravdeep That looks like some ObjectiveC/Apple stuff to me. Don’t think it’s really relevant to Python.
@inspectorG4dget You around?
 
but that function is python function
umm..
 
8:42 AM
- (id)initWithEcid:(NSNumber *)` vs. .initWithEcid("3118376226067")` – I’m no ObjectiveC expert (I really don’t want to :P) but it looks as if you’re passing a string instead of a number.
So you probably want to do .initWithEcid(3118376226067) instead.
 
poke... it works... awesome..
 
:)
 
9:07 AM
Cbg
 
Cabbage
 
9:48 AM
cbg
 
10:03 AM
cbg
 
10:18 AM
cbg
Damn, a cbg streak and I am about to break it.
I am thinking of adding stackoverflow.com/questions/28021409/… to the canon.
It is one of the rare cases where using a tab won't raise an error in Python 3 and is not caught by running python -tt either.
I've written a comprehensive answer there. Unless someone knows of a better dupe, I'll add it to sopython.com/canon/
 
@MartijnPieters Sounds good to me.
Maybe -t should have an option to detect mixed tab & space indentation usage through the whole script, not just on a per line basis... but I guess that would slow things down a bit.
 
10:40 AM
@PM2Ring It doesn't work that way though. Python fills out tabs to the next multiple of 8, so if you use 3 spaces, then a tab, you indented to column 8. That is detectable just fine.
You can use 4 spaces for one level, a tab for the next, and a tab and 4 spaces for the next, etc. perfectly legally. People often did.
That kind of use is almost indistinguishable from the use here.
But I am surprised tabnanny cannot be configured to be dictatorial about only tabs or only spaces for indentation, or that no indentation level is ever expressed as both tabs and spaces on different lines. That should be perfectly detectable.
 
10:55 AM
Tab being 8 spaces? Never knew that- seems crazy big
 
@MartijnPieters Understood. I guess the most problematic case is the that no indentation level is ever expressed as both tabs and spaces on different lines. And as you say, that shouldn't be too hard for a parser to detect.
@RobertGrant Tab stops being every 8 spaces is an ancient convention.
Old mechanical typewriters let you set tab stops on whatever column you wanted. And some early electro-mechanical / electronic systems let you do that too, but every 8 columns was the standard default if you didn't set up custom tab stops.
Hell, for all I know there are software terminal emulators that support custom tab stops, too. :)
 
cbg(all)
 
actually used to have (and have reason to consult) a paper VT220 manual
 
11:06 AM
is there a better option to scan for folders in a folder than using os.walk?
(I don't need recursion, only one a level scan)
 
@Zero you working through the night?
@Peter isn't there something like os.listdir?
 
yeah.. :)
 
@Ffisegydd Well, technically it's 08:07 right now.
 
@ZeroPiraeus Ta! I knew I'd read that somewhere. :)
 
at the same moment I asked I found that one :)
 
11:09 AM
@Zero nice :P
 
FWIW, in ancient times, I knew how to set tab stops on one of these babies, using the program drum.
@PeterVaro os.walk is nice, but it's generally overkill; I use os.listdir_far_ more frequently.
 
yepp.. although I have to manually filter for dirs
 
@RobertGrant I had a discussion with someone on SO about tabs vs. spaces (yay) once and he was surprised that all my things used four tabs by default since he only knows 8 and didn’t consider 4 normal…
 
@PeterVaro In the future, that will be somewhat more performant (doesn't help you now, I know, but still).
 
@PeterVaro yes, os.walk() does exactly that under the covers, filter the os.listdir() result.
 
11:18 AM
all righty, thanks guys :)
 
@MartijnPieters While I think it’s a good canonical answer for this problem, I don’t think the question itself is a good way to identify the problem. But it’s difficult to have one, so I don’t know.
 
@poke It is very difficult to identify the problem.
And in most cases it isn't as subtle as it is here even.
 
Yeah, I remember that one question where there was some unicode character that resulted in a different variable name…
 
I don't know how to alter the question to make it easier to identify. But putting it in the canon at least gives us a keyword to look for.
 
Found it – that was super fun.
@ZeroPiraeus “similar to pathlib.Path.is_dir() , but the return value is cached on the DirEntry object; doesn't require a system call in most cases;” – so the value is pre-filled already and doesn’t need a syscall?
@Martijn that’s true; and I don’t have any suggestion on how to make it clearer either.. :/
 
11:23 AM
@PeterVaro: if you are using Python 3.4 you can use pathlib; dirs = [d for d in Path('some/dir').iterdir() if d.is_dir()].
 
@poke Didn't reread the whole PEP just now, but IIRC from the python-dev discussion it's cached from the OS-level stat calls.
 
@MartijnPieters ofc I'm using 3.4 -- thanks for the headsup
 
@ZeroPiraeus That sounds good. Otherwise it would have been the same :P
 
@MartijnPieters suggested title: "Why does my return act like it's more indented than it is?" Not perfect but at least mentions indentation.
 
@Martijn I changed the title, this might make it better
 
11:26 AM
@poke ah, yours is better :-)
 
@Zero I made it a bit more generic now :P
 
@MartijnPieters ahh.. this is wonderful, and I can do d.name to get the actual bare folder name
nice :)
 
@poke thanks, that is indeed an improvement.
 
@poke @PM2Ring thanks for the insight :) makes sense to me, except that it's still in the Python spec :)
 
@poke Oh the joys of Unicode. Next up: NFD vs. NFC forms.
 
11:33 AM
That actually wasn’t the question I was referring to… but I can’t find the one I mean ^^
In question I was looking for, OP had two variables and one was written with another character that looked the same, so it was two different variables…
I wonder if it was deleted without me noticing :(
I hate when that happens.
 
@poke Python 3 then. I think I've seen something along those lines.
Like using a Cyrillic character that looks just like the ASCII character.
 
Oh! Found it!
The question title was just bad: stackoverflow.com/questions/14056875/…
 
Yeah, same thing :P
 
11:42 AM
Mine was an A though
Or wait.
 
Wow.
Thank you for pointing out a mistake in two year-old answer xD
 
@poke you had two in there, the o and the a.
 
Or wait. Wasn’t that wrong. I just linked to the A from the val and ignored the o in total :P Good enough, no need to fix that.
 
>>> '''\
... total = 0
... for val in range(5):
...     vаl = val * val
...     tоtal = total + val
...
... print(tоtal)
... '''
'total = 0\nfor val in range(5):\n    vаl = val * val\n    tоtal = total + val\n\nprint(tоtal)\n'
>>> ascii(_)
"'total = 0\\nfor val in range(5):\\n    v\\u0430l = val * val\\n    t\\u043etal = total + val\\n\\nprint(t\\u043etal)\\n'"
 
11:44 AM
@MartijnPieters TIL ascii… xD
 
U+0430 and U+043E
 
Both are closed -.-
 
Kids these days... writing a number to words converter is an excellent exercise for new programmers. IMHO.
Mind you, I've never done it in Python. But I'm sure it's somewhat easier than doing it in C.
 
Hey I'm getting heavily downvoted on this stackoverflow.com/a/28024380/4099593 ... Anybody knows why?
 
12:21 PM
More non-answers to delete: stackoverflow.com/users/4469927/jack
 
Done
 
@BhargavRao Didn't vote, but what's with the extra spaces in there?
'{} \n' instead of '{}\n'?
 
@Martijn poor Jack is going to think, you, jonrsharpe and I are bullying him :p
 
Aha .. Eagle eyes ...
edited
 
@BhargavRao ahhh - no they're ninja eyes - eagles are jealous of them :)
 
12:23 PM
Yeah..
But why don't people comment before downvoting?
 
Some do - some don't
 
Better add a comment there also
0
Q: How To Deploy: Installing Mezzanine Theme

sddHow to install Mezzanine Theme exactly, step-by-step? E.g., Moderna free theme.

What is he up to?
 
Yeah that's an annoying question. Voted.
 
Looks like he's trying to do a reference post...
heya @Rob
 
@BhargavRao a self-answer, but the question is not up to standard.
 
12:37 PM
@JonClements wotcher
 
Have you just been possessed by @Zero? :p
 
heya @aberna
 
@MartijnPieters I guess he forgot that the hat season is over
 
@JonClements I don't always use that greeting ... but when I do, I spell it right ;-)
 
12:42 PM
@ZeroPiraeus Sorry :(
 
Let the hyperlink battle commence! :)
 
@RobertGrant -1, no meme reference :-P
 
@ZeroPiraeus ah, this is beyond me then
 
Okay then... in Mortal Kombat style... @Zero FINISH HIM!!!
 
12:48 PM
C-C-C-C-C-COMBO BR-oh. Wrong again.
 
12:59 PM
Thanks all of you people, im new to programming. my question may be dumb, but i learnt something,.. i also would really like to know whats the exact reason to get down voted, and at the same time getting pretty polite responses with various answers with explanation too. — arvindh 2 mins ago
 
Replied
 
Feelin sad for him
 
Umm... better than being rick-rolled - thanks my "friend" for sending me that link :(
 
@JonClements I think the real opposite of .rstrip() would be something like this:
def not_rstrip (str):
    import random
    while True:
        str += random.choice(' \t\n\r')
    return str
 
that's just evil :)
 
1:08 PM
The question stackoverflow.com/questions/28024595/… should be spam .... The guy is propagating about what he has done I guess
 
Hey, I’m just going by the definition of rstrip which removes any number of whitespaces at the end of the string :P
@BhargavRao How is that spam? It’s a very good answer to a bad question.
 
Can you imagine Python and the opposite of lstrip? str = random.choice(' \t\n\r') + str
(I kid)
 
@poke He has answered it himself.... I guess he has done that project and wants all of us to visit it ..
 
Yeah I've done that before. Partly so I can find it again :)
 
@BhargavRao Visit what?
 
1:10 PM
@poke You forgot the non-breaking space \x0a, and you need to add a random number of characters for it to be useful, rather than make it an infinite loop. :-P
 
Oh noes.
 
@poke Visit all of his links
 
@MartijnPieters Don’t take out all the fun by making it useful now.
 
@BhargavRao That is not spam.
It is a self-answer. The question is just.. bad.
 
1:12 PM
Yeah.. It is not spam
 
All my questions are self-answered.
 
But advertisement
 
How is it an advertisement? What does it promote?
 
It’s not an advertisement?
 
Those links which he has added ... I clicked on each of them .... So felt that others would have done the same
 
1:14 PM
PythonAnywhere is a well known hoster, linking to askubuntu SE very likely isn’t any advertisement, so all that’s left is the theme, but it#s only being used as an example. And it’s from an independent designer.
 
Is there something like djanog ?? Or is it a typo
 
Typo
 
Djanog is the web framework used by the Elder Gods and their High Priest, Cthulhu.
 
@BhargavRao It's a Python-based Web framework for dyslexic people.
 
Most probably
 
1:19 PM
@poke I bumped into the owner of PythonAnywhere when I was working on the Python Job Board... we had a small discussion about his services offering something similar to what that Sphere thing does
 
@Jon And? ^^
 
@poke we had a chat about a proposed API, then I forgot about it, and I presume he did as well :)
 
lol
Good job :P
 
What can I say... I'm a professional!? :p
 
Okay, this is funny. Earlier today, my side-buttons of my mousewheel stopped working in Firefox (I switch tabs with it). Then just now, the wheel stopped working completely. A reboot later, it works again.
 
1:25 PM
Probably a bit late to "out of the blue" re-establish that discussion - at the time I thought, it'd solve our "running code" inside RABBIT
 
Wow, pythonanywhere is free for development?
Will have to look at that
@JonClements what's sphere?
 
@Robert a similar service for running Python code.
 
guys i want ask
about django in tango with django
 
@RobertGrant It’s what ideone.com uses
 
Nice, in-browser SSH terminal
 
1:29 PM
@icemelt if you have a question, just ask.
 
this code is about user loggin
def some_view(request):
if not request.user.is_authenticated():
return HttpResponse("You are logged in.")
else:
return HttpResponse("You are not logged in.")

what i confuse is why he use "if not"
 
Ah okay, looks as though it was made by ideone
 
@icemelt you've got that backwards
Get rid of the not
Oh, that's what you're saying.
 
what do you mean with i've got the backwards??
is that code wrong?
 
1:31 PM
yeah, it’s wrong
 
@icemelt get rid of the not
 
oh silly me i thought it's wrong too
so i should contact the author right?
 
Unless being authenticated suddenly means that you are not logged in…
 
I've no idea what that code's used for. Let's say yes :)
 
1:32 PM
cbg @AnttiHaapala
 
@icewelt Well spotted though. Seeing issues with other’s code is the best proof that you understand what’s going on :)
 
@RobertGrant I was using in browser terminal 15 yrs ago, though it was a java applet.
 
Guys what is the attribute to maximize tkinter window? root.attributes('-fullscreen', True) makes it full screen. I want it to be maximized only
 
@RobertGrant probably last millennium :D
@BhargavRao zoomed?
5
Q: tkinter python maximize window

Rasmus Damgaard NielsenI want to initialize a window as maximized, but I can't find out how to do it. I'm using python 3.3 and Tkinter 8.6 on windows 7. I guess the answer is just here: http://www.tcl.tk/man/tcl/TkCmd/wm.htm#m8 but I have no idea how to input it into my python script Besides, I need to get the width a...

 
@AnttiHaapala Yeah .. It's workin cool Thanks
 
1:37 PM
@poke @RobertGrant thanks for the reponse guys
 
Downstairs is noisy today
 
Oh, you have your friends over?
 
yes... be nice if they weren't quite so "talkative" :)
 
@icemelt sure
@AnttiHaapala no, sure, but it's much nicer than using Heroku, especially on a corporate network
 
Okay... soundbar with music with a good bass seems to drown them out...
 
1:46 PM
Bloody puppy muscling in on my territory!
This is how wars begin. I'm going to have to go start brushing up on itertools now.
 
Oh beep - itertools is easier than numpy as well - cowers in the corner
 
I was half way through writing it as well. I'll live though, as long as Martijn doesn't start answering too many.
I think fjarri's point was "You can use a list, it just won't do what you think it will do." because in your answer you say "You can't use a list"
 
Ahh... I'll elaborate
 
@JonClements The white dog at the back left looks possessed; see those eyes? :-P
 
1:55 PM
I forgot to turn the flash off
 
@JonClements Where is your evil twin?
 
@BhargavRao ahh... so I'm the good twin then? :p
 
face falls off revealing circuitry
 
@JonClements Not yet sure ...
You took the coin away
 
Only because the evil one would have done and then used it for his own evil purposes...
It was much safer for the entire planet that it be in my stomach
 
1:57 PM
pushes face back into place
@JonClements that's the best no diet excuse yet
 

« first day (1556 days earlier)      last day (3385 days later) »