« first day (2108 days earlier)      last day (3064 days later) » 

03:47
Quick question. range(0, 24) outputs as expected. However I want two decimals to show up at all times, IE 00, 01, 02 etc. How can I do that?
for i in range(0,24):
    print('{:02}'.format(i))
@Harv give that a try
Aha, thank you!
Yessir, that works @edwinksl
awesome
 
2 hours later…
05:55
wat
someone edited the bytestrings vs unicode strings
it now says "single byte strings"
in my thinking 'a' is a single byte string, and 'aa' is not
DSM
DSM
Are we talking about (single byte) strings or single (byte strings)?
06:07
it is a bytestring exactly because bytestrings consists of bytes and unicode strings do not consist of bytes.
they are a string of unicode codepoints
or if you say that "unicode codepoints are encoded to bytes too", then we should start calling everything bytes
DSM
DSM
It's the "'a' is a single byte string, and 'aa' is not" bit which is puzzling me. It's 2 AM in my time zone, though, so I'm probably just missing the point.
06:27
Cabbage
I agree that there is some ambiguity. b'aa' is a single-byte string containing two bytes.
@clickhere The last two lines are redundant: you already have the image file data in output. But if you want to read from output as a file (as opposed to getting its contents via .getvalue) you need to "rewind" it back to the beginning. You do that using the standard .seek method of files (and file-like objects), i.e., output.seek(0)
06:42
@PM2Ring well, there are single-byte character sets and multibyte character sets
of these, you get byte strings that consist of single-byte characters and byte strings that consist of multi-byte characters
there is no such thing as a single-byte string
especially opposed to unicode as some "multi-byte string"
excepting that single-byte string means one-byte string, as 8-bit byte means that that byte consists of exactly 8 bits.
semantics yes, but someone got 2 rep points for that edit
also
now there's an edit war, since
someone has specified that the docs should write
print(42)
# Output: 42
instead of
>>> print(42)
42
DSM
DSM
I've been mercifully absent from the whole docs thing.
someone set up the standard in private beta :D
"need to ease copy-pasting"
DSM
DSM
So far it seems to be a complete fiasco, with the Powers That Be explaining "hey, it's only just started, so trust us that the obvious fundamental problems will be quickly fixed".
I cannot find the edit that changed bytestrings to single byte strings
@AnttiHaapala I must admit that I prefer the # Output: 42 form, especially for longer snippets as it is easier to copy & paste. But the >>> print(42) form is good when you're illustrating something interactive, or when you're explicitly discussing the behaviour of the REPL.
06:55
exactly
but they're changing
>>> type(b'123')
<type 'bytes'>
to the latter
and adding print statements all over...
that is not how the python 3 documentation does it.
it specifically uses both forms, but whenever there is something to be demonstrated about the return values, it uses the interactive prompt style
As an alternative to from __future__ import division, one can use the normal division symbol / but making make sure that at least one of the operands is a float by any of:

adding decimal point 2.
adding decimal point and zero 2.0
casting using the float function float(2)
multiplying by 1 as float 2 * 1.
I'd rather take this shit out altogether.
there's no reason to not use from __future__ import division anywhere.
except if you copypaste shitty code that you do not understand.
FFS.
so there is one sane advice: multiplying by 1.
then 3 pretty bad advice
6
A: Documentation Has Entered Public Beta

Mark HurdI downvoted an example with syntactically incorrect code, and it asked me why, but only offered radio buttons. Then I saw I could "request improvement", where I could actually provide a reason why it was wrong. After I typed in the reason and clicked "Request Example Improvement", it then said I...

07:23
@AnttiHaapala No one mentioned using operator.truediv then? :p
@JonClements no.
but ... who in their right mind continues to teach to cast to float... that is not going to make code Python 3 compatible
When... guess it's still handy to know for cases where future import will break code that's dependent on the behaviour of integer division...
Fair point, Jon. OTOH, code that uses a / b when it should have a // b is bad code; the docs have been telling us to use a // b for integer division for ages; IIRC, since 2.2 or maybe 2.1.
Ideally people really should pay attention - but they haven't. We have to live with the reality :)
@PM2Ring 2.2
people crying that "Python 3 broke the division operator"
07:48
"No, Python 3 repaired the division operator". And even though I only recently switched to Python 3 I've been mindful of the pitfalls of Python 2 division ever since I read those docs way back in 2.2.
I must confess that some of my old code does use a float cast when I want float division, but generally it uses multiplying by 1., since it's pretty obvious that that's more efficient than a function call. But I've never (intentionally) used / for integer division, although I have done it a few times by accident. :)
As you probably all know, I'm not a Windows user, so I generally don't like to answer Windows-based questions. But I'm wondering: is my link in the comments an adequate dupe target? stackoverflow.com/questions/38549695/…
Oh delicious. More docs drama? :P
There's a good side-effect of Docs: it's reduced the presence of repwhores on SO Q&A a bit. Or maybe that's just because it's the weekend...
08:12
that could've been ok in programmers though :D
but the question was just bad :d
08:38
hi guys do you know kivy?
I have a small question
<MenuScreen>:
BoxLayout:
Button:
text: "Endless Run"
on_press: self.endless_mode
when I say self it refer to Button but I want it to refer MenuScreen
how can I do it
@ihsancemil RTD kivy.org/docs/…
root.endless_mode
(I don't know, I just googled for you)
when ı press button, it doesnt raise error anymore however it doesnt work either :))
...
since self.endless_mode I guess doens't do anything as such
it just do print "foo" for now
wat
dsajadssadsfd
in Documentation Public Beta, 23 secs ago, by Quill
@AnttiHaapala Documentation ain't for writing tutorials covering everything. Expecting some level of progress is normal
08:54
The whole thing is a mess.
I am about to ignore that Quill altogether
twitter: "17yr old developer, good at JavaScript, getting better at C#."
I've spoken to him a bit about various topics and he's very opinionated about the whole docs thing, but I'm not sure how well his opinions match with what the actual truth should be.
that feeling when ppl half my age tell me what is the proper thing to do.
but I remember, when I was 17, I did know everything already.
Yeah of course :P
@Antti whatever, ignore them. If it's good enough for the real Python docs then it's good enough for the SO rip off.
(Installation instructions I mean)
I haven't even read the SODocs tour page yet. I'm waiting for things to settle down a bit first. I don't want to learn stuff that may be obsolete in a little while.
09:10
7
Q: We should be more watchful of 0-activity spam users

Jeff MercadoToday I was running some data queries in the data explorer and ran across some interesting user profiles. In particular, I was looking to see whom of those who states their location said San Diego (where I live). http://data.stackexchange.com/stackoverflow/query/516379 LockTechs San Diego Per...

HOHO :D
09:37
cabbage
and hooray for high-rep javascript users approving stuff in docs with 2 yamming score in the tag
boo no docs comment onebox
> Not to step on your toes or anything, but don't you think that 2 score in [matplotlib] should make someone more wary of approving things in docs? I could make the same argument about adding to docs; but I actually have technical objections: how do you plan to set up the "syntax" and "parameters" sections for every kind of basic plot? And I mean plot, scatter, bar, hist, quiver, ... -- Andras Deak
and now I can't reject because I want them to read the comment first:P
maybe I should go approve all sorts of shit in javascript:)
> @AndrasDeak I haven't gone around answering questions on SO, but i've been using matplotlib extensively for several months, and believe i have at least basic knowledge -- enough for starting to write some docs. -- Scimonster
so yeah, I should go approve things in javascript
09:57
oh wait I can reject now!
Did anyone here read the book "Violent Python"? I just got it out of the library.
shit, need one more to reject
10:13
What do You Think about Capitalizing Words like this in the Documentation Example Titles?
Especially in the kinds of "Print Function and Getattr Operator"
baaaaaah
Reject All The Things!
Oh the joys of writing documentation without a decent styleguide.
And without a styleguide, each tag will develop their own, and the whole thing will be an incoherent mess.
Followed by endless wars over minutiae in perceived style guide application.
@MartijnPieters except not even "each tag will develop their own"
every topic will, at best, but I'm even sceptical about that:/
@AndrasDeak they all start with one: whatever the first editor used.
But yeah, each topic can easily fragment.
Lets bicker now over the scope of the problem! :-D
10:33
:D
@MartijnPieters docs has been the constant source of my grump, and this with me not wanting to have anything to do with it
(of course it dragged me in regardless)
and why can't we "improve edit"?:(
now I have to instruct the editor in comments before approving
crappy mccrapface
I'll direct you to the second starred post in the sidebar here :-)
well most has been said already:D
and I don't want to deface the sopython site;)
OK maybe improve edit is missing, let me check
OK it's missing
@AnttiHaapala Incorrect capitalization of terms is insane (unless it's a case-insensitive language, which few languages are these days). Kill it with fire.
ha-ha, very funny, @Ffisegydd, "feel free to edit sopython" :P
(the docs page not in wiki mode)
@AndrasDeak are you not on the editors list?
10:42
@AndrasDeak There is an edit button there for me.
I'm not in any list, I'm a green bean:(
Just a sec son
I've logged in to sopython for the first time
Where do I find user ids to add?
@Andras try now, might need to refresh.
10:43
ah, SO user ids.
@Ffisegydd Thank you, guv'nor
You're on the "Editors" list so you can add/edit/delete/whatever but can't add new users.
perfect
the fewer privileges I have, the better
Agreed.
Last time physicists were given any real responsibility America invented the nuclear bomb.
I'd love to say "I had nothing to do with that" but there was a surprisingly large number of Hungarians around
I made an edit! \o/
Let me know if it doesn't make any sense. Or, you know, edit it.
bah, "changes requests"
you saw nothing
10:54
I saw nothing.
These are not the typos you're looking for.
I like it how sopython (markdown?) turns -- to an en-dash
No idea what engine we use for the md.
Hoedown?:D
SOpythons before hoedowns
It could be that inflection does the transformation though, don't know, didn't study the source code only the requirements.txt file just now ;-)
11:03
I did that too, but it didn't help me much as I haven't heard of half the stuff that's in there:P
prolly not, looking at the inflection docs.
@MartijnPieters that "everything should be copypasteable" that someone (AH?) specified there is really counter-productive
I'd rather write
>>> 'abc'.upper()
'ABC'
but it always gets corrected to something like
print('abc'.upper())
# Output: ABC

so that it can be "copy-pasted" easily
I'd be happy with:
'abc'.upper()
# Output: ABC
The use of print everywhere is just fluff.
11:08
I've only seen that one ^ in numpy and matplotlib
printing everything should be insanely distracting
and I'm sure a lot of people would not be able to use those examples, since they'd copy the print too:D
I've seen people being distracted by dummy data setups in examples
although this might be more of a pro than a con, depending on your stance on spoon-feeding stupid people:P
@Ffisegydd but it doesn't "output" anything.
it returns that value.
Fine then, have # Returns:
it should be # returns: ABC
but you can copy-paste into IPython, and
these are not complete examples, just to show the behaviour of something.
@AndrasDeak someone else :D
not Antti Haapala.
11:13
oooh OK:D
it is different to comment something that needs to be a runnable example, but to show the return value of oneliner, then ...
instead there should be guidance that tells that "Get IPython, paste stuff with >>> like this."
ah or this :
I think there's a meta discussion about the python examples btw, if you want to shout at people.
click >>> on the numpy docs.
it doesn't say anything about not using >>>
Yeah that, I hadn't actually read it though.
21
Q: Should I prefix example Python code with ">>>" to indicate running in the interpreter?

Sebastian WoznyI'm often providing example code for my answers, which I tend to test in IDLE. I usually create a new file with IDLE, writing the code that is required, and then hit F5 to execute that file in the Python interpreter. I then get the output on the interpreter, so I can put proof that the code is ...

or this ^
11:16
It's one guy that started going through and doing the # outputs crap though.
which says "Use >>> and ..., unless it is meant to be copy-pasted"
it is because the Meta topic there says "do that"
I should submit a feature request to have SO docs simply link to the official ones in case those are high-quality
wow, very meta
I should write a meta about that topic
11:21
unrelated: mayavi is yamming amazing
and I haven't even started using it
I am going to revert/rewrite that...
@AnttiHaapala let's burn the approver at the stake
FIZZY!
> add reference to pep-257; converted function comments into docstrings; added a rule that "console-style" code examples should be avoided.
that's not so bad
Who what in the where now?
Who are we burning?
you!
2 mins ago, by Antti Haapala
https://stackoverflow.com/documentation/proposed/changes/39099
2 mins ago, by Antti Haapala
with zero score in
that one ^
yes that one
of course 50 % of it was good.
and you cannot approve a half-edit
11:24
Hey now. That syntax is what I agree with. We avoid having print everywhere but also make it easier to copy/paste for multiple lines.
nor improve and edit:P
And yeah the rest of the edit was good, ANDRAS.
YISSSS:P
@Ffisegydd so you think python docs, numpy docs and everything is wrong?
not necessarily wrong; different convention, right?
11:25
I honestly don't care one way or the other :)
I think consistency is more important.
I agree with the lack of >>> but mostly because I didn't know ipython could ignore that
and I assume most noobs don't know that either
see python docs, they use both. >>> is for demonstration of behavior
Not everyone uses ipython though, and what if you're looking to paste into source code?
then without is for code that is actually copiable
@AnttiHaapala python docs assumes you're a consenting adult, rather than a monkey who sees then does
11:26
Yes but remember that numpy also has the >>> button that allows you to remove it, we don't have that luxury.
SO docs is for blatant copy-paste, we need to make that our number 1 priority
@Ffisegydd then we'll make a meta-request
Pfft, think of all the different repl types out there.
also if you do 'abc'.upper() then paste it to a file, then run, it doesn't output 'ABC'
except in the shell.
11:27
What about doing variable assignment in examples?
call me pedantic, but that is exactly what is going to happen
x = 'abc'.upper()
# x = 'ABC'
@AnttiHaapala you're pedantic
people are going to ask on main site that why this doesn't output anything, despite documentation saying so.
@AnttiHaapala migrate to meta, close, delete
I mean, however thorough you are, there will always be helpless idiots who confound you
we might as well concentrate on people with a minimal amount of sense
11:31
@Ffisegydd I agree with that^ when it is part of proper code
however if the entire example is:
"to uppercase text, use .upper()"

>>> 'abc'.upper()
'ABC'
Yeah I see your point.
I don't see how that isn't "copy-pasteable"
this is what I see that guy doing with my code...
yeah, that's OK
turning this into
'abc'.upper()
# Output: 'ABC'
11:33
int('42')
# Output: 42
There's no really good solution to this. It should be based on editor's judgement, but that's already what's happening
vs
print('42')
# Output: 42
After all, they're going to have to do some kind of variable assignment/use in their own code, they can't just copy abc.upper().
nevermind that was exactly your point
oh well i am going to write that in the meta description
11:35
Go for it, I'll approve it.
# Output: ... should be used for multiline code/function calls, yes? And >>> ... should be used for simple oneline examples.
me too, ping me
oh, wait, rejects need 2, approve needs 1
something like that, Output that tells a string that is output to console, Return: with repr() of the value...
but even then...
then you'll have to explain repr() to that 0-score python user
.... sigh
11:38
I'd rather go play pokemon go
level 14 already.
I stopped playing, got bored of it.
found out that biking trips are a pretty effective way of hatching eggs if you go slow enough.
1,421 Proposed Changes
I love it how there's not enough backlog already in the review queues
Need to start giving rep for approving changes :P
11:40
stack overflow should use more Finns.
we're known for our envy.
it is most important to us that no one else does get unfair advantage.
Sunday cabbage
That there, is an amazing cat picture
11:57
2772
Q: Warlords of Documentation: A Proposed Expansion of Stack Overflow

Kevin MontroseIt’s been 7 years and 10,000,000+ Questions since Stack Overflow was launched. The amount of good that has been done for the field - all the developers helped, all the person-hours saved, all the beginners who grew into professionals - is hard to overstate. I cannot express how proud I am of what...

> If a project already has awesome documentation that's easy to search and cite, then there's no need to duplicate it on Stack Overflow. We're interested in fixing what's broken with documentation, not just moving them onto Stack Overflow.
Bahahahahahahahahahahahahahahahahahahahahahahahahahaha.
> 11 Proposed Changes
wat
I so hope that the reason is that Martijn rm -rf'ed all the changes:D
hmm....
or maybe I simply misread the original, and that 1.4k was the approved tab, not the under review tab?:(
Naaaah, that's surely not it......
Pretty sure that's it.
Man, I should have totally jumped on the "writing terrible documentation" bandwagon to treble my SO score...
I looked when you said that and only saw 10-20.
@Ffisegydd :(
> I reject your reality and substitute my own
Wow
That's some negative reaction
As I said, smfh.
I'll make my own documentation! With blackjack! And hookers!
We do have our own documentation, it's called the Python docs and it'll be better than anything that appears on SO docs.
12:11
yup
that's why I don't worry much about the matplotlib SO doc
it has very good official docs
Yeah the API docs are rock solid.
I submitted a few useful things that are not clearly written in the docs, otherwise I try to keep away
@Ffisegydd api docs are rock solid yes. There is a problem of organization though.
@AnttiHaapala In matplotlib?
ahh :D
I read that you were talking about Python docs
12:24
I don't find the organisation too bad in python.docs, but then I'm used to them so maybe I don't think about it too much.
and I just use Martijn's posts instead of the python docs
@Ffisegydd they're not very good for learning
how about the tutorial?
they're good if you know a module and then want to see how does its api work
tutorial is ok for learning the basics.
but something like "numbercrunching in Python": Use numpy, use numba, use cython, here be examples, now link elsewhere
there are nothing like that really, except the wiki, that no one reads and even less people update.
And will SOD be an alternative for that? I doubt it.
12:28
it could be
unless the topics eventually start being module names...
so that you will have "functools" topic and "itertools" topic.
then it will be shit.
They already are :P
People are literally duplicating the python docs.
the "writing python 2 and 3 compatible code" is quite sparse in Python docs... for example
as is anything that is cross-module, or that'd benefit from 3rd-party modules
yeah and downvote
op even answered it themself, without any explanation
and it looks like they posted it after someone answered it for them?
12:34
exactly
I didn't dv that other answer, though it should have been comment
downvoted both code-only answers though
and the question
Some peoples children. (unrelated) FML I'm still tired from my trip
typo? Or just "I didn't read the docs" stackoverflow.com/q/38551883/344286

« first day (2108 days earlier)      last day (3064 days later) »