« first day (2693 days earlier)      last day (2255 days later) » 
00:00 - 21:0021:00 - 00:00

9:07 PM
print ('hello everyone')
 
Can we ask for help with reopen votes here?
or, does a dupe-hammerer get notified if someone votes to reopen?
 
wim
9:25 PM
ask away
we don't get notified, no
 
I think this has been prematurely dupe-hammered. The OP is asking for something like a RotatingFileHandler but for writing to CSV
 
Interesting. I just got a "During handling of the above exception, another exception occurred" three times inside eachother.
 
The dupe target does not behave in that way at all
IMO it should either have a relevant dupe target or at least be open for someone to answer
 
Note that it's usually helpful to discuss with the gold badger first in comments. I know wim likes to unhammer posts which he feels were closed wrong, but it's friendlier to reach an understanding first
 
But I can't do that
He left no comment, there is no way to contact him and a, now lengthy, comment trail. Which is why I was curious if a dupe-hammerer was notified when someone voted to reopen
 
9:31 PM
hammerer gold badgers are pingeable in comments meta.stackexchange.com/questions/43019/…
 
If I type @m I don't get any prompt
 
yup, you don't
FWIW martineau doesn't seem like someone who would mind if it gets reopened eventually
 
Eh, "For questions: The moderator or gold badge holder who closed or reopened the question. " was what I needed. On my phone I don't get any tag prompts for anyone and they never actually get the prompts. I'll raise it with him
I've had plenty of dialogue with him. A couple disagreements but he's a reasonable guy :)
 
yeah, he seems so
@AndrasDeak *pingable
 
wim
martineau is not very good. let me have a look...
 
9:38 PM
ah, the knight of diplomacy has arrived :P
 
wim
LOL
 
hahaha
 
also @roganjosh dupe target lists can be edited by gold badgers (pretty new feature), so it's also possible to amend the dupe target list without reopening the post
 
wim
Greetings, knight of pedantry
 
Oh can we give knights titles to everyone :D ?
 
wim
gold badger badger, at your service
 
Hey @davidism any chance you might be at the python meetup this Saturday? I had some random stuff I wanted to bug you about
 
wim
Yes, I agree with you that this is the job of rotating file handler, and that the dupe suggestion is garbage. Re-opened.
 
Much obliged, Knight of Diplomacy
 
wim
The question could do with a clarification on whether splitting mid-line is allowed or not
 
9:50 PM
a csv?
 
wim
not sure if the rotatingfilehandler is line buffered by default, but it could be an issue for csv
 
splitting it mid-line would sound...odd
 
Yes, I don't think you could split mid-line
 
you couldn't just cat the results together, broken fields, etc.
 
You'd have to know whether the next line would take you over the threshold and open a new file for that full line I guess
 
wim
9:52 PM
kinda, depends on the use case, if this is just dumping out data into manageable chunks which will later be recombined, you might not care
 
or allow a tolerance for the size
there are virtually no exact size restrictions nowadays in the way that floppies had
 
How to "reverse iterate an enumerate"? for i, ng in reversed(enumerate(modes)):
errors
 
do you want to reverse the indices too?
 
@AndrasDeak yeah, (otherwiseI'd have the reversed inside the enumerate)
 
I guess you have to consume the iterator anyway
 
9:54 PM
I have an idea of my plan of attack but it would be crude and need refining from there. I actually use RotatingFileHandler in my logging and I don't think I've seen lines being chopped up so I'll have a look how it's implemented
 
@AndrasDeak you mean creating a temporary list that is based on idx + value tuples?
 
>>> list(reversed(list(enumerate(['a','b','c']))))
[(2, 'c'), (1, 'b'), (0, 'a')]
 
And then see what it does if I set a file size limit less than a single line of logging :)
 
It's tempting to now use a simple range :P
 
well what are you going to do with the result?
oh, looping over
I guess I never loop over things in reverse (when I delete from a list I'd rather just create a new list)
 
10:00 PM
yeah, this is tempting now:
for i in range(len(modes), 0, -1):
    mode = modes[i]
 
then you could zip that with modes ^
 
oh actually I'm trying to find the "last element that fits criteria".
so... I just remembered next
 
and if you want to impress wim, use itertools.count(len(modes),-1) in the zip
 
wim
you can't reverse iterate an enumerate, because the underlying object might not support reverse iteration
 
@AndrasDeak I don't think wim is impressed :p
 
wim
10:03 PM
I suppose enumerate could ask the object if it supports reversed, in theory, and allow it if it's possible.
 
that would be weird
 
wim
why?
because there would be no advantage over enumerating the reversed, I guess?
 
Right now it says: TypeError: argument to reversed() must be a sequence. This would have to be rethought. reversed(enumerate(...)) should either always fail or always work if you ask me
 
Shouldn't those things like "enumerate" and "reversed" be just modifiers from a "query"? And thus any chaining should be possible as long as the object they are working on supports the operations.
 
wim
well, that error message doesn't impress me
>>> class A:
...     def __reversed__(self):
...         return 'unimpressed', 'is', 'badger'
...
>>> from collections import Sequence
>>> isinstance(A(), Sequence)
False
>>> reversed(A())
('unimpressed', 'is', 'badger')
 
10:07 PM
enumerated(x) supports the same operations as x
*should support
 
Ah, forgot to say Andras, that Modbus question you helped me with... I finally rolled out the system today that should save around ~£20K a year replacing £2K units with a Raspberry Pi :)
4
 
wim
@AndrasDeak wrong
 
10:33 PM
@wim okay
@roganjosh glad to hear that. But are you sure that was me? :D
oooh that weird protocol thing? with the weird non-exceptions?
 
@AndrasDeak no, but you did help me over a hurdle so I thought you might be interested in the outcome
Yes, Modbus is quite old
 
yeah, OK, cool, I just didn't recognize that first from "modbus"
 
There's a unit they're using in the factory that reads the modbus registers and throws it into frontend on a TV. £2K per TV. Silly.
 
good job :)
 
wim
Is it really worth noting a 5+ years old feature of the language any more? — wim 43 secs ago
 
10:38 PM
We'll see how resilient the Pi is under 24/7 load in a dusty factory but we can afford to throw a few away if the experiment fails. It has the potential to save a lot of money
 
wim
/me grumbles
tired of people calling me out for using "new" features when Python 2 EOL is <2 years away.
 
you'll like their response
Eh, I think many people still use Python 2 for legacy code @wim. OTHO, I think you do have a point. If people still haven't ported to Python 3 by now, that's really their fault. — Christian Dean 20 secs ago
rhubarb
 
rbrb Andras
Does anyone have experience of contractor work?
 
wim
10:53 PM
brain fart, what's the inverse of this
>>> int('000100070017000C', 36)
4738401086163192588
 
11:14 PM
Inverse? Not sure how you could get an inverse of changing a numbers base. Curious as to what you mean though!
 
@wim You'll have to use string formatting
Not sure how to get to base 36 though (base 16 would be "{:x}".format(int('000100070017000C', 16)) )
 
wim
yeah format spec is special cased for 2 (b), 8 (o) and 16 (x)
 
Other than that you'll have to roll your own converter I guess
Which is just iterating over the digits, and then filling them in the "n-base symbols"
 
wim
bah
Python allow calling int with any base, they should provide the inverse for any base
I'm not saying you're wrong, just grumbling.
 
588 => (8='8*36^0'=>8) + (80=2*36^1+8*36^0=28) + (500=1*35^2+4*36^1+6*36^0=146) = '1' + '6' + '24' = 16o
And continu that for the full number
Not that hard, I've had to write these things in VHDL as trivial exercise in the past (well to convert base-n to base-m)
 
wim
11:33 PM
yeah I know it's easy to divmod it, just hoped there was a builtin
sometimes I wish there was an inplace operator for
putting the thing that's added on the left instead of the right
I don't know how to explain it. It's like x += y but you wanted x = y + x not x = x + y
 
for when addition is not commutative
 
wim
11:47 PM
yes, actually very common since python uses + to concat sequences
 
With ~70kLOC in our Py2.7 codebase, I think our company is going to put off upgrading until absolutely necessary. Maybe I'll do a spike with 2to3 and see how much actually needs the white glove...
 
wim
2 to 3 conversion is not that hard if it's good python 2 code
 
00:00 - 21:0021:00 - 00:00

« first day (2693 days earlier)      last day (2255 days later) »