« first day (3152 days earlier)      last day (1791 days later) » 

3:00 PM
Don't windows users have to journey to the end of the world and reach enlightenment under the guidance of a wizened monk to see unicode in a terminal? Or is this unrelated?
 
Yes, but if the only problem was "windows consoles are dumb and can't display strings right", then I'd expect the output to be mangled for both stringify and str, not just one
 
I haven't read the full thread yet, but Latin1 has a special relationship to Unicode. Latin1 chars have the same Unicode codepoints as their ord in Latin1.
Jul 31 '18 at 21:27, by PM 2Ring
latin = bytes(range(256)).decode('latin1')
uni = ''.join([chr(u) for u in range(256)])
print(uni == latin)
#output
True
 
Yeah UTF8 is a superset of ASCII
 
@Kevin for the str result \x00 is four characters
 
The question I've been dancing around is "does bytes.repr call decode under the hood?" and the answer appears to be "no"
That answers the puzzlement that prompted this tangent. "Why is my naive stringify method returning junk?" is a mystery that I'm content to leave unsolved, for the sake of my migraine
One might argue that bytes.repr is implicitly using latin1 in the sense that every char that isn't being slash-escaped is just getting inserted into the unicode array(?) without its ordinal value being changed
 
3:18 PM
Wikipedia explains how the UTF-8 encoding works here, there's an example given a few paragraphs later. And here is some Python code I wrote that decodes UTF-8 "manually".
 
I don't understand ...
y = stringify(x); print(type(y), y, y.__repr__(), sep='\n\n')
it is something to do with print seeing it as maybe something else?!
This is melting my precoffeecortex
 
wim
I had a rash of downvotes+delvotes on long-ago closed dupes recently (e.g. Pythonic way of accessing recursively nested dict [duplicate]). Whoever is doing this, please cut it out - dupes are good "signposts" onsite and can help the search to work more effectively!
I wonder if this is fallout from cs95 call to arms for 20k users to trawl through old content and delvote it (even though his search link specifically excluded dupes)
@PM2Ring I had one in 2015 also - here
 
3:42 PM
@Aran-Fey For some strange reason, unicode has a character equivalent for every single one of the 256 possible bytes. That was done precisely to make Latin1 a subset of Unicode.
 
cannot be. My link targets closed as "too broad". Whoever is downvoting your questions certainly has a different intention in mind
OK, just noticed you said that. Sorry, if it is because of me, I certainly didn't mean for it to happen
 
morning cabbage
 
3:58 PM
@piRSquared Whip out that poor man's debugger (gdb) haha.
 
This reminds me of the time I asked "Using only builtins, how can I tell whether a particular character will take up exactly one space when I print it?" and the answer was "you can't"
Stdout moves in mysterious ways
 
doesn't that depend on whatever displays the output?
 
Ultimately, someone (wim?) pointed me to a third-party module that worked for my purposes. I forget the name.
@MisterMiyagi Yeah.
 
@Kevin ftfy?
 
The module I'm thinking of didn't attempt to fix unicode weirdness. It just faithfully indicated the "width" of the string you passed to it.
 
4:26 PM
@PM2Ring Let me put it this way: I don't think that's a good reason
characters representing bytes didn't work out in pythoff, and it's a similarly bad move in unicode IMO
 
is there any "bytes" encoding, by the way? some string format that only uses "\x??" escapes?
 
Uh, I don't think that makes sense. Example, please?
 
eh, you are right
 
4:47 PM
In other words, is there an encoding where b"Hello, world!" encodes to \x48\x65\x6c\x6c\x6f\x2c\x20\x77\x6f\x72\x6c\x64\x21?
I'm going to guess "no"
 
the question is what á encodes to
 
This imaginary encoding would presumably refuse to encode any string that isn't a sequence of "slash followed by x followed by two hex digits"
(here I go getting encode/decode mixed up again)
Clarifications
"is there an encoding where b"Hello, world!" textifies to [...]"
"This imaginary encoding would presumably refuse to byteify any string that isn't [...]"
 
oh, sorry, I missed the b in front of your string and you said encodes, so...
 
@IljaEverilä just fyi, I flagged stackoverflow.com/questions/56428789/… for suspicious votes and the mods are looking at it
 
:<
 
4:58 PM
@davidism Noted.
 
5:11 PM
Anyone here play with django admin? On the list view, the default behavior is that you can select an element by clicking anywhere in the row. Then you can select an action from a dropdown menu to apply to all of the selected items (for example delete them). I'm trying to customize the list view to do other things when you click on the row and only want selection to occur if the user clicks on the checkbox specifically. Anyone have any ideas how to go about this?
 
wim
@Kevin may have been wcwidth
I'm also to blame for the string 乇乂ㄒ尺卂 ㄒ卄丨匚匚 in py.
 
Name rings a bell, that was probably it.
 
wim
there is some stdlib stuff too
 
@MisterMiyagi tadaa
 
wim
>>> import unicodedata
>>> unicodedata.east_asian_width("\N{PILE OF POO}")
'W'   # for category "wide"
@Kevin I'm curious what that is do you mind to put it to dpaste
 
@Aran-Fey Well, they wanted to make ASCII a proper subset of Unicode. That explains the code points below \x20. But ASCII is only a 7 bit encoding, and there was no extra cost in making Latin1 a subset. At the time, it was a reasonable candidate. Unfortunately, things got messy when you add cp1252 to the picture.
 
wim
I never did get any acceptable answer on Printed length of a string in python. In hindsight I suspect this problem is likely intractable.
 
Do my eyes deceive me or does that spell "extra thicc"?
 
It's just you
 
Yeah, when you throw in control characters like \b and \r it becomes quite difficult to determine string length/width
For one thing, it's context-sensitive: "\babc" is three characters wide if printed at the start of a line, and arguably two characters wide otherwise
So width(a) + width(b) does not necessarily equal width(a+b)
 
5:26 PM
Somewhat ironically, virtually every GUI library that allows you to manipulate text as a graphic element provides functions for determining the size of a text string in pixels, and related info.
 
wim
it's not a property of the bytes/text themselves but up to the console renderer
 
I thought it would be a good idea to switch to categorical dtypes for some string columns, but any groupby operations are horribly slow. Should have just stuck with the excessive memory usage
 
@Kevin You can use a terminal emulator to mess around with that stuff. That'll even handle strings containing ANSI colour & style, and cursor movement sequences.
Here's an old answer of mine that contains a brief demo of pyte, a Python package that emulates a standard VT100 terminal stackoverflow.com/a/30571342/4014959
 
wim
@PM2Ring ah yes cp1252 mojibake. looks like Æá ÆÖó£ޢáñ.
 
do people learn this stuff somewhere are they just born with a magical understanding of unicode and encoding schemes?
 
5:34 PM
You're watching me learn it right now.
I've been accumulating unicode information at a glacial pace for as long as I've been a regular
 
wim
it's the kind of thing you learn at the coalface
 
I just never know when it'll ever become useful, so my brain isn't as eager
@wim ah, people in the biz of l10n and i18n
 
It becomes useful when someone with a name like 田中太郎 needs to use your application
 
wim
@Kevin exactly
 
google translate tells me you're referring to a Mr Tanaka Taro
 
wim
5:37 PM
> Mayans didn't have Unicode; ancient Romans, ancient Greeks, ancient Egyptians didn't too. They all had their own "encodings", and had little to no respect for other cultures. All these civilizations crumbled to dust. Think about it people! Make your apps Unicode-aware, for the good of mankind.
 
90% of my projects are for my own personal use so I can get away with only accepting ASCII data most of the time. But I try to do the right thing anyway.
@cs95 More specifically, I am referring to the name given as an example in kalzumeus.com/2010/06/17/…
 
wim
 
@cs95 I procrastinated for more than a decade over learning about Unicode. My initial impetus was when C added the ability to handle wide chars. It all looked too complicated, and I figured most of my code would only ever need to run on ASCII systems. A while later, I learned a bit about encodings via PostScript, which uses a code pages kind of approach. I successfully avoided learning about Unicode until after I learned Python, and by then Unicode had gotten a lot more complicated.
 
@wim let us assume that users don't exist
 
Assume a spherical user in a vacuum...
 
wim
5:40 PM
25 years of programming, 10 years programming Python and it's the first time in my life I'm understanding encodings so clearly. — Oli Dec 16 '08 at 7:56
 
Unicode went from "impossibly cryptic" to "merely very difficult" once I upgraded from 2.7 to 3.X
 
wim
how do you quote a part of an answer, with the link, in one message? rather than what I had to do above
 
Microsoft was an early adopter of Unicode. Unfortunately, they locked themselves into a 16 bit scheme. And then the Unicode consortium decided that 65536 code points just weren't enough.
 
@wim can't
 
I don't think there's an automatic onebox that can quote a piece of an answer. But perhaps you could cobble something together with the > quote signifier, plus a hyperlink on the name/date
> Namespaces are one honking great idea! — Peter P. Python, Jan 1 1970
 
wim
5:43 PM
@Kevin what's with the weirdo user interface for codecs.register
 
@Kevin extended keyboard set ascii codes required be display in appropriate terminal which could display it
 
@wim I guess they want to make it easy to register an entire category of classes at once. Or something?
By accepting a search function, you could register an unlimited number of codecs, even
Kevins_cool_codec_1, Kevins_cool_codec_2, ... Kevins_cool_codec_999999. All recognized by one search function that uses name.startswith("Kevins_cool_codec")
 
I've found lots of useful info in Martijn's answers to Unicode questions. I guess other people have benefited from them to, since he's had the Unicode gold badge for quite a while.
 
@wim This is an eye opener, I read it 5 times to make it sink in. Too bad it hasn't been updated for python3.
 
My uninformed perception is that when it comes to unicode 90% of the 2.7/3.X difference is the names of the types.
 
5:52 PM
str v/s unicode?
 
Most of the fun unicode facts written for 2.7 audiences also applies to 3.X if you replace "string" with "bytes" and "unicode [object]" with "string"
 
this just makes me all the more glad that python2 is being (pyth)offed
 
Is # -*- coding: utf-8 -*- still a thing in 3.X? I feel like I haven't seen it in a long time.
 
@Kevin It's optional, but not required, since UTF-8 is the default encoding in 3.x. And IIRC, it's recommended to not add the encoding directive unless you're using a weirdo encoding.
 
An important milestone in my not being baffled by unicode is the realization I could quietly ignore coding: headers as long as I didn't use any non-ascii characters in my source code. That cut my confusion approximately in half
 
6:01 PM
Or if you need it for a program that works in both 2.x and 3.x.
 
I could still print unicode, and read unicode from files, etc etc. One less variable in the puzzle.
 
@Kevin A vast proportion of SO Python question about Unicode involve confusion relating to the coding directive. And a lot of answers and "helpful" comments share that confusion.
 
wim
@Kevin in practice, the big difference is the implicit conversions (lack thereof)
 
I notice that 2.7 allows b"hello" + u"world" but 3.X doesn't. Interesting.
 
wim
yes, and that is huge in webapps (many written in 2.7 and - correctly - assuming it promotes the result to text. but is runtime crash on 3.x)
 
6:07 PM
Ah, right. We had a user in here last week with exactly that problem
 
wim
and this
>>> b"hello {}".format(u"world")
'hello world'
>>> u"hello {}".format(b"world")
u'hello world'
if you put hello in the source code it's str but world is probably coming from database or request or something, and it's unicode
 
@cs95 Virtually everything in that answer applies to both versions. But it would be nice to have a final section that explicitly mentions the differences.
 
@Kevin One of Zed Shaw's biggest hangups about Py3 was that it does not permit this
 
wim
I don't really think the answer needs any edit. That "I'm having the same problem" answer needs to be deleted though.
 
3.X Nixing all the implicit conversions was probably good for me, ultimately
 
wim
6:15 PM
@PaulMcG yes, and Armin's too (creator of flask)
 
Otherwise I couldn't have graduated from a mindset of "they're basically interoperable string types, and one of them is weird"
 
wim
It is (was) a divisive issue. Are you a "rip the band-aid off quickly" or "peel it back slowly" kind of person.
 
It's not very often you're allowed to introduce breaking changes into the language. Now or never!
 
with the confidence of ignorance I can say that I'm glad that bytes+unicode is forbidden
 
wim
Ned Batchelder's unipain is a good bookmark too.
 
6:18 PM
unless we're talking about .format now
 
wim
It's better now but there were pretty big downsides too (very slow adoption of Python 3, alienating some pretty productive developers such as armin or losing them to other languages)
 
I sometimes wonder about the alternative timeline, but I hope that python would be all the more confusing now. Like PHP with multiple contradictory ways to do things.
 
@AndrasDeak It was definitely the only sane way to go. But it did break a lot of existing code. Or perhaps I should say that it exposed flaws in a lot of existing code. If your code blithely mixes bytes and text strings you're Doing It Wrong.
 
ah, indeed NAA
 
wim
6:24 PM
@PM2Ring unfortunately there are some domains where you do often kind of need to do that (low level socket programming, http headers stuff, linux filenames which are just bytes )
and if you have a clear idea of the Python 2 "model" and aware of how the types are coerced, it's not necessarily "Doing it Wrong" to have intentionally relied upon it
 
I stand by my earlier statement that features that are too easy to use wrong are bad
@wim it seems personal, you also got downvotes on an opinionated-closed question and an answer of yours on the same day
 
@wim Yeah, ok. Although in recent Python you can be a bit more explicit about that, by using b-strings. And it was a good idea to add explicit u-strings back into Python 3. But even with both of those features it can be tricky to write code that does anything beyond basic Unicode handling that runs correctly on both 2.x & 3.x.
 
I looked at other dupes of one of your downvotes-delvoted dupes, and the top ones don't seem to have delvotes themselves
 
wim
@AndrasDeak huh, how you can see that?
but yeah, you are correct - that sentinel one
 
I can see your rep changes that aren't due to you voting.
only answer-downvote-rep-loss is hidden in your public rep history
and some post deletions I guess
 
wim
6:33 PM
TIL
that other one probably is downvotable TBH (but I don't know how/why anyone found it)
@AndrasDeak True. They made a good choice. But failed to see the demand for cross-compat libraries
even the u prefix didn't arrive until Python 3.3 (!)
 
cross-compat as in 2-3 polyglot?
 
wim
yes
python core dev assumed "well nobody would want to do that. they can just use 2to3"
but 2to3 was absolute garbage
 
Beyond the impossibility of guessing what the dev wanted? I've never used it.
 
wim
@Kevin I'm actually kind of surprised there's not something like your "all_escapes" encoding in stdlib
 
this might be a silly question, but if characters can take anywhere between 1-4 bytes when encoded, then how would one know how many bytes to take at a time while decoding?
 
6:40 PM
Hey, good afternoon. I need help with something that I'm struggling in Python.
 
@wim Likewise. I was looking for one this morning and couldn't find one.
 
Basically I need to do a crawler that extract all the links in a website. I know how to do it.
 
wim
The four 1s mean that the encoding is 4 bytes long. The 10 starts each continuation byte. — Ignacio Vazquez-Abrams Mar 24 '15 at 6:04
@cs95 ^
 
But in other point, I need the application to scale to handle multiple sites.
In that part I'm lost.
 
@cs95 I vaguely remember that also being explained by deceze, not sure though
 
6:43 PM
I though in something like kubertenes or docker.... But I want something more simple. Something Inside just python.
 
oh my lord, it's all so clear now
 
I'm a little lost. I need ideas. Thanks!
 
> It has elaborate ways to use the highest bits in a byte to signal how many bytes a character consists of. This can save space, but may also waste space if these signal bits need to be used often. UTF-16 is in the middle, using at least two bytes, growing to up to four bytes as necessary.
gotcha
 
@VictorMartinez Surely there is such a thing already in PyPI - why write from scratch?
 
@VictorMartinez So you already have code that scrapes the links of one website, and need to scrape multiple websites? I suggest a for loop.
#If your code currently looks like this:
url_to_scrape = "www.example.com"
all_links = ??? #insert code here to get all links
print(all_links)



#... Then change it to this:
urls_to_scrape = ("www.example.com". "www.google.com", "www.python.org")
for url_to_scrape in urls_to_scrape:
    all_links = ??? #insert code here to get all links
    print(all_links)
 
6:50 PM
I get it. If that's the solution I can use it, but this is for an interview and I suposse that they need to see something more "pro" (?), like something that handle queues.
 
Hmm. Something with threads, maybe? I forget if HTTP requests typically engage the GIL.
There's always multiprocessing.pool, which doesn't give a dang about the GIL
 
@Kevin ... and is actually able to use multiple cores, instead of just CPU-I/O overlapping in a single core.
 
@cs95 If you'd followed my links in chat.stackoverflow.com/transcript/message/46396522#46396522 you'd already know the answer to that. ;)
 
wim
@cs95 good to hear!
 
I suspect a program like this is mostly bound by network I/O, so if HTTP requests don't block the GIL, single-core threading would still be faster than a regular for loop
 
6:55 PM
@PM2Ring ah, my bad. Wasn't following the discussion at that point. Will take a look :)
 
@cs95 No worries.
 
@VictorMartinez If you are going into an interview and are expected to know how something like this would scale, it would be good to learn about threading, multiprocessing, and async processing. There are many tutorials out there, far more thorough and thought-through (though perhaps less entertaining) that what you will get in this chat.
 
wim
don't you love those moments of clarity. my most recent was finally understanding the timezone model in python (and the horror at realising how much broken code I must have out there in the wild where I've used the tzinfo kwarg creating a datetime)
 
@Kevin I have used multiprocessing.pool.ThreadPool to good effect for these kinds of things, but you are ultimately still using just 1 core.
If @VictorMartinez really needs to scale this up, a lone core won't cut it
 
All right
I get it
I'm going to read more about that.
 
6:58 PM
Sep 15 '18 at 19:25, by PM 2Ring
Cabbage @AnttiHaapala If you think datetime is a mess, you ain't seen nuthin'. Take a look at the insane history of UTC, summarised by astronomer Steve Allen of the Lick Observatory. Be warned, even the summary is rather large... http://www.ucolick.org/~sla/leapsecs/timescales.html He briefly discusses some of the key issues here http://www.ucolick.org/~sla/leapsecs/
 
I have used threading before in other projects
I am going to read more and to try to solve it
thank you very much!
 
Excellent! But be aware of its pros and cons too, such as the GIL business
I'm just happy I was able to use (and spell) the words "through", "thorough", "thought" and "though" correctly all in the same sentence
 
cbg
 
@PaulMcG Oh yes, my native language is not english... And is hard as hell to use that kind of words.
 
@VictorMartinez Hmmm, May I ask you what is your native language?
 
7:05 PM
Spanish
 
wim
@Kevin I think your "registering codec" idea would make a better answer than the accepted one here: How can I get python ''.encode('unicode_escape') to return escape codes for ascii?
 
The principal problem is that I learned English by myself, I lack a lot of things that people learn at school.
 
@X4748 please keep such wishes elsewhere
 
I have the same problem, except I'm ok with English lol
I mean I'm not a native English speaker
 
7:10 PM
I also wish the moon was made of cheese, but we can't always get what we want
 
wim
classic Andras
 
evil incarnate; it's what I do
 
wrong time to boast
 
@AndrasDeak What's the problem... I don't understand why you guys hate this kind of requests...
 
I've just explained ^
 
7:12 PM
@X4748 simply put
 
Hold on, I thought your post was weird too - sounded a lot like mooching for upvotes
 
The site moderators really don't like it when there's anything that looks remotely like a voting ring on the site
 
@PaulMcG er, who?
 
I also tend to personally hate anything that looks remotely like someone asking for upvotes or downvotes
 
Unhappy moderators are very good at making room owners unhappy; ergo, room owners will try to keep moderators happy. It's the circle of life
 
7:13 PM
yes, even if they're saying so ironically
 
@cs95 I was referring to @X4748's post, which has gone the way of the cutlery
 
ah
 
wim
also asking for an upvote has this other effect in practice
 
As the saying goes, if wishes were horses, wishing wells would fill up very quickly with drowned horses.
 
@wim That too. Especially from someone who has 0 score in .
 
7:15 PM
@PaulMcG That's right... But I think it's not a big deal, at least here at StackOverflow... Besides, 1 reputation won't change things a lot...
 
just to be clear, this is not up for debate
 
Voting rings are, in fact, a big deal.
 
protip: don't wait for a mod to tell you this
 
@Kevin But I like how you guys respect the law, That's nice.
 
looks like someone was nice enough to upvote one of your posts. good for you
 
7:19 PM
Wow... Thank you all ... :D now I can downvote questions
 
you're definitely not welcome
 
What a glorious day
 
You will never know in your heart whether that point was earned, or just pity
 
oh they will know
 
did you know you lose 1 rep for every downvote?
 
7:20 PM
I'm hoping for the former
 
@X4748 It's not just about respecting the law, it's also about trying to promote positive aspects of Stack Exchange culture, and discouraging the negative aspects.
 
@cs95 nope
 
@wim that gif while amusing, is also very distracting
 
questions... @cs95
 
wim
7:21 PM
@Kevin wild speculation: someone probably proposed such a codec, and was shot down on a mailing list because in the purest form, this is just built-in functions ord and chr anyway
 
1 Single reputation to achieve what I want
 
ok, and you're telling us this because.....?
 
@X4748 I'm sure whosoever upvoted (if at all from this room), did it because the question was actually good
also, I think Andras might wanna jump in here & stop the discussion since we're stretching it a bit :-p
 
This is very much a "quit while you're ahead" situation
 
7:22 PM
too late
 
@shad0w_wa1k3r Actually good questions never get enough upvotes... Those are the simple questions which get upvotes
 
wim
@Code-Apprentice sorry
let's chat
until
its off page
 
it's alread out of my screen, and I have a largish screen
 
this has been fun, brb, time to shop groceries
 
just zoom in
 
7:23 PM
^^^
 
Most browsers have dev tools that can delete html elements (such as images) from a page, if a gif is truly annoying and it doesn't seem like anyone's doing anything about it
 
Somebody downvoted one of my answers...
 
e.g. Firefox's "inspector" window, accessible via ctrl-shift-c
 
I always press f12 and find the right tab
 
@DeveshKumarSingh closed
 
7:28 PM
Speaking of rep, a whole lot of people lost a bunch of rep quite recently. See meta.stackexchange.com/q/328642/334566 The reason was due to a user deleting their account, but there was no reason given for that deletion...
 
might have been voluntary
 
@PM2Ring I wasn't affected. Can we infer which main tags it was? (by looking at the primary tags of the users who said it affected them)?
 
@wim much better
 
@smci it seems most of it was on the network other than SO
 
@smci What Andras said. There's some info on the linked page, and more on recent pages it links to. Lots on Politics, a fair few on Physics.
 
7:34 PM
the last time there was a huge rep loss across users on SO (that I know of) it was an elaborate sock puppet of a 10k+ user
 
is there an SO drama bulletin board that I'm not subscribed to?
oh, meta
 
Well there's the community bulletin :P But I heard this one in the matlab room
 
cbg. Question and on this I just started looking into code to expand a regex-like pattern into all possible matching strings, e.g. expand r'A[LKZR]|C[AOT]|DE|FL|GA|HI|I[DLNA]|K[SY]|... into all US states. The old question link I give is well-defined, has a perfectly clear example and should not have been downvoted....
 
It wasn't a good time on Physics for some people. About a week before that, a very prolific contributor decided that he needed to focus on study and stop his Physics.SE addiction. So he deleted his account. He assumed the deletion would only affect recent votes, but that's not the case. So several Physics regulars lost hundreds of points that day.
 
they usually say that the reason CM's have to be involved is to ensure that this doesn't really happen...
 
7:38 PM
... Also related, a SED/AWK/YAML asking of the same idea. But its answers are not at all for arbitrary regex syntax (a very broad question), only simple kludges for the very simple example given: non-nested parentheses (create|delete)? Want to see [...] or ['^...] groups, +*? repletion operators, nested parentheses, ideally multiple capture groups, backreferences, maybe lookahead assertions, ...
 
@wim I was thinking about it, but I think he wants to be able to encode a string into a string, and I don't think registered user-defined codecs can do that? I just tried and it crashed with TypeError: 'all_escapes' encoder returned 'str' instead of 'bytes'; use codecs.encode() to encode to arbitrary types
 
@AndrasDeak Yes. He didn't think to contact a CM first. He did pop into The h Bar to apologise, though.
 
I thought high-rep deletion requests always go through a CM...
 
Little bit of a double standard if so, since there are built-in encodings for both bytes-to-bytes and str-to-str
 
@AndrasDeak Sound like SO/SE needs a "Looks like you're trying to delete your act. Do you really just want to suspend/put it on hold?" wizard. Talking paperclip optional.
 
7:40 PM
Although the latter category contains only "rot13" so it's kinda more like an easter egg than a real feature
 
@smci I think you have to confirm 24 hours after the first request that you're sure, like getting married in some legislations :P
 
@smci Sorry, that's Too Broad to re-open. There's not even a hint of a code attempt.
 
Or, hmm, you can't pass "rot13" to bytes.decode or str.encode, so maybe it's not a double standard.
 
@AndrasDeak ... "Do you really just want to suspend/put it on hold?" wizard: it would be useful to give departing users a canned list of reasons to choose from (Reducing my involvement on SO/ reducing my involvement on social sites in general/ To prevent my past answers showing up in search results/ To protect my privacy/ Other)
 
@Kevin In Python 2, you can even use a coding directive to select rot13 as the encoding of your script.
 
7:44 PM
Finally, the source code obfuscation feature that users have been clamoring for! :-P
 
wim
@Kevin do as I say, not as I do!
 
@smci Hitting this with regex is X-Y-ish. There are several simple Python-only solutions that a new coder could easily attempt (such as nested for-loops, or itertools.product of lists of the various options), without resorting to RE trickery. It would be like asking how to iterate from 0 to 9 using regex (for i in [int(x) for x in inverse_regex(r'\d')]:) if only there were a way to invert a regex in python.
 
@PM2Ring You missed my point, PM. I independently just came up with the same issue ("expand r'A[LKZR]|C[AOT]|DE|FL|GA|HI|I[DLNA]|K[SY]|... into all US states"). I'm not knowingly going to ask the third duplicate, so then what am I supposed to do?
 
That question is not worth reopening. Just a text dump without any attempt at code.
 
wim
@PM2Ring I did that in a Q&A once and got heavily downvoted for it :)
 
7:48 PM
@smci As to your own endeavors, I have a pyparsing example invRegex that will parse regex within reason, and return a generator of the matching strings. It includes samples the generate the chemical symbols and the US timezones, doing the US state abbreviations should not be difficult.
 
Would it be reopenable if it did have a code attempt? ... What if the code attempt was edited in by someone other than the OP?
 
@PaulMcG Uhuh, but as I showed the question was also asked for YAML/AWK/SED(/PERL?) command-line stuff. And you can't easily use ` itertools.product` to expand excluded character classes: [^B-F3-6]. You'd need to use either set subtraction, or a for-loop/iterator with an explicit exclude clause.
 
Very true - my simple example does not deal with excluded sets.
 
Are there no suitable dupe targets to add rather than reopen?
 
wim
@smci it's borderline ... looks a bit like a library/tool request
 
7:49 PM
oh, it's not a dupe
 
wim
I'm conflicted about whether library/tool requests should actually be off-topic on stack
 
@PaulMcG Sure. But you guys haven't addressed my basic point. Given the question was already asked (poorly) previously and closed, should I now ask it as a duplicate, and suggest the rest of you close that previous asking into mine (possibly opening me up to accusations of rep hounding?)
 
wim
these are actually some of the most useful/helpful content ... even if it's officially off-topic
 
I think the main reason it's off-topic is that it gets obsolete even quicker than the usual content, and there's no way the community is going to curate all those posts
 
@wim I mean "same concept, different language/tool stack, different example regex". "Related asking for YAML/AWK/SED(/PERL?) command-line stuff" rather than exact duplicate.
 
wim
7:51 PM
why is there no way the community is going to curate them?
 
@AndrasDeak I volunteer to curate those questions, for Python/PERL/SED/AWK/*grep... Anyone want to join me?
 
We already have plenty of highly upvoted answers from five years ago that contain outdated information, and that's just for changes to the language/stdlib
 
@wim Because if you allow tool recs than you'll have a bunch of such posts, most of them probably low-quality, and the few gems might get curated, might not. And there might be the increased chance of opinionated/spammy responses.
 
because it is usually easier to delete off topic content than maintain it
 
@wim probably because the people most likely to come across those posts at a later date are the ones that are looking for a library. So if the answer is obsolete, they're not really in a position to update the recommendation
 
7:52 PM
there were a few curated off-topic questions, like a definitive C(++?) books list. They get challenged and closed and deleted every now and then I think... even though they are meticulously curated
 
wim
@AndrasDeak this is meta grumps overstepping their mark
 
I have seen a lot of tool requests in the moderation tools queues slated for deletion
we have come quite a ways down the path of the delvote
 
wim
what the rep needed to see (other users) deleted posts? not mentioned here
 
wim
thanks
 
7:54 PM
you can also only search your own deleted posts then which is stupid
 
wim
huh, edit tags inline was 10k only feature
 
yup, but we still need those not to bump a question or push them to reopen
 
wim
yeah and I can never remember whether it is:deleted or deleted:yes or whatever
 
@AndrasDeak Please don't hijack my request. That one is not "tool recs". It's asking "how do I do X in YAML/AWK/SED(/PERL)". That is on-topic and supported here. (To make it objective, just give whichever of those four tool/language solutions is shortest, simplest and most performant)
 
wim
SOQL
 
7:56 PM
@wim Oh well. I bet if it survived, it would have hit the HNQ. ;)
 
@smci I wasn't talking about your things beyond that message and the next
the rest is aimed at wim, hence no reply
 
What canonical do we have for boolean expressions in if statements. I mean like this newish question: stackoverflow.com/questions/56433713/…
 
wim
@PM2Ring yeah, haha
 
@Code-Apprentice All the ones it was closed with? :P I assume the close came just as you were typing :)
 
@smci I think this room generally skews in the "pro" direction for creating canonicals and dupe-closing older badder versions of the question. So at least the rep hounding revenge squad will not originate from here.
 
7:57 PM
@wim comprehensive search guide here
 
@roganjosh someone beat me to the close votes...had to refresh the page to see them
 
there's also a drop down "Advanced Search Tips" you can click when on the search window
 
Posting under Community Wiki is a good way to eliminate the appearance of rep-hunting, although I think it's a bit silly
"Oh no, this guy improved the site, not out of the goodness of his heart, but so he could gain points that are awarded for improving the site! Let's get him, boys!"
4
 
@Kevin Ok but the crowd on Meta is quite fierce... did you all give me consensus to post my asking (as long as I show up my own pyparsing code per @PaulMcG's recommendation)?
 
@Kevin the devil is in the detail of "improving the site"
 
7:59 PM
@Kevin why does this sound so familiar
 
Does the Rep Hounding Revenge Squad have a secret handshake?
 

« first day (3152 days earlier)      last day (1791 days later) »