« first day (2602 days earlier)      last day (2355 days later) » 

12:00 AM
IPython uses IPython.lib.pretty for pretty-printing, with source code here‌​.
 
In [12]: ip = get_ipython()
In [16]: ip.display_formatter.formatters
Out[16]:
{'application/javascript': <IPython.core.formatters.JavascriptFormatter at 0x7fb4f45b56a0>,
 'application/json': <IPython.core.formatters.JSONFormatter at 0x7fb4f45b5240>,
 'application/pdf': <IPython.core.formatters.PDFFormatter at 0x7fb4f45b5278>,
 'image/jpeg': <IPython.core.formatters.JPEGFormatter at 0x7fb4f45b5550>,
 'image/png': <IPython.core.formatters.PNGFormatter at 0x7fb4f45b55c0>,
 'image/svg+xml': <IPython.core.formatters.SVGFormatter at 0x7fb4f461bc50>,
 
I feel like IPython or Notebook are capturing the .... well yeah, thats useful
 
sauce laurel... I'm going to call it sauce code from now on
 
too bad I was badly user'ed
I mean, what I pasted doesn't really tell how the plaintextformatter works, where pretty probably comes into play
 
12:05 AM
both were useful. thx for the assist
 
12:20 AM
TIL the writers of Futurama proved a mathematical theorem for the sole purpose of advancing the plot of an episode arxiv.org/abs/1608.04809
I always think to myself that I should rewatch that series but then I remember all the heartbreak :(
 
12:39 AM
Any recommended book for network programmers using python?
 
Ooof I could really do with one of those.
@overexchange A quick google returns this never even heard of it but I dunno.
 
wim
12:58 AM
@user2357112 multiprocessing's pool has already done most of the hard bits
 
(lambda:1).__class__ results in function. But how do I refer to the function class without having to reduce myself to such shenanigans as (lambda:1).__class__?
 
@piRSquared: import types; types.FunctionType, but the types module does basically the same thing.
Source here, where it just defines a function and calls type on it.
 
1:13 AM
really? Thats funny!
Thanks tho
 
@wim: But multiprocessing expects to be able to do things like import __main__, which won't work if __main__ is written in the wrong Python version.
It generally expects to be able to import everything the master process used without running into crazy version conflicts.
 
Full working example
ip = get_ipython()
ip.display_formatter.formatters.keys()
text_formatter = ip.display_formatter.formatters['text/plain']

def _ppf(arg, p, cycle):
"""
Pretty print a function
"""
p.text(arg.__name__)

text_formatter.for_type(type(lambda:1), _ppf);

f = lambda x: 1
f.__name__ = '*f*'
f

*f*
 
Well rhubarb it seems. ; )
 
cbg
quite a long time since my last cbg
 
 
1 hour later…
 
2 hours later…
4:32 AM
Noob question: vim module is a built-in module of python 3?
 
@TuyenPham No, it isn't.
 
So where is it? I saw some vim plugin that import vim but there's no file named vim.py in the whole project.
 
4:50 AM
@TuyenPham I don't use vim, but there's a package on PyPi: pypi.python.org/pypi/python-vim/0.3
 
I had vim with python3 enable on it. Is that can be assumed vim module come from that feature of vim?
 
5:18 AM
consider an object name obj and it having 5 attributes. If I change 2 of these in a function how can i get the latest updated values only??
 
5:43 AM
@Ananthu Your question isn't completely clear. A MCVE might help.
 
6:00 AM
cbg pythonistas
 
cbg
 
6:19 AM
cbg
 
I don't know who mentioned y-combinator the other night, but it has sent me down a rabbit hole that I cannot escape. My code above was me hacking IPython to autoname my church numerals. I haven't had this much fun learning something new in a long while... And I have to stop in order to do work... /sigh
 
@piRSquared Probably Kevin.
 
Is setuptools support python3 now? I read an article that says Distribute is a replacement for setuptools.
 
If anyone is interested in my messing around pastebin.com/qFA7yrMn
 
l = [1,2,3,4,5,6]
 
6:32 AM
I'm with you so far...
 
a dict having to many keys and values. If I am having a list how can I make a new dict or modify the current dict to only the if the key in the list
 
Use a dictionary comprehension
{k: v for k, v in dct.items() if k in lst}
Or
{k: dct[k] for k in lst}
Or
dict(zip(lst, map(dct.get, lst)))
 
6:52 AM
@TuyenPham: vim is not a module built into Python. Python is a feature built into vim. The Python built into vim has a vim module.
 
cgb
cabbage
 
7:10 AM
@user2357112: Do you have any docs to this related topic? How can I locate and see what is inside of vim module. I need to have a look at its functions/class/atrrs.
 
I'm having the same problem as described here:
https://stackoverflow.com/questions/29567003/connection-reset-for-multi-part-file-upload-using-requests-python-library

A small file works, but a file of ~21MB results in the error.

Why does the size of the file affect the request? Is it some missing library that may be causing it?

Thanks for any help
 
The docs are probably also available through vim's built-in help facilities.
 
7:25 AM
@arcticfeather Just a guess, but maybe the server has a size limit on uploads?
 
7:45 AM
It's not reaching the server, it fails before making the request.

Both the request and the sever are running locally.
 
tmp rbrb
 
8:06 AM
cbg
 
8:41 AM
@Code-Apprentice ^
 
9:30 AM
@AnttiHaapala nice!
 
not my pics tho, from newspaper
 
9:41 AM
Cabbage
 
10:33 AM
cbg all. Ok Andras I wil do it that way in future.
 
re-cbg.
 
or regex-cbg : P
It seems when I usually come this room is almost empty.
 
I keep seeing questions where newbies are making programs that store & retrieve plaintext passwords. I guess it's an ok exercise in text processing, but it still makes me uncomfortable. Hopefully, nobody's using these programs to manage real passwords, but you never can tell...
It's normally more active here at this time of day.
 
Unfortunately I can't usually come here at this time of day.
Yes without encryption or anything it rather frightening. : D
a = input(), if a == 'password':. That will keep everyone out for sure.
 
10:50 AM
because it’s a syntax error? :P
 
Fixed.
 
cryptography is a rabbit-hole though. Nothing is ever really secure, so it usually comes down to making it as secure as the least secure part of your system that you have no control over. and getting that info from someone who just wants to test their website login.. takes a while
 
It is more of turning it into a maze rather than a rabbit hole then.
 
kind of
but i don't like the analogy of security as a maze very much, because it encourages implementing security by obscurity. Which is horrible.
 
Well what to compare it to then?
 
10:54 AM
I am thinking of another analogy than "a lock", but that's really it
A lock which is really hard to pick, unless you own a key
 
@Simon Normally, you don't store encrypted passwords, you store the password's hash, using a strong cryptographic hashing function iterated in a special way, eg scrypt, PBKDF2, or bcrypt.
 
@PM2Ring To latch on to that example, some people I know would argue that hiding the hash file in a weird location would increase security. Which is wrong. It just decreases maintainability.
 
@ArneRecknagel I agree. Security by obscurity achieves little apart from a false sense of security, at the expense of making systems harder to write, test & maintain.
 
That would depend on how keen they are to get the password.
 
11:02 AM
Haha. It does decrease maintainability.
Which is just what we would want. The latest security system: "Next update 4 years time."
This is an important factor. If it is difficult to maintain updates will be less frequent and that is a hazard in itself.
Unless more people maintain it.
 
the point is also that obfuscation doesn't make a system more secure
 
11:31 AM
Blimey I'm back quickly. I didn't see where I last left a message. : o
 
12:12 PM
In [143]: mar.groupby(["date","acc"])['VAL'].max()
Out[143]:
date      acc
20171116  3091     24.0
          3090    13.0
          3099    25.0
20171117  3091     24.0
          3090    13.0
          3099    25.0
 
how can I confirm that in the string x= 'a b ' are the same characters like in y = 'b a ' ?
maybe there is some functions in python to compare arrays?
 
In the above group by I need a formatted op like below:
date, 3091,3090,3099
20171116,24.0,13.0,25.0
20171117,24.0,13.0,25.0
 
@Suisse One way is to use sets, if there aren't repeated chars, or you don't care about the char counts. Another way is to sort then compare.
@Suisse What's this got to do with arrays?
 
@PM2Ring I didn't know you can sort a string.. so thats why I would first use .split(" ") to make an array with all the characters and than sort and compare them with another
 
@Suisse .split creates a list. Python has several array types, list, tuple, array.array, and then of course there are Numpy arrays. So you should use the correct terms to avoid confusion.
But you can pass strings directly to the sorted function, it will create lists from any iterable, and then sort them : sorted('b a ') == sorted('a b ')
But using sets is faster: set('b a ') == set('a b ')
 
1:12 PM
Is it ohk if someone undeletes an answer by editing looking at the other answer ? Since they posted something wrong early still makes them look like original.
 
@Bharath It's ok for people to delete their answer if they realise they made a mistake and then to improve it and undelete. And in some situations they may end up writing code that's similar to other answers. However, copying other people's code without giving proper attribution is bad.
OTOH, it can be very hard to prove that someone is copying, especially if the code is fairly short. And especially in Python where "There should be one-- and preferably only one --obvious way to do it".
 
It happens to me so many times, yet I'm bearing all that and let their answer accepted.
No credits is even worst.
 
A week or so ago I submitted a short answer at almost the exact same second as someone else. Our codes were almost identical, we even (mostly) used the same variable names. But it wasn't possible that we copied from one another.
 
Hey guys! So I've got a file which contains combined instances (list of numbers) for some data mining stuff. I then proceed to put all the lines with '@' to both training and testing files. Now I want to put 28,709 instances to my training set and then the rest of the files instances to the testing set. When I do this, with this code gist.github.com/ryankshah/0b96a23b5094a01983278204ce37cff3 - it doesnt do all the instances to the training set and doesnt output anything testing set.
 
@Bharath The moderators take a very dim view of plagiarism. If you think people are really stealing your answers, keep a record, and if the same people keep doing it, there are ways to let the mods know, and they can investigate.
 
1:20 PM
Cool beans cabbages... my first bonus points answer :) stackoverflow.com/questions/47476809/…
YAY!
 
Congrats! @Re
@ReblochonMasque
 
Ohk. I will start keeping the record.
@ReblochonMasque why isn't pandas tagged to the question
 
I really should check out matplotlib some day...
 
Anyone good with dealing with files?
 
Thank you.
Ask away rshah, don't wait for someone to commit.
@rshah
 
1:30 PM
I sent my question above but it is now also here: stackoverflow.com/questions/47574672/…
 
Hmm, what is if linecount > (linecount + 28709): supposed to do? What value of linecount would cause this conditional to be true?
 
well linecount originally goes to where the last '@' is
and then I want to get the 28709 lines after the last '@' line to put into the training file and then the rest after into testing
 
You should probably fix that if, then.
 
Think that's the issue?
oh
is it because linecount is always increasing? haha
so that condition is never met
 
@rshah That doesn't answer Kevin's question. It's impossible for linecount > (linecount + 28709) to ever be True
 
1:35 PM
I think you're trying to do something like "when linecount attains a value that's 28,709 larger than what it is right now, do <thing>", but you can't get that kind of complex behavior out of a simple if
 
Couldn't you could just loop linecount times, dropping the lines, then loop 28709 times after that, keeping them?
 
I replaced the first linecount in the if with newcount and then incremented newcount at the end.
 
Most programming languages do not have the capability of doing that kind of asynchronous work, where you say "hey, when this condition becomes true at any point in the future, do this thing"
 
Apart from event binding...
 
Right. Event binding exists, but usually requires a framework of some kind, beyond whatever syntax elements are available to you out of the box.
 
1:38 PM
But really we shouldn't be answering a one minute old question in here.
 
Even in a hypothetical language where asynchronous ifs were real, the condition x > x + some_positive_value would never trigger, because there language doesn't know which x means "the value x has right now" and which x means "the value x will have when this asynchronous if triggers"
 
That's true.
 
I've got it now thanks guys! But I've got another questions, how can I move x amount of lines from the end of one file to append them to another?
 
You want it to interpret it as when new_x > old_x + some_positive_value but that's only one out of four possible interpretations and the hypothetical language would have to be pretty clever to choose that one over the other seemingly reasonable (to a machine) candidates
 
FWIW, one of the first languages I used, PL/I, had an on(condition) construct, but I don't think I ever used it.
 
1:45 PM
@PM2Ring how can I move (and remove) x lines from the end of a file and append them to another file
 
@rshah If I knew I had enough memory to load the entire contents of the file at once, I'd probably do something like other_file.writelines(one_file.readlines()[-x:])
Doing it without loading the whole file is trickier, since you don't know ahead of time how many lines the file has, so you don't know when to start writing. So you'd probably need to do two passes, the first one for line counting, and the second for writing.
 
@rshah First, find the location where those x lines start, and save that information (eg by using the file's .tell method) then copy the lines to the new file. Then use .seek to rewind the file back to the start of the x lines, and use the .truncate method to chop the file at that point.
I'm kind of curious about this OP's 12 byte floats. Pity he can't post a specification for them... stackoverflow.com/questions/47573735/…
 
2:01 PM
cbg
I need to integrate rules engine i am thinking of using Drools with python
is there any better rule engine that i can integrate with python
 
Prediction: OP will reply to my post saying "this works, but now I have this other problem..."
 
2:30 PM
@AnttiHaapala Does that replace the other sign that I posted a while back?
 
@Code-Apprentice yes.
 
That was my only guess why you even pinged me ;-)
 
that's the welcome sign for this year's Slush conference
 
@rshah copy and paste?
@rshah Okay, I was just kidding. I suggest that you step away from your computer and get a piece of paper and pencil. Write in words the steps you need to take to solve the problem.
Once you have a clear idea of the steps required, then translate the words into python code.
 
2:37 PM
His question on the main site got an answer so he may not be interested in this problem any more.
I suspect this is the case since he didn't respond to any of the messages directed at him since his last message
 
DSM
Thursday morning cabbage for all!
 
Making some headway in my "versatile word pair" problem from yesterday... If my code is working, it should identify roughly half of all interesting pairs in a few minutes. Where "interesting" means "the space is in a different location in the reversed word pair"
Finding all non-interesting word pairs is very easy; they're just the combination of all pairs of words which can be reversed to yield a new word.
Probably not going to bother to find those, since they aren't, well, interesting.
And would probably take up like 99.99% of the results list
 
DSM
Yesterday I suffered an attack from a chameleon -- I specifically asked him whether there were only two values, he said yes, and then after I gave him a nice solution he said "oh that's great but really there are other values". I could've fixed my solution but I had just about enough of that character.
 
did you delete you answer and flag the question?
and cabbage
 
DSM
I did delete my answer, but didn't bother flagging the question.
 
knap steels -> sleet spank
epic earplug -> gul praecipe
sneer omegas -> sage moreens
sex okay -> yak oxes
Success! But most results use archaic words. I'd like to sort by actual-daily-use-frequency. But, hmm, that might make a lot of short word pairs float to the top, which isn't interesting...
to not -> to not
we not -> to new
to new -> we not
to got -> to got
we new -> we new
to hot -> to hot
to lot -> to lot
Yep, I was right.
 
3:13 PM
I've built a package that essentially queries data from various sources. I want to make this available to a broader audience (meaning those who cannot import a package themselves) by building a web app. I'm not a front end guy, I have a terrible eye for what's pretty (to others). My question is, what is a minimal suite of technologies to help me put this together? I'm not afraid of a learning curve, but I also want to make efficient use of my time.
@Kevin can you incorporate tfidf?
 
If tfidf just means "analyzing a corpus and constructing a frequency distribution of all the words it contains", that's what I'm doing. I found a recipe online that uses nltk.
Now reading en.wikipedia.org/wiki/Tf%E2%80%93idf... Hmm, I don't know what I'd use as the "document" in the corpus to do the frequency offset.
 
But it should help you down weight those words that are common to many documents.
I'll scroll up to see what I missed (-:
 
But then aren't I just effectively sorting by frequency, but in reverse? So I'd end up with words that appeared once in a manuscript from 1500.
 
well it would sort by the ratio of words found many times in few documents to how many documents the word was found in. So, yeah, you're sorta right. But those should be the more interesting words.
Ahh, but you're trying to avoid archaic words
so sort by absolute deviation from the mean tfidf
get stuff right in the middle. At the bottom, would be super archaic and super common
 
Let's see. Here's the contents of the middle of the collection.
habu sate -> eta subah
puri sate -> eta sirup
pert sate -> eta strep
trip sate -> eta spirt
redip sate -> eta spider
Still pretty obscure.
 
3:22 PM
deviation from the 25 percentile?
fudge it til you like it (-:
 
Yeah.
 
you can even scale the weights of each side of the break point if you wanted to ensure the end of the distribution on either side match up score wise
 
Right now I'm just sorting by the product of the frequency of the four words
 
3:41 PM
One other thought would be to filter out pairs with low scoring tfidf words whose length is less than 4
Or penalize them at least
 
I liked this problem more when it was completely objective. "Now take the results and find the coolest ones" has a million dials I can turn and none of them are labeled.
 
You can label them with names of pop stars... pick the one you think captures the spirit of the dial.
I'd go with animals
rbrb
 
Maybe I'll work on this more later. Or maybe I'll say "maybe I'll work on this more later" and then never work more on this later because I already did the fun part.
 
Hi, all. I'm stuck at a Python regular expression question. I want to find the string "url(...." OtherString" and my regular expression is ptn=re.compile(r'url\(.*\b$').
Here is the code:
s = str('<div class="view photo-list-view requiredToShowOnServer" style="height: 814px" data-view-signature="photo-list-view__UA_1__isMobile_false__isOwner_false__modelParams_1__openAdvanced_false__photoListConfig_1__requiredToShowOnClient_true__requiredToShowOnServer_true__rowHeightMod_1__searchTerm_%E9%95%B7%E5%AE%89%E8%A5%BF%E8%B7%AF__searchType_1__showAdvanced_true__showSort_true__showTools_true__sortM
 
@DSM When I read "attack from a chameleon" I imagined something very different. Quite the let-down
 
3:57 PM
@Stallman In this particular case, you're not getting a match because \b$ tries to match a word boundary followed by the end of a string, but a word boundary only appears right before the end of a string if the last character of the string is a \w character. ">" is not a \w character.
If you delete the ">" so that your string ends with "</div", then your pattern matches.
 
Has anyone here used deap (with multiprocessing ideally)? Not quite sure how to get multiprocessing to work, on the sample program they provided.
It's apparently as simply as putting this in the file:
import multiprocessing
pool = multiprocessing.Pool()
toolbox.register("map", pool.map)
but that seemingly just makes it slightly *slower* rather than faster.
 
@Kevin Oh, thanks, What if I only want to extract the substring like url(//c1.staticflickr.com/3/2795/4432184325_b1f07269c1.jpg)"
 
I'm thinking something like r"url\(.*\)"
 
\(
 
There we go.
 
4:09 PM
@Kevin Thanks, it works. To match the last character in the substring could be better approach to match the white space?
It's hard to match the substring.
 
If you want to match everything up to the end of a string for some reason, you can just turn the "\b$" into "$". There's no reason for you to hardcode what the last character needs to be.
Oh, disclaimer: This is all assuming that the contents of the url will never itself contain a right parentheses. If you're trying to match url(wikipedia.com/Snatch_(film)) or something, then it's going to chop off everything past the first right paren.
But maybe CSS doesn't allow paren-ful urls in the first place, in which case that would never happen
 
@Kevin What if I want to match all the substring in one string.
 
I don't know what you mean.
If you're asking "what if my string has multiple "url("s and I want to find all of them?", you should use re.findall
 
string_= "Thank ySPECIAL_CHARACHTER_MIGHT_BE_HEREu for your help"
I want to find the 'Thank', 'ySPECIAL_CHARACHTER_MIGHT_BE_HEREu', 'for', 'your', 'help'.
Neither \b nor \s seems working.
 
Seems unnecessary to use re at all, in that case.
>>> string_= "Thank ySPECIAL_CHARACHTER_MIGHT_BE_HEREu for your help"
>>> string_.split()
['Thank', 'ySPECIAL_CHARACHTER_MIGHT_BE_HEREu', 'for', 'your', 'help']
 
4:20 PM
> Seems unnecessary to use re at all, in most cases.
 
@Kevin If the original string looks like`url(//.....*` will ends in any character and a space char follows the last character.
'url(//xkjaklsdfjlksdjfkslda;UNCERTAIN AnotherStringHere'
Can I use
ptn = r.compile(r'url\(.\s')
 
"Can I use" seems like a simple thing to answer. Did you try it and find out?
 
That looks like it will match "url(" followed by exactly one character, followed by a whitespace character. So you can use that if you're sure the url is one character long.
 
@davidism Actually it can't work
 
Then why did you ask?
 
4:23 PM
Does CSS allow you to specify a url without a closing paren? That's super gross.
Or are you trying to write a regex that will parse even improperly formatted CSS? You could spend your whole life thinking of ways to counteract typos people might make, and never cover 1% of all of them.
 
@Stallman CSS, like HTML, is not a regular language. You can't parse it with regex. There are Python libraries for parsing HTML and CSS, use them.
 
@Kevin There won't be only one exactly one char.
 
@davidism Oh, I was wondering if there was a library that could parse CSS rules.
In that case, I definitely endorse the "just use a parsing library" approach
 
@davidism What libraries do you suggest, thanks. I don't know what module can I import to parse CSS and HTML.
 
Stop starring everything.
 
4:28 PM
please use stars only for messages that would be interesting to a general audience, rather than as a reward for being helpful
 
@PM2Ring very smart
 
4:43 PM
cbg
 
DSM
Cabbage. Did you ever sort out your ssh thing? Unfortunately I don't know anything about Windows and so I couldn't be any help.
 
Thanks for all. I'll try HTMLparse and some css parser.
 
@DSM Not yet.
I'm hoping someone can up with an answer before the bounty expires though.
 
DSM
Ehh, it's not really an MCVE yet. ;-)
 
(Or at least upvotes the question enough that I can recoup the rep bounty lol)
@DSM Is it not? I feel like it is.......
 
DSM
4:53 PM
Even after adding in the imports I get a NameError on ClientHandler.
 
@JGrindal :P
 
@DSM Well fudgenuggets. Added that in.
 
wait what order do the attributes of the range() function come in? (I should know this, XD)
 
DSM
@JGrindal: gui_login_widow?
 
@DSM well I have no idea what you're referring to.
I definitely didn't just edit that line out.
 
5:02 PM
same here
 
You must be mistaken.
=P
 
DSM
Wouldn't be the first time..
 
What IDEs do you guys use?
 
I use the JetBrains suite
But mostly because I'm a student, so I get the for free.
 
I use VS Code
aah nice.
 
5:07 PM
Oh my good god, I'm an idiot.
 
to many times do I say that while coding
I need a new beta group, any ideas on where to find people?
what 'bout you DSM, what IDE do you use?
 
Thanks for the link but I was just asking out of curiosity, I already have an IDE.
By the way which one do you use?
 
recbg
 
???
Is that a short form?
 
yes
it is short for "cabbage again"
 
well I don't see how that looks anything like "cabbage again" but whatever
 
5:35 PM
"re" is a prefix that often means "again". Or perhaps you knew that already but object to the use of the term "shorten" which you feel should be used exclusively when you remove letters from a word, rather than replace a semantic element from a phrase and insert a different shorter semantic element, not necessarily in the same place
 
Sorry that was rude.
oooooooh
what makes sense
cya
 
PEP 557 - Data Classes looks interesting...
Lots of OO neophytes already assume that instance attributes are defined at class level rather than inside __init__, so maybe this syntax will be a more natural fit for them
 
DSM
I haven't decided what I think about that yet.
 
Most likely all the OO 101 classes will go ahead and use the regular syntax like they've always done, because OO 101 teachers don't spend a lot of their time with their finger on the pulse of new language additions
I'm fine with it as long as we don't fall down the slippery slope of More Than One Way To Do Things, and rest in the valley of Five Mutually Exclusive Ways To Make A Class where javascript is forever trapped
 
Looks like they're trying to standardize the attrs project.
 
DSM
5:50 PM
I don't think I'm likely to get the credit I secretly feel I deserve for predicting a major change in the way Python code looks was bound to come as soon as the original annotation syntax was introduced.
 
I don't like that it encourages empty class variables. Is that just equivalent to = None?
 
I'll place 9999 quatloos in escrow, claimable by you at such time as 3.7 is released and the dataclass decorator becomes wildly popular.
Additionally, quote the above message for unlimited bragging points
 
6:03 PM
I'm pretty sure "Hadoop" is the greatest name ever assigned to anything in computing ever.
 
6:27 PM
I see firefox got a shiny new interface but still hasn't fixed the refresh button problem that I've had for the last year
 
@user2357112 seemed clear to me
 
@davidism: The comments contradicted the question and got really confusing.
 
It's clear now, in the same way an empty room is clear.
 
They don't seem contradictory. They want to know how to ensure all the path separators are consistent after joining two paths of unknown format, on any system.
(I have no idea how to do it, the question just makes sense.)
 
Does it matter, anyway? Windows accepts my paths whether I use \ or /. Are other OSes more stringent?
 
7:12 PM
Windows allows both separators but prefers \\ , Unix only uses /.
The real issue is what happens when you get /a/b\\c.
 
Hmm, I see
 
 
2 hours later…
wim
8:57 PM
Why was this closed as "opinion based"?
It's a great question, and not opinion based at all
@davidism chat.stackoverflow.com/transcript/6?m=40243138#40243138 if you guys want to catch up on an earlier discussion about PEP 557 / attrs
@user2357112 Well, I wrote it in one day yesterday, so it wasn't that tricky.
The important parts were 1) making sure that all the arguments and possible exit values (including exception instances) can be made serializable across the process boundary, and 2) making sure that any code or state depended on in the other process was isolated in cross-compat submodules, not triggering any import of parts of the code that are using Python-3.6 only features.
Things like constant folding were not even an issue, because for my use cases I didn't really need access on the complied code objects.
 
9:41 PM
Just 13 more tag score until I can dupehammer posts tagged with python-3.x and not python...
 
Or reopen them single-handedly.
 
9:57 PM
You can always retag them -> hammer -> retag... so I've heard.
 
10:08 PM
Is there a library that given an object definition (xml or python class) outputs a UI/Form to generate said objects?
 
@wim you could go further in your answer and tell them they could use a try/catch to catch the failure and return the swapped comparison... either way, I agree, good question
 
I'll reformulate my question in the form of the elevator pitch for my next project:
Is there a function that, given a Python Class generates an html form?
Maybe it's a project best suited for a static language
 
wim
10:39 PM
@piRSquared you can't hammer if you added the tag
 
Well then, there you go.
 

« first day (2602 days earlier)      last day (2355 days later) »