« first day (2349 days earlier)      last day (2589 days later) » 

12:00 AM
Strong typing helps checking. Duck typing seems easy until it's not.
 
I still have high hopes for monkey typing
 
DSM
There have been times in the past where I couldn't sort out some index logic, so I wrote a strong test suite and used itertools.product to generate all the possible code variants which might work. #allthemonkeys
 
I'd be lying if I said that I didn't do something like that only 2 weeks ago
it's best if I rotate my matrices both ways and make sure what I think is right gives the better result
 
DSM
Okay, time to flee. Rhubarb!
 
rhubarb
 
12:35 AM
@idjaw you're on fire ^
 
1:17 AM
Does anyone here use emacs for Python? I'm looking for a video to convince myself that Emacs / vim is actually much better than other IDEs (seeing is believing). Is there such a "live coding" video with emacs?
 
Though it's atypical use. (And I would still recommend pycharm
 
thanks!
This is also pretty good youtube.com/watch?v=9jCnHgDrgRY
 
1:57 AM
Can someone tell me which python version is going to be used in future. Th django version. I know python 2.7
 
3.x
There is no "django python version" - django is a library which "is written for a python version". But if you need django: it has for the longest time already been supporting python 3.x.
 
2:42 AM
cbg
 
 
2 hours later…
5:02 AM
 
5:41 AM
import csv
import datetime
import operator
from itertools import islice

csv_content= list(csv.reader(open("data.csv"),
delimiter=',', quoting=csv.QUOTE_NONE))[1:]
output = list(islice((row[:2] for row in csv_content), 4))
#print (output)

ts = sorted([(datetime.datetime.strptime(j[0],
"%d-%m-%Y %H:%M:%S"),j[1],j[2]) for j in [list(filter(None,k)) for k in output]],
key=operator.itemgetter(0))

h=[]
for i in ts:
if i[0].hour not in h:
print (i)
h.append(i[0].hour)
using this code
error is coming can anyone help me?
ValueError: time data 'Timestamp' does not match format '%d-%m-%Y %H:%M:%S'
Timestamp data1 data2
20/03/2017 10:00:01 50 60.5
20/03/2017 10:10:00 60 70
20/03/2017 10:40:01 75 80
20/03/2017 11:05:00 44 65
20/03/2017 11:25:01 98 42
20/03/2017 11:50:01 12 99
20/03/2017 12:00:05 13 54
20/03/2017 12:05:01 78 78
20/03/2017 12:59:01 15 89
20/03/2017 13:00:00 46 99
20/03/2017 13:23:01 44 45
20/03/2017 13:45:08 80 39
Unfortunately, your code is quite cryptic and not formatted nicely for me to comprehend it. You should try ignoring the first line, i.e. the header row from being parsed as an actual timestamp. — Ashish Nitin Patil 18 hours ago
 
The error is that your code is using the header row too.
Will check how you can circumvent
@TB.M Can you format the code correctly? The indentation is off.
 
@TB.M 20/03/2017 10:00:01 doesn't match '%d-%m-%Y %H:%M:%S' the format string uses - as the date separator but your timestamps use /
 
5:57 AM
that i changed as /
import datetime
import operator
import csv
from itertools import islice
with open( 'data.csv', 'r') as f:
reader = csv.reader(f)
output = list(islice((row[:3] for row in reader), 31340)) #row[:2] for columns and 10 for rows

#print (output)
ts = sorted([(datetime.datetime.strptime(j[0], "%d/%m/%Y %H:%M:%S"),
j[1],j[2]) for j in [list(filter(None,k)) for k in output]],
key=operator.itemgetter(0))
h=[]
for i in ts:
if i[0].hour not in h:
print (i)
h.append(i[0].hour)
now this code is working, i remove header from my scv
now help me out with 2 point,
1st is if i mention header it should ignore in code and
2nd is how to mention only columns not rows?
 
@TB.M Please format your code properly when you post it here. You can use Ctrl-k or the "Fixed Font" button.
And try to keep code snippets short - upto a dozen lines or so. For longer snippets, please use a site like dpaste, pastebin, gist, etc.
@TB.M Rather than removing the header line from the CSV file you should skip over it when you read the file. Or use the csv module's DictReader, which will use the header line to create column names.
 
6:15 AM
@TB.M The IndexError is because you use islice and get rid of data2 component of the rows, which you are trying to use in ts.
 
recbg
 
6:36 AM
Here's a weird arithmetic "bug" in Numpy. At first I naturally assumed it was an overflow error, but as you can see from my comment, it's not.
 
>>> '%.3f' % 499997.0 ** 3 '124997750013499968.000'Antti Haapala 13 secs ago
 
@Kevin I got the solution from the #regex freenode irc https://regex101.com/r/yGqi0c/2

>>> re.findall(r'(?P<def>[A-Z]+): (?P<remainder>.*(?:\n(?![A-Z]+:).*)*)', test_string)
[('INFO', 'this is the test text\nanother line'), ('SOURCE', 'source field\nsecond: line\nthird line'), ('DESCRIPTION', 'test description')]
 
@AnttiHaapala What The Yam?!
 
"capture to the end of the line, capture 0 or more lines that don't begin with [A-Z]:"
And falls on the lines of the generic solution to the <pattern><not-the-pattern>+
 
@PM2Ring float exponentation
I don't have time to answer the q, but just look at the source code and it is using doubles, or so I guess.
"57 bits" is close to 53, that's why I thought about it immediately
 
6:51 AM
@AnttiHaapala I suppose I would've stumbled on it eventually, if I hadn't got caught up playing with log & exp. :)
 
>>> '%.3f' % 499997 ** 3.0
'124997750013499968.000'
 
@AnttiHaapala Are you using a 64 bit build of Python (and Numpy) ? I'm using 32 bit, and I assume MARU is too.
 
no, I was just missing one 9
 
@AnttiHaapala Ah, right. :)
@ZeroPiraeus "python seems confused on the matter" Dear OP, it's not Python that's confused...
 
Quite :-)
 
numpy docs suck
news at 9
this is documentation for __pow__
 
7:17 AM
That "Why may I not upload images of code" link is rather handy, isn't it. I see you've been using it a lot lately.
 
Hmm
I should add it to my autocomments :)
 
@AnttiHaapala Oh, so it's not just me, then. :)
 
who sucks?
I've given up answering to that question
answering it would need me to find the C or fortran source code for that shit... :D
>>> n.__pow__
<method-wrapper '__pow__' of numpy.ndarray object at 0x7fbda0fddbc0>
 
@AnttiHaapala That's rather terse. You'd think they'd at least mention that it uses doubles by default.
 
there is no link to pow or anything such...
 
7:19 AM
@PM2Ring A little bit, yeah. Of course, the kind of OP that can finally post their actual code into the question and still not see what's already been pointed out them probaly has bigger problems.
 
I could place a bounty on that q later
 
@AnttiHaapala The OP seems satisfied with what's been said in the comments.
 
@PM2Ring who cares about some silly OP
I don't give a sh*t about OPs. I care about questions.
 
Good point
 
if that were the case, then that should be cv'd, dv'd, delvd
 
7:25 AM
@AnttiHaapala Damn straight. Questions won't disappear with nary an upvote after you pour your soul into an answer, breaking your heart, never to be seen again …
3
 
cbg
 
I don't know Java, but is my linked question a suitable dupe target? stackoverflow.com/questions/42945352/…
 
OP asked about a much broader thing... But they will get the general idea I guess.
 
So should I hammer it? Or just leave it as a link? Actually, can I hammer to a non-Python target?
 
7:42 AM
why is it tagged as Python?
 
@khajvah Because he's actually asking about pypy, which is a Python implementation that uses a JIT compiler.
 
oh didn't see pypy tag
 
Daaaamn.
I used the suggest code from the error message and now says it expects a parentheses — Viridian Tourist 15 mins ago
OP's first question is from 2013. Just … what?
Makes that "99% can't code fizzbuzz" blog post feel very real all of a sudden.
 
8:36 AM
cbg all
In Django's database router, what is purpose of allow_relation function? What will happen if this function returns True v/s returns False?
 
@AshishNitinPatil The data in that JSON question is probably not a string literal, otherwise the suggested answers would have worked. Instead, it's probably a line from a file or website, so its repr looks like this:
'"{\\x0A  \\x22identifier\\x22: {\\x0A \\x22company_code\\x22: \\x22TSC\\x22,    \\x0A        \\x22product_type\\x22: \\x22airtime-ctg\\x22,\\x0A        \\x22host_type\\x22: \\x22android\\x22\\x0A  }}"'
Which means that the data needs to be evaluated before its passed to json.loads. That can be done safely with ast.literal_eval. But I'm not going to post an answer until / unless the OP responds to my comments by fixing up their question, and posting the repr to confirm my theory.
 
Thanks, forgot about the double slashes. Shouldn't have answered it. I deleted then undeleted. OP didn't answer a lot of comment questions.
 
I think all the answers there got downvoted for answering a bad question.
 
Yep, they should have :)
 
Wow. They've been a member for over a year, and they only have 1 question. Maybe they've posted more, and they've deleted them...
 
8:47 AM
OP himself asking for the hammer stackoverflow.com/questions/42946446/…
Developer survey results are out! - stackoverflow.com/insights/survey/2017
 
how we can take distinct of timestamp column?
using csv
Timestamp data1 data2
20/03/2017 10:00:01 50 60.5
20/03/2017 10:10:00 60 70
20/03/2017 10:10:00 60 75
20/03/2017 10:40:01 75 80
20/03/2017 10:40:01 75 80
20/03/2017 11:05:00 44 65
from this csv i want to take only unique timestamp ,how to take those records only
 
@TB.M See itertools.groupby
Here's a non-csv demo
from itertools import groupby
from operator import itemgetter

data = '''\
20/03/2017 10:00:01 50 60.5
20/03/2017 10:10:00 60 70
20/03/2017 10:10:00 60 75
20/03/2017 10:40:01 75 80
20/03/2017 10:40:01 75 80
20/03/2017 11:05:00 44 65
'''
data = [row.split() for row in data.splitlines()]
newdata = []
for k, g in groupby(data, key=itemgetter(0, 1)):
    g = list(g)
    if len(g) == 1:
        newdata.append(' '.join(g[0]))
print(newdata)
#output
['20/03/2017 10:00:01 50 60.5', '20/03/2017 11:05:00 44 65']
 
9:33 AM
cbg folks
I've been able to manage 15 mn of coding every day at lunch time
I wish Holden Web was around
 
thanks @pm
thanks @PM2Ring , but i want with csv
#sortedreader = sorted(reader, lambda x: x[0])

#print (sortedreader)

#groups = groupby(sortedreader, key=lambda d:(d['timestamp']))

#print (groups)
i am trying with this but not getting proper result
 
9:49 AM
@TB.M itertools.groupby returns an iterator. My code above shows how to iterate with it.
I assume that if d is a row of sortedreader then d['timestamp'] contains the full timestamp. If that's true, then your key function lambda is correct.
 
sortedreader = sorted(reader, key=lambda x: x['timestamp'])

print (sortedreader)

groups = groupby(sortedreader, key=lambda d:(d['timestamp']))

print (groups)

but how to see the result ?
how to print groups result?
 
10:26 AM
wow
I didin't know 20+ years experienced people were so many in SO
 
Same thoughts... I am only almost 5 years over 20. But that's my age, not experience in years :-p
Well, at least it isn't pprofessional "programming" experience.
 
80% of people read the documentation, I think they're lying :)
 
I am 21
 
age / experience :-p
 
11:30 AM
unclear / no MCVE stackoverflow.com/questions/42945447/… It's been almost 2 hours since my last comment, and the OP was active 1 hour ago, and still no response.
 
cbg
np_val = np.array(val,dtype=object), problem solved ;) — Andras Deak 18 secs ago
:D
wait don't even need dtype
 
11:49 AM
@AndrasDeak I do. np.array(499997, dtype=object) ** 3 gives me the right answer, but np.array(499997) ** 3 gives me
./qtest.py:30: RuntimeWarning: invalid value encountered in power
  print(np.array(499997) ** 3)
-2147483648
 
which version of numpy?
>>> np.array(499997)**3
124997750013499973
^ 1.12
 
>>> numpy.version.version
'1.11.1'
>>> numpy.version.git_revision
'ccc6b8d8fcf92cc6dc19f7e14d91fc6c127114a6'
 
.git_revision cooool
@PM2Ring Is this specific to numpy or are there other packages that also provide version.git_revision?
 
@AshishNitinPatil No idea. I just noticed it when I did TAB completion on numpy.version in the REPL.
 
It's up to the developers, numpy generates it in their setup.py
 
12:00 PM
hmm, @PM2Ring it might be a 32-bit vs 64-bit issue
@AndrasDeak: Not on my machine? np.array(499997).dtype gives int32, not object. Did you mean np.array(val, dtype=np.object_)? — Eric 3 mins ago
@Eric interesting. I originally wrote np.array(val,dtype=object) but then I realized that it works on my system (python 3, numpy 1.12) without the dtype too. Here np.array(499997).dtype is int64 (64-bit system vs 32-bit?), but most importantly, np.array(499997)**3 gives 124997750013499973. — Andras Deak 39 secs ago
 
cabbage
 
cbg
*rolling back 100 edits*
 
np.array(499997).dtype returns int32 for me. But I am on a 32 bit machine.
 
I'm on master of numpy 1.13. For me, np.array(499997) gives RuntimeWarning: invalid value encountered in powerEric 2 mins ago
so it's not about numpy version, but about word size
 
why no tuples in Java
:(
 
12:12 PM
Just realized that I'll be hitting 25k before @PM2Ring ... Muhahah
 
Hello people, sorry to disrupt you (but you are free to ignore me). I found this phrase: "But creation of objects in Python is dynamic by design". What does it mean that Python creates objects dynamically? Thank you
 
Hey, @AshishNitinPatil Check this out. But don't show it to that OP. :)
class Evil:
    k = 0
    def __init__(self, a):
        self.a = a
        self.id = Evil.k
        Evil.k += 1

    def __hash__(self):
        return self.id

    def __eq__(self, other):
        return self.id == other.id

    def __repr__(self):
        return repr(self.a)

d = {Evil(v): i for i, v in enumerate('ababcdcd')}
print(d)
#output
{'a': 0, 'b': 1, 'a': 2, 'b': 3, 'c': 4, 'd': 5, 'c': 6, 'd': 7}
 
Haha, nice. But this way we will never find other values I presume?
 
This trick is occasionally useful. Eg, JSON doesn't forbid duplicate keys. But really, it's better to transform those keys into something sane.
 
So basically useful for formatting or storage, but not retrieval or actual referencing.
 
12:21 PM
@BillalBEGUERADJ I assume you got that quote from toptal.com/python/python-design-patterns and honestly I have no idea what the author is trying to say. Maybe he means that you don't have to use new to get a new object instance...?
 
@AshishNitinPatil Yeah. Trying to retrieve stuff via those keys is a PITA. OF course you can get at the keys themselves via .keys().
 
Thanks, TIL :D
 
Thank you very much for the feedback, Kevin. And yes, you are right when you referred to that link. The author tries to say that Factory pattern is not useful in Python and justifies that by the phrase I mentioned. The comments to that post do not ask a question about that phrase. So I thought may be I am the only one who do not understand it. I do not know if he refers to using "new" keyword, as you said. Thank you
 
@BhargavRao I was hoping to hit it today, but it's been a slow day, and I'm getting tired.
 
I'll most probably hit it this week.
If you have 10k and lots of time, check Great programming quotes
 
12:33 PM
@AshishNitinPatil Speaking of inverting dictionaries, did you see this question earlier today? Weirdly, the OP's code is fine (once they corrected a typo), but they claim it gives the wrong output, which nobody else can reproduce. :)
 
Nope, missed it.
 
@BhargavRao I've seen a lot of those before, but it's still great reading.
 
Things will always fall apart when you take the holy keywords into your own hands, specially if one is no God.
 
I've always loved this one: "I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." — Alan Kay
 
12:38 PM
Lol, yep. That one's nice.
 
@BhargavRao I'll have to screenshot that:D
 
@AndrasDeak There's 23 pages to screenshot
 
"Beware of bugs in the above code; I have only proved it correct, not tried it." — Donald Knuth
 
@BhargavRao I've got time:P
 
"If Java had true garbage collection, most programs would delete themselves upon execution." — Robert Sewell
 
12:44 PM
@AndrasDeak Please share. Progress to 10K - 35% only :(
 
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." — Martin Fowler
15
 
question: Why cannot I do this
 
"Owning a computer without programming is like having a kitchen and using only the microwave oven" — Charles Petzold
10
 
imod = ['az','Az','B','bz']
print(imod.sort(key=str.lower))
 
@AndyK Stop quoting my internal monologue :-P
 
12:50 PM
It's a nice saying, but it doesn't absolve Charles for Windows, though. :)
 
#lmao @Kevin
 
You refresh my soul @PM2Ring Thank you for the nice meaningful quotes
 
why instead I should go that way
 
.sort() mutates the list in-place and returns None. Use sorted instead
 
12:51 PM
>>> imod = ['az','Az','B','bz']
>>> print(sorted(imod, key=str.lower))
['az', 'Az', 'B', 'bz']
 
hey @TheLostMind long time no see
 
I believe people in here post on Kaggle.com?
 
The plot device from the Lego Movie?
 
you're the man @Kevin
 
@AndyK - I pop in whenever I can :)
 
12:52 PM
(Y)
coding whilst listening to Randy Crawford and her street life = plain awesome
 
Cabbage @TheLostMind, the room was suffering from a dearth of mods.
 
yo Bhargav. sup man?
 
@AndyK Nothing much, what about you?
 
@BhargavRao - Indeed it was :)
 
I'm currently listening to: the voices of a pair of loud maintenance people in the adjacent storage area who don't know that the walls between my office and the adjacent storage area have the sound-absorption of a piece of printer paper
 
12:55 PM
working my arse off and coding during my lunch time
except nothing much :)
b-rb
 
@AshishNitinPatil first page until you get there
 
@AndrasDeak I am and will be doing my best to get there :D Thanks!
 
@AndrasDeak another post for you to screen shot stackoverflow.com/questions/164432/…
 
no problem
@BhargavRao nope:D
 
@BhargavRao Need to gun down to 10k as fast as I can.
 
1:01 PM
thanks
 
@AshishNitinPatil or become a mod, easier way to get all the privs :p
 
"When I am working on a problem I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." — R. Buckminster Fuller
 
@BhargavRao Well, no one is going to vote for a 3k. Plus, elections are far far away. I might just get to 10k by then.
 
If all goes well, we might not have an election this year. :/
 
Plus, mods have too much work. I would rather flag and do reviews.
@BhargavRao Why so? And didn't we have an election just recently?
 
1:05 PM
Because there's no need of more mods.
 
Ooh, once a mod, always a mod?
 
unless you work hard
IRL problems and abuse of mod powers can get you unmodded, but that happens very very rarely
 
@AndrasDeak Yeah, and to de-mod a mod, you need 2/3rd majority in the mod council.
 
Wrong assumption I had, specially yearly elections can make it easy to believe I think.
assumption - mods change with every election XD
 
@PM2Ring And that's why I'm annoyed that the proof of the four color theorem has 1,936 individual corner cases.
 
1:08 PM
@BhargavRao ha, I didn't know that
 
@AndrasDeak It's posted on MSE somewhere. It implies that, if I bribe 35% of the mods, then I can become a dictator \o/
 
@Kevin Indeed. Although I think they've been able to reduce the number of special cases down a bit from the original proof, it's still fairly high, eg 800 or so.
 
each election results in ~3 new mods
 
@BhargavRao Need to flag this comment, oh wait :-p
 
Let's not forget Fermat's Last Theorem, the modern proof of which could only fit in the margin of a book if you used an electron microscope
 
en.wikipedia.org/wiki/… "This new proof is similar to Appel and Haken's but more efficient because it reduces the complexity of the problem and requires checking only 633 reducible configurations. Both the unavoidability and reducibility parts of this new proof must be executed by computer and are impractical to check by hand"
 
I find it terrifying when a mathematician says "impractical"
 
633 is still too large. I'll only be satisfied if they only use the numbers 0, 1, and 2.
 
"impractical, as it might accidentally lead to the collapse of the multiverse into a singularity"
 
1:14 PM
They can still use "four" in the title but they can't use the digit 4
 
 
And I still haven't had any feedback from the OP of that 4 colour algorithm question I answered the other day :grumble:
 
@BhargavRao This reminds me about an experience the other day. The maintenance at my apartment building is spraying every unit for bugs. When I saw them in the hallway, I asked where they would be spraying and one of them said, "Everywhere." I asked, "What does 'everywhere' mean?" and I just get "Everywhere." repeated back to me. So I am like, "So you are spraying all over my bookshelves and television?" I just got a glare and they walked away.
 
@AndrasDeak It's impractical to draw a 100x100 pixels Mandelbrot set by hand. OTOH, that's easy to do in parallel.
 
How do people not get that "everywhere" and "everything" are not valid answers to basically any question.
 
1:20 PM
@Code-Apprentice lol, that was nice.
 
in maintenance-speak, "everywhere" = "every room in the appropriate positions"
 
I have a feeling that the sprayman has this conversation very, very frequently, and knows that no productive discourse can occur once he admits that he's going to be spraying down your fragile possessions, so he just doesn't bother admitting it.
 
when they came to my apartment, I started to move my bed away from the wall and then they said they were only spraying in the kitchen and the bathroom.
My studio apartment doesn't even have a kitchen...
 
if there's a history of proper debugging in the house, then they only need to set up poison where bugs can get in
i.e. sink drains
 
@Code-Apprentice Did they charge you for spraying the imaginary kitchen though?
 
1:24 PM
Twist: the exterminators are giant bugs in disguise and have little understanding of the living conditions of humans.
Hang on, Men In Black did that joke already.
 
apparently there isn't such a history and there are some residents who are even less clean than I am.
@AshishNitinPatil I wasn't charged at all, AFAIK.
 
\o cbg
 
@Kevin 9/10 still
 
the manager told me that someone took out six large garbage bags full of trash...
 
@AndrasDeak Haha. "If all of my predecessors did their jobs properly" may as well be "if False:"
 
1:26 PM
Our apartment complex has had the same guy (who also happens to be a neighbour) do our debugging, so here it works.
the guy went around spraying the floor for the first ~2 years, and when bugs have been long gone, he switched to putting pasty poison drops below sinks
he claims that's enough, and we haven't seen any animals since, but then again my physicist side notes that we didn't have any bugs beforehand either (except a single instance of pharaoh ants many years ago)
so it's hard to tell whether cocroaches stay away due to the measures taken or just because they think we're too dirty
 
too dirty? Is there such a thing for cockroaches?
 
Lisa, I want to buy your rock
 
cockroaches and rats are suprisingly well-groomed animals
> Cockroaches feel exactly the same way about us as we do about them. If a person touches them, they run away and hide, then wash themselves.
popular urban legend
(dunno if it's true or not, but sounds legit)
 
I was just looking up that same fact. nowyouknowfacts.com/2015/01/10-unknow-things-cockroaches.html cites nwf.org/News-and-Magazines/National-%20%20Wildlife/Animals/… as a source, but the latter is a 404, alas
 
@Kevin You can use parentheses instead of those ugly backslashes.
func = (lambda a,b:
b - a if a <= b
else a*b
)
Or just write it on a single line. :)
 
1:32 PM
Huh, could have sworn I tried that. I'll edit that into my post in a minute, thanks :-)
 
implicit line continuation or whatchamacallit
 
major pet peeve of mine: calling anything other than bugs bugs
 
Hmm, how should I describe the parentheses trick textually...
 
1 min ago, by Andras Deak
implicit line continuation or whatchamacallit
not that
but it's in pep8 I think
but my firefox is slow as hell
takes forever to google anything
> The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple lines by wrapping expressions in parentheses. These should be used in preference to using a backslash for line continuation.
PEP8 ^
 
1:35 PM
I'll go with "newlines inside a parenthesized expression are ignored" and hope nobody "well actually"s me with a counterexample
 
s = ("""a
b""")
print(repr(s))
"How come this doesn't print "ab", then?", asked the commenter smugly
 
“because the newline is inside the string, not the parenthesized expression”, poke replied as if it was something obvious to know.
 
@AndrasDeak Oh, if that's the official term, I'll just use that, then.
 
So just add "(unless they're in a triple-quoted string) "
One cute trick with triple quoted strings is using a backslash to escape the newline, so you can do stuff like
s = '''\
this is
a multiline
string'''
and avoid an unwanted empty first line.
 
1:40 PM
or
s = '''
this is
a multiline
string'''.strip()
I find line-continuation backslashes off-putting
 
@PM2Ring Curious about that actually: Is this the lexer just parsing this as a line continuation backslash, or is this actually something built into the multi string?
 
@poke I'm pretty sure that it's being handled by the normal line continuation backslash stuff.
 
@AndrasDeak Even better:
>>> s = '''
    this is
    a multiline
    string
    '''

>>> import inspect
>>> print(inspect.cleandoc(s))
this is
a multiline
string
 
yup, indentation in multilines is annoying
 
I'm a little annoyed that there aren't individual anchor links to each bullet point in PEP 8, so I have to link to "programming recommendations" and hope the reader is smart enough to find "Always use a def statement instead of an assignment statement that binds a lambda expression directly to an identifier" on their own
 
1:45 PM
I decided to print one line-by-line the last time I needed it
 
@Kevin Submit a patch?
 
Are PEPs a thing that can be patched? Serious question.
 
Not sure
 
Or maybe not... :) In a string literal, the backslash tells the lexer to do something special to the following character if it's a recognised escape sequence, and backslash-newline is a recognised escape sequence that gets converted to an empty string.
 
but they have to be stored somewhere, don’t they?
 
1:46 PM
Submit an RFC then.
 
A PEP8-modification PEP
PEP8 formatting modification PEP even
 
pepception
 
that’s almost meta
 
When diplomacy fails, hack the mainframe.
 
use a visual basic GUI
 
1:47 PM
There should be PEP8 errors inside the PEP8 source. That would be hilarious
 
DSM
pep8-compliant cabbage for all!
 
cbg
assuming it's a function/instance and not a class
 
@Kevin As per PEP 1, “[u]pdates to existing PEPs should be submitted as a GitHub pull request”
Unfortunately, it’s all text, so you would have to submit a fix to the HTML converter?
 
Let's move the problem a couple meta levels up and make it possible to link to any specific sentence in any PEP
 
Hell, let's just have a pep module that lets you grab any section of any PEP.
 
1:53 PM
PEP 8 uses the variable name file_1 in the python.org/dev/peps/pep-0008/#maximum-line-length section, which may or may not be a style violation depending on whether "1" counts as a "lowercase word"
I'm not fond of digits in names regardless, though
 
good morning sixers
 
>>> '1'.islower()
False
 
cbg
@poke i slower than what?
 
Than 1
 
Builtin functions don't follow style conventions so you can't use them to prove whether something follows style conventions. That well's poisoned.
Come back to me when you can do "1".is_lower()
 
I begrudgingly accept this evidence, since it comes from a consortium.
 

« first day (2349 days earlier)      last day (2589 days later) »