@EnderLook There are too many errors in this code - please read some basics on Python classes first. Try to make your class look more like this: docs.python.org/3/tutorial/…
@Chenny I don't think there is any exact formula to say "for x problem, use 14 neurons." In general, don't hard code the number or relationships of the neurons - this is one area of your program where you will want to make many adjustments. You will want to be able to tune your network to work with your input data and application goals.
I was reading Alyssa's post on the 3 best online resources for learning Python.
Most of the resources are fine, like the CodeAcademy one I use when I started with Python
However, one of them attracts pros but also great cons. That learning material is Learning Python the hard way.
As one of re...
I need a hackery shenanigans rating... Suppose I want to interleave a character, say 'X' into every other position in a list of characters say lst = ['A', 'B', 'C'] to produce a new list ['A', 'X', 'B', 'X', 'C']. How hacky is it to '|X|'.join(lst).split('|')?
@piRSquared Readility-wise it's very good, so I'd say it's perfectly fine for short lists (of strings). If you've got a longer list or non-string elements, I'd probably use an iterator approach though
I came up with this monster, but if you split it into multiple lines it should be easier to comprehend: itertools.islice((v for t in zip(itertools.repeat('X'), lst) for v in t), 1, None)
Hi I expected 'KM 100 K3 CHROME FDR' from the function below, but got 'KM 100 K3 CHROME FDR - P '.
What am I missing?
def rstrip_multiple(orignal_string, strip_strings):
t = orignal_string
for s in strip_strings:
if orignal_string.endswith(s):
t = t[:-len(s)]
return t
rstrip_multiple('KM 100 K3 CHROME FDR - P Net', ('Imp', 'Exp', 'Net', ' - P ', ' - Q '))
I would like to point out that even if you replace orignal_string.endswith with t.endswith, then you may still have undesirable behavior: if the input string is 'Foo Bar Exp Imp', then the output string is'Foo Bar Exp', even though Exp is in the strip tuple
The function only strips all values if they appear in the string in the reverse order of how they appear in the tuple.
Hang on, bad example
''Foo Bar ImpExp'' returns 'Foo Bar Imp'
The previous example was bad because it was actually returning 'Foo Bar Exp ' with a space at the end, which is fine because you only want to strip 'Exp' and not 'Exp '
I also saw that problem, but went ahead keeping that in mind Because I didn't know how to assemble the parameter for the regex. But I can attempt with what you gave now
Should there not be an r before the first parameter? Idk regex
OK, that error is because I'm both iterating over a file object and using .readline() on it. Which is damned stupid and I'm offended
In [1]: with open('foofile') as infile:
...: for line in infile:
...: if line.startswith('sentinel'):
...: break
...: while True:
...: val = int(infile.readline().strip())
...: print(val)
...: break
...:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-d3a17e30d38d> in <module>()
4 break
let's ignore for a second the pointlessness of that example code block
Even if said looping and readline-ing is in separate blocks, python2 wants to hold my hands. <What gives?>
Beyond the low quality of the book itself, the attitude the author promotes both in the book and in their public actions is incredibly toxic to the Python community. For a site that prides itself on being nice and professional, this recommendation is extremely dissonant. — davidism52 secs ago
I haven't read the book either, so I can't say in this case
in some cases fictional characters represent notions that one might or might not want to identify with, I assume that's behind most cases of people being worked up over fiction
> There are two novels that can change a bookish fourteen-year old's life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs. -- John Rogers
I see the "There are A and B. One is [long description that sounds like A but actually applies to B if you think about it], the other is A" joke structure often enough that I wonder if it has a Wikipedia article yet
@davidism As someone who doesn't know anything about the book/author, can you reference something that describes those problems in a bit more detail? — Servy1 min ago
Anyone have a decent reference for this? I don't really want to go hunting for articles about ZS and LPTHW.
@davidism well - there's a summary of the book on sopy.... there's also poke's rebuttal and that person's article who's got a picture of a rabbit? evee or something ?
"Hello, yes, I am a concerned consumer and my mustache is definitely not fake. Tell me, does your product remove grass stains and cure stomach ulcers?"
The hard part is not many people write about the person and how their behavior is bad, and I don't go out of my way to keep references about them (or most things).
Best to not get involved with links re: the person... just keep it factual about criticism on the work and let everyone else look further if they choose...
@Servy perhaps a good recent article is this one by Eevee, who's occasionally on SO and is a famous Python dev in their own right. It addresses a recent article the LPTHW author wrote on both a technical and personal level. — davidism59 secs ago
I think the links provided explain clearly enough what LPTHW considers "serious issues" and why they are not actually serious issues. No need to rehash it in here
I think 95% of the resistance is "I remember hearing that there's resistance to Py3, I guess I'll use 2 until the controversy is resolved"
To clarify, I'm not saying "you should just take our word for it that there's no problem", I'm saying "the arguments for whether there is a problem exist out there already and you can find them and decide for yourself if you're curious".
Listening to Subaqueous reminded me of Helix's mixes. I don't even remember where I heard one the first time, although I found them again on di.fm later.
Helix - Island Universe is still my favorite, although the last few he put out are contenders for the spot.
.@eevee thanks for your Python FAQs, they're really well written. 🐍✍️ I hope you'll write more some time! https://eev.ee/blog/2011/07/22/python-faq/
I'm confused about scipy's geometric_transform example docs.scipy.org/doc/scipy/reference/generated/…, I can't seem to add 2 and 2 together to see how the tuple acts as the new coordinates..?
@PaulMcG It'll now vanish for a bit, but it'll eventually somehow get a major tech boost, think its name is 'C'ini and will attempt to find its creator who is of course William Shatner :)
Is there a way to execute a python program without install python (3.6)? I found something about use an env but I think that I still need to have installed python in order to make an env, right?
You could also run your program on an online interpreter such as Ideone. It's going to be slow and ugly and you won't have access to any OS-facing things such as opening files, but you can't beat the convenience
But yeah. If you don't have Python on your computer, then you can't run .py files on your computer.
"I just need something that can read the .py file and understand what it does and execute those instructions." That thing is Python.
This box contains french fries and a hot dog wrapped in paper which is labeled "hot dog with french fries". It bothers me that this label is on the wrapper and not the box, because there are no french fries in the wrapper. Poor encapsulation at work.
If that were the intent, then the box should come with a sharpie so I can change the wrapper from "hot dog" to "hot dog with french fries" when and only when I put fries on the wrapper
general consumers accepted the notion of 'batteries not include', I'm sure they could say 'sharpie not included'. If anything just a lack of misprint on their part :D
They just save you the effort and what not. :D
Today for lunch, my company is buying me takeout pho.... Not sure how that will work out .... :\
I don't wanna decline it because it may seem rude of me to, but then again I'n concern about the temperature of the soup when it arrives, and if it would still be sufficient enough to 'cook' the beef.
TV chat. I watched Bojack Horseman this week and I felt it was one of the stronger seasons. If the average total quality of Bojack Horseman meets your standards for watchable television, then you should watch this season of Bojack Horseman.
"watch this if you think you will like watching this", the review that applies to all things
Has anyone used airflow for anything? It looks promising for some stuff I want to try, and a better fit than Luigi for it. (I can't make a more specific question because I don't have a specific problem yet!)
quora.com/… is an interesting breakdown of a seemingly simple "95% of MIT grads can't solve this brain teaser!!!" image that just happens to be the only one that's actually telling the truth
btw, this is my mental image of @Andras, so I'm not confident I could've won a death match. But it's good that @Kevin remained neutral, because he's got a sword.