« first day (3517 days earlier)      last day (1414 days later) » 
00:00 - 19:0019:00 - 00:00

12:06 AM
Cabbage. The stuff in the transcripts about Tkinter docs reminded me to find out what happened to the excellent New Mexico Tech Tkinter docs that disappeared without warning last year. Sadly, the creator of those docs, John Shipman, passed away a couple of years ago. New Mexico Tech decided they don't want to host those docs anymore. However, the docs are available in the Wayback Machine.
New Mexico Tech Tkinter docs by John W. Shipman: web.archive.org/web/20190524140835/https://infohost.nmt.edu/tcc/…
For more info, see bugs.python.org/issue37149
@Kevin @LinkBerest See above for a link to the New Mexico Tech Tkinter docs. Reblochon Masque & I were discussing this stuff a year ago. I thought it was more recently...
In other news, we'll be getting new Markdown engines in the very near future. For details, see meta.stackexchange.com/q/348746/334566 Hopefully, nothing will get broken, but they've created a rollback process just in case.
 
12:41 AM
@roganjosh heh, Python is the advance classes where I teach (junior level+)
it makes up for it by being the only language taught to people going for IT/IS management careers (oi! you want to know what bad coding looks like....)
@PM2Ring Thanks, I mostly try to ignore Tk now (thankfully all my contacts and companies have moved away from it) but that will be very useful for those "oops, we forgot about maintaining this critical app which we fired/furloughed/whatever'ed all the people who were working on it: get it done by Monday" moments :\ :)
 
 
1 hour later…
2:15 AM
@roganjosh Play it off like it ain't jumpin
cbg
Update on the expletives?
 
2:26 AM
cbg
 
3:07 AM
Regex expression to remove 'Join Date' from a substring?
 
 
1 hour later…
4:30 AM
@JossieCalderon regex can match stuff, the rest depends on a number of factors ... in Python if the string is static using regex makes no sense at all, you want "your Join Date: 2020-06-01".replace("Join Date", "")
perhaps something like re.sub(r"\s*[Jj]oin\s+[Dd]ate\s*:?", "", "Your Join Date: 2020-06-01") to cover some variations, but again, this depends a lot on what exactly you are hoping to accomplish
 
5:03 AM
:49528355
{'Username': 'inspectionstare', 'Join Date': 'Join Date: Jan 2005', 'Posts': 'Posts: 450', 'Rep Power': 'Rep Power: '}
I need to remove "Join Date"
Because it's a double key, as you can see
I want thisDict['Join Date'] == 'Jan 2005'
I want to accomplish this with regex only
What if I get asked this in an interview? I would like to know just to improve my regex knowledge.
@roganjosh This never happened lol
 
5:27 AM
@JossieCalderon the Stack Overflow regex tag info page has some pointers
the answer to "I want a regex which matches 'foo'" is simply the static string foo which trivially matches itself; regex makes no sense in Python for this because literal string matching is much faster than regex matching
regular expressions make sense when you want to succinctly express some variations in what you want to match, such as optional whitespace between tokens etc
but without any indication what those variations are, there is no better answer than "match exactly the string you want to match"
having said that, my guess off the cuff seems to have landed pretty close to what you were actually apparently trying to ask
and of course Regex 101 teaches you that . and [ and \ and a few other characters are regex metacharacters which do not simply match themselves
then in Python 101 you learn to always use r'literal strings' around regexes so you don't have to account for Python's backslash handling as well as the regex engine's
(the beef there is the r sigil before the opening quote)
(weirdly the info page seems to have been unavailable for a while there, but the link should generally work)
I get "The service is unavailable" for e.g. the info page's history
works too now, huh
now the whole site displays an "offline for maintenance" banner!
 
6:04 AM
cbg
 
cbg
I'm using a metaclass, and I want all subclasses to define an instance attribute. How do I do this without using a property (which then asks me to design setters/getters etc)?
 
6:55 AM
@toonarmycaptain what do you mean by "I want all subclasses to define an instance attribute" - classes generally don't define attributes of their instances.
Do you want __slots__?
 
 
2 hours later…
8:48 AM
@JossieCalderon I can see edit histories and they did attempt to fix their comment up in the 2 min timeframe. Since they were new and the comment was part of the flow of the discussion, I chose not to trash it
 
9:42 AM
Im getting ImportError: Cannot import name X what is the aproach to do the same import into two different files ?
 
You'll need to give some more context. What are you importing? A local module?
 
yes a class from a local module into two files in the same directory
 
So neither import works currently?
 
only one at a time, when I insert the same import into the other file i get the error
 
sounds like a circular import
 
9:45 AM
do any of these modules happen to have the same name, or the same name as a builtin module? are the imports circular?
 
Are there any tools that let me test whether my project is ready for release? I.e. setup a virtualenv, install the project, run the test suite, nuke the virtualenv
 
yop is a circular import I try to import them in a function
 
@Aran-Fey IIRC tox does that
 
Isn't that "instrumentation"?
 
@roblox I think the best we can suggest is just to get rid of the circular import (are you aware of what, specifically, this is?) unless you give an MCVE
 
9:50 AM
@MisterMiyagi I'll take a look, ty
 
hmm, no, probably just automation
 
¯\_(ツ)_/¯
 
I'm just spewing random package names here.
Could be instrumentation. Could be automation. Could be nasal demons.
 
Ah, I preferred nasal daemons. I wonder if that's a package. EDIT: gah, beaten to it but not in python
 
Hmm, if you have version X of a module installed and then you install something that depends on version X+1, will pip automatically upgrade it?
 
9:55 AM
@roganjosh I need this class SieveAnalysis in one file I import it with from rootWindow.sieve_analysis.sieve_analysis import SieveAnalysis after importing the same class into another file I get ImportError: cannot import name 'SieveAnalysis' from 'rootWindow.sieve_analysis.sieve_analysis
@roganjosh importing it directly into the function which need the class did not solve the problem
 
@LinkBerest @Nanoni the issue was indeed fixed in October github.com/numpy/numpy/issues/16473#issuecomment-637432659
 
I'm pretty upset that my google-foo didn't find that github issue. Nice job raising the ticket, though
 
10:28 AM
@roganjosh I once drafted a package named nasal to simplify... writing daemons.
systemd killed all the fun. :/
and the puns.
and the tons of bugs my initial draft had. ./
 
Sounds like a total write-off :P
 
@roblox we'll need an MCVE for that, I guess. Or at least some code. Or a traceback.
 
 
2 hours later…
12:07 PM
Tech life hack of the day week month: Uncluttering firefox's context menus with userChrome.css
 
hi! I have a Flask form with two different IntegerField and I must show only one of them in each situation
{% if form.category.data == 'others' %}
<p>{{ form.saturated_fats }} {{ form.saturated_fats.label }}</p>
{% else %}
<p>{{ form.saturated_fats_and_lipids }} {{ form.saturated_fats_and_lipids.label }}</p>
{% endif %}
later I set the one that is empty but I still cannot pass the validation, what I'm doing wrong?
 
if request.method == 'POST' :
	if form.saturated_fats.data :
		form.saturated_fats_and_lipids.data = -1
	elif form.saturated_fats_and_lipids.data :
		form.saturated_fats.data = -1
 
Y was my message removed?
 
@rishi please see our room rules in regards to asking questions from main in chat. Specifically, you should wait 48 hours before bringing them here if you haven't got a reasonable answer
 
12:14 PM
@Aran-Fey do you have a before-after for me to be excited?
not sure what problem that solves, but I rarely see context menus in firefox
 
I'm not sure how to take a screenshot of a context menu, unfortunately :(
 
@DanielGarcíaBaena please can you bundle this up into a dpaste (or similar) that shows your form and the validation too?
 
@roganjosh I have asked my question 2 times on stackoverflow but haven't received a good answer, however I'll wait another 48hours before posting it here.
 
@roganjosh sure, give me a minute
 
@AndrasDeak Try right clicking on a link - all I have in that menu is "open link in new tab", "save target as" and "copy link location". All the other crap is gone
 
12:17 PM
@Aran-Fey OK, that was my hunch. Thanks.
 
I always get: {'saturated_fats_and_lipids': ['This field is required.']}
 
Ok, but where are you calling if form.validate_on_submit()?
 
.. not particularly helpful
 
firstly I check if request.method == 'POST' , set the empty value and then check again if form.validate_on_submit()
@roganjosh sorry, I was typing the rest
 
12:27 PM
I'm going to need an MCVE to visualise it properly. Clearly there is an error and, if you knew what it was from your own code flow, you'd have fixed it already. At the moment I can't connect any dots from that dpaste
@DanielGarcíaBaena I'll let you off, then :)
 
let me clarify then
I have a form that can only show one of two options, as all options are required if shown, I need to populate the one that I have not showed each time
 
I have an understanding of what you're trying to do, I just can't see the full execution
 
that's why I check if request.method == 'POST' before calling form.validate_on_submit()
@roganjosh and is it the best way to do it? Setting the other IntegerField if it is empty at request.method == 'POST' ?
it's the only one that I figured out so far...
 
I actually don't use WTForms because I find it hard to work with when most of my forms use AJAX. Your approach doesn't seem unreasonable, provided that you check only those two conditions and replace the entries with predictable values (your -1)
The issue appears to be that whatever modification you're making to the form is not sticking prior to validate_on_submit and that's the part I can't follow from the snippets you've given, which is why I'm asking for an MCVE
 
@app.route('/', methods = ['GET', 'POST'])
@app.route('/index', methods = ['GET', 'POST'])
def index() :
	form = SomeForm()
	if request.method == 'POST' :
		if form.saturated_fats.data :
			form.saturated_fats_and_lipids.data = -1
		elif form.saturated_fats_and_lipids.data :
			form.saturated_fats.data = -1

	if form.validate_on_submit() :
		...
that's what I'm doing
but even when form.saturated_fats_and_lipids.data is -1 , form.errors shows: {'saturated_fats_and_lipids': ['This field is required.']}
 
12:39 PM
Ok, and so if you put "print("fired") directly under if request.method == 'POST' :, you're seeing that in the console/terminal?
 
You're saying you've practically tested this?
 
yes, I actually do instead: print('form.saturated_fats_and_lipids.data = ', form.saturated_fats_and_lipids.data)
 
That wasn't what I suggested or asked
 
what's the different?
 
12:42 PM
Please just run the following and confirm that you're seeing the printed message in the terminal
Ugh, what's going on with the indentation here? I copied it fine from my editor
 
no worries
 
Are you mixing tabs and spaces?
 
I tried and got the same
it definitely goes inside the if
and definitely populates form.saturated_fats_and_lipids.data
 
I'm more concerned about your indentation, now. I've spent a lot of time posting code blocks into chat and that indentation was definitely not what I expected
 
only tabs
 
12:46 PM
The dpaste contains only spaces. Might have converted from tabs without asking.
 
I suppose
I just changed InputRequired by DataRequired in both saturated_fats and saturated_fats_and_lipids and it's working now
why it's not working with InputRequired ?
 
Are we certain that changing the value of the form data after the fact will have an effect on its validation? wtforms.readthedocs.io/en/2.3.x/validators/… kind of makes it sound like InputRequired only cares about what the user submitted
"InputRequired looks that form-input data was provided"
 
Oh, lol, we went off-topic there. You're not rendering the form with input fields for either of those. <p>{{ form.saturated_fats }} {{ form.saturated_fats.label }}</p>just displays text, so how does the user interact with it?
 
@Kevin it sounds like it not... That's weird
 
I've never used WTForms so feel free to perform tests and draw your own conclusions
 
12:54 PM
@roganjosh I am, the form shows only one of the IntegerField each time
it works perfectly
@Kevin any alternative? I like WTForms but I'm struggling a bit too much with validators
 
I've never used it before, so I have no idea.
 
I mean any WTForm alternative
 
I want to really emphasize how little I know what I'm talking about, and how much you should independently verify my guesses
 
But Kevin was correct. Again, <p>{{ form.saturated_fats }} {{ form.saturated_fats.label }}</p> does not ask for user input. So InputRequired won't work. All you're doing is pre-populating one-or-the-other field in the form with data
To the point that the form doesn't really make sense to me
 
12:59 PM
what do you mean with: "does not ask for user input" ? It shows the input box and the label and populates data with user input
it works properly
I only make a hard coded population to the one that's not shown
 
Perhaps {{ form.saturated_fats }} resolves to an input tag? idk
 
sure: saturated_fats = IntegerField('Saturated fats (g)', validators = [DataRequired()])
from class SomeForm(FlaskForm)
anyway, it seems to be what Kevin said
 
Somewhere in this confusing discussion, I think there's a decent question - "How do I spoof user input to a WTForm?" or some-such. At the moment, the validators don't make sense since you're only rendering one of the two fields anyway
 
user11702787
hey is there an easy way to save a list in a config file and do the same thing backwords`?
 
@roganjosh but both are mandatories if shown
 
1:04 PM
configparser can be used to read and write config files. I don't know off the top of my head whether it can natively serialize/deserialize lists
 
the problem is that you only know which one show in execution time
 
@DanielGarcíaBaena They can't both be shown because you have an if/else in your template. But your validators demand user input for both. At this point, I'm just asking myself what use these validators are for your use-case. I'm also thinking we're coming at this from different angles and not really moving forwards
 
user need to see different fields if he selects one type of food or another, but he must enter values for all of them
you can only be sure he will if they are all required
 
This looks useful: conditional validation on multiple form fields asks whether it's possible to validate that at least one of multiple inputs are filled
TLDR: use Optional, then add custom validation that verifies the presence of at least one value
 
it seems interesting... I will check it out
thanks!
I must to leave now, thank you again guys
 
1:11 PM
@We..are..one what format is your config file?
.toml offers a pretty good blend of ini-style usability and yaml/json-style type support.
 
1:32 PM
stackoverflow.com/q/62141260/4799172 needs more focus (the edit drastically swung it out of the needs-more-detail realm)
 
2:12 PM
Closed, thanks :)
 
Keep 'em coming! I'm all out of bubblegum!
 
Do not tempt me, MisterMiyagi. You must understand that I'd do this out of the desire to do good, but I have many tabs
 
print(len(my_fake_list), my_fake_list)
# output: 1 <MyWrapperWrapper wrapper around ['x']>
^ that repr output though
 
Oh man, I'm both excited and depressed at the results of running the sqli checker periodically against SO and common SQL tags.
 
Does i stand for injection?
 
2:19 PM
yes
 
That's like saying I'm sad that I ran my dustchecker in the sahara
 
I sleep sound knowing that none of these people are responsible for our data anywhere on the internet.
3
 
@AndrasDeak nice, I knew I remembered there being a fix for that :)
 
The sarcasm is strong in this one :D
 
2:21 PM
@Hakaishin "Dust, anyone?"
 
At least the Sahara doesn't have a comment section
 
lol
 
"Great sand! Thanks! Tastes great"
 
@roganjosh give a man an answer and you help him for a day; teach a man to answer and you help him for a lifetime
 
"I'm going to take some home for my kids :-)" -- proceeds to load up his bag with sand, not noticing the colony of scorpions now in his pack
 
2:22 PM
Or was that "mercilessly close-vote their unanswerable questions"?
 
@MisterMiyagi "for a lifetime" can mean anything in an evil genie scenario
 
@Kevin Some kids might be thrilled at getting pet scorpions.
 
Other commenters try to erect "danger: scorpions" signs, but they're buried under more sand
give a man an answer and you'll be on the hook for a lifetime as he continually adds "one more thing..." edits
 
This keeps getting better and better :P
 
@AndrasDeak Depending on the selected tags, "answering questions on SO for a lifetime" probably ranges somewhere between heaven and hell.
 
2:25 PM
@Kevin And it aint "We are the sultans of swing"
 
@MisterMiyagi if you're really bad you don't stop at a lifetime
 
[I nod sagely]
 
Do you think you can tell Python from JS, Blue skies from pain, do you think you can tell :)
 
@AndrasDeak I expect a catch-22, such as "suffer until you answer all pandas questions successfully". Little did bad boy Tommy know that user datapwnz0r24 is just a socket that never accepts an answer.
 
Dibs on "pain" as a programming language name
 
2:29 PM
Heaven from Hell?
 
Good luck on getting found buried under all the articles about pain and programming
There might even be one, but I couldn't find it in 3s :P
 
@LinkBerest Yes; it truly is just a text file on a machine on the local network that I want to read
Sorry, had to run into the office yesterday
 
@IljaEverilä I'm gonna go with "no kid likes pet scorpions". My menagerie as a kid included tarantulas (including a Goliath Bird Eater), snakes, lizards, all sorts of insects that were abandoned. The scorpions were just awful
 
@roganjosh We just had a tortoise. A grumpy thing.
 
2:32 PM
@biggi_ then just open it with open (as long as the drive is mapped and path to it is correct then it will work)
 
It took it really badly when the wife started hanging about. It would chase her (toes) in the kitchen.
 
@LinkBerest I'll give it a go! Putting it together now. It's just a Beaglebone on a local network and trying to read a text output file
 
"Chase" being used broadly here.
 
@IljaEverilä Then you'll have to take my word for it that scorpions are the worst pets :P I made them a run-around and just getting them into it was a battle of wills
 
nah, camel spiders are worse
 
2:34 PM
@IljaEverilä xD
 
@roganjosh you mean like a hamster wheel?
@Hakaishin tortoises can be crazy fast
 
define "crazy fast" :D
 
@AndrasDeak it was a big container I made from some roofing material, maybe 6ft by 6ft. Getting them out of the tank was horrific; they do not like being handled
 
 
2:37 PM
not what you normally think of tortoises
 
@AndrasDeak Very true, and we've had to find it once or twice when someone thought they could just pop inside to get something and come back out to look after it.
 
@roganjosh ah. Makes more sense :P
 
well, fast for a tortoise, but any animal would just walk away if it wanted :P
 
3:07 PM
@LinkBerest so I'm doing remote_file=open(r'\\beaglebone\home\debian\work\dev\file_access\test.txt', 'r') and it's sayingno such file or directory (I know it's in ~\work\dev\file_access). Trying to access the file on a beaglebone and I have not mapped the drive on windows. Do I need to map it first orwhat's the preferred way?
 
Map the drive first - if it is not mapped it cannot be attached, if you need to map the drive with Python the "easiest" is just to subprocess the windows utility
make sure you know what net use does though (note: this has both options & link to net use docs) - if net use doesn't work make sure windows 10 is updated - there were issues with certain builds
 
@JossieCalderon I'm not sure what point you're making with this. Please just direct people to the code formatting guide
 
morning cabbage
 
cbg
 
Sorry Jossie :)
been a hot minute since i've done SO
 
3:21 PM
@roganjosh I'm not kidding
 
Nor am I
 
@tripleee regexone.com is more basic
 
@AndrasDeak that looks like a snapping turtle to me. They're kept in a different folder from turtles; they're the orcs of real life. When I think "tortoise", I think of them just munching happily on a strawberry
 
Is there a formal name for the relation "A equals B, and type(A) equals type(B)"?
 
3:27 PM
@biggi_ Is this a network drive or a linux subsystem? if its a subsystem you can actually just save those in /mnt/c/...whatever path.../ on the linux side (as that directory is symlinked to your c: drive)
 
@LinkBerest right now it's a Beaglebone running Debian and I'm trying to access the file from Windows for now.
 
Or, hmm, I think I need an additional requirement to catch recursive cases. A = [1, 2, 3]; B = [1, 2.0, 3] satisfies the relation as I stated it but not as I intended
 
@roganjosh strawberry, your finger...doesn't really matter
 
@Kevin transform all elements in B to ints
 
ah, forgot those were microsystems - yeah, then net use or just mapping will be easiest if possible. If not you'll have to look at ssh and/or sockets
 
3:29 PM
@Kevin "identicalish"
 
@AndrasDeak yeah, sorry, pointless distinction :P
 
I ask because this question wants to determine if A is a permutation of B, and I initially suggested that sorted(A) == sorted(B) implies that A is a permutation of B, but in reality only sorted(A) <is_identicalish> sorted(B) implies that A is a permutation of B
 
one option: argsort A, reverse argsort B, and use the corresponding indices to see if A becomes B
>>> A = [2, 4, 3]
... B = [3, 2, 4]
... inds_A = np.argsort(A)
... inds_B = np.argsort(B)
... reverse_B = np.empty_like(inds_B)
... reverse_B[inds_B] = np.arange(len(B))
... print(np.array(A)[inds_A][reverse_B])
[3 2 4]
sorting twice will also give you the reverse sorting permutation, I think
it's a more clunky with native types
@Kevin I almost suggested comparing them as sets and the length of the sets, but that will also not play nicely with 2 vs 2.0 and friends
 
Q: "I have a math with Python question"; A: "Use numpy" ;)
 
Numpy doesn't answer all math questions in python, only those worth asking
(spot the physicist)
 
3:36 PM
I did get a vibe of "use jquery to add two numbers" there, but I think this is juuust nontrivial enough to justify it
 
if you want it I can do that with native types too
 
yeah, the native types version is janky enough that I would use numpy
 
I'm channeling the OP... His spirit says "I'm really just trying to compare two lists of integers, so sorted(A) == sorted(B) should work fine for me. But have fun with your numpy if you want"
 
^ translation: "I don't want to learn math!!"
 
Comedy option: OP wants to know whether the integer 123 is a permutation of the integer 213
Can't sort those :^)
 
3:40 PM
oh, evil - I like it. Do that and then give the recursive answer
 
Hard mode: is_permutation(1, 10) should return False, but is_permutation(01, 10) should return True
 
>>> from operator import itemgetter
...
... def argsort(seq):
...     """Eager argsort"""
...     return list(map(itemgetter(1), sorted(zip(seq, range(len(seq))))))
...
... A = [2, 4, 3, 5]
... B = [5, 3, 2, 4]
... inds_A = argsort(A)
... inds_B = argsort(B)
... reverse_B = argsort(inds_B)
... B == [A[inds_A[i]] for i in reverse_B]
True
now you just have to typecheck the items in the final lists...
 
I'm trying to explain Python strings to beginners (most coming from Java/C++ background) is staring with them as objects (helps connect immutability) then introducing that they are also treated as a sequence (i.e. you can slice them) a good way to intro them?
or reverse that and do "as a sequence" first then as objects (my usual way with completely beginner programmers)?
 
3:57 PM
Strings are lists of characters
 
No.
 
Oh...
lists are mutable
 
Yes.
 
hence "as a sequence" they are a sequence so have an index (which is handy) but not lists
 
Then strings are sequences of characters.
 
4:01 PM
Surely LinkBerest can formulate a definition for strings. But teaching newbies is not about definitions. It's about teaching.
 
I'd say strings are sequences of strings
 
I'm just wondering if starting with a sequence will confuse C++ people because they will get in the mindset of it being a "character array" and then have to switch gears. I'm going to leave it the same and just add some caveats, I think
 
Doesn't this all hinge on the python data model? If they're coming from Java/C++ then they'd appreciate that angle?
 
But it's not true
Python doesn't have a character data type
 
4:05 PM
yes, that would be the point
 
@LinkBerest I'm not sure whether this was a reply to my last comment, but I'm suggesting that you first explain the dunders etc. before focusing on strings
 
it was a reply to Jossie's, this isn't the first lesson I've just noticed that C++ people seem to have trouble grasping strings. (Java people seem to do fine with strings, due to special status in Java, but lose it when dealing once we get to "import ABC")
 
I have a list with tuple values my_list = [(12.1,), (12.1,), (12.1,), (12.1,), (12.1,), (12.1,), (12.1,)] I want to change the values to floats
 
So wondered if maybe start with the idea of Strings as an object instead; I think I'll leave it starting with a sequence and just add some more caveats and an extra whiteboard-style video
 
convert = [(float(x), ) for x in templist] gives me
TypeError: float() argument must be a string or a number, not 'tuple'
what im missing here ?
 
4:12 PM
x[0]
 
@roblox you didn't index the tuple to get at the actual float value, you just made a new one. convert = [float(x[0]) for x in templist]
 
x is a tuple (12.1,)
 
@AndrasDeak yeah, its been surprising how much harder teaching beginners can be (over the more advance classes and industry courses I started out with)
 
thanks
 
@MisterMiyagi Maybe? I've a metaclass defined. I want every subclass to define an attribute: Subclass.required_attr should be defined. I can find an @abc.abstractmethod but not @abc.abstractattribute. There's using @property/@abstractmethod, but I don't want a property defined (yet, anyway).
 
4:28 PM
String lesson, throw-em-in-the-deep-end style: just link them to docs.python.org/3/c-api/unicode.html
At the C API level, there is an argument to be made that there is no string type (since all of the unicode-manipulating functions return a PyObject* rather than, say, a PyUnicodeString), but there is a char type (Py_UNICODE)
But that is a silly argument
 
@Kevin lru_cache solves this by comparing (sets of) tuples of value, type(value), not bare value.
but I doubt the OP actually knows the difference
@LinkBerest I think "sequence of characters" is fine as a simile. People should be familiar with sequences (vector/array) and probably have an intuitive idea what a character is. You can drop the finer details, such as a character also being a string, later on.
@toonarmycaptain I'm not quite following. Do you want to enforce Subclass.required_attr or Subclass().required_attr to exist?
 
4:53 PM
Hmm, interesting
I didn't know lru_cache could distinguish equal-yet-not-identical keys, TIL
 
it takes a flag typed to toggle the behaviour on
 
@MisterMiyagi yeah, that's basically what I've been doing; think I just need to look at my example structure - thanks
 
@MisterMiyagi Yes. I want a Subclass instantiated without the attr to raise an error, just as it would with an @abc.abstractmethod method left unimplemnted by a subclass.
 
I like the symmetry that we all replied to our pings in the order we received them
 
@toonarmycaptain In that case, you need a custom metaclass __call__. Check that the constructed instance actually has the attribute.
 
4:55 PM
oddly, it was harder for me to grasp "strings" in C/C++ then Python (cause all the languages I used before learning it did not have "character" data types.....or did but the type was variable length vs. fixed length)
 
There is no way to check given just the class whether any instance has an attribute.
@LinkBerest I tend to think of Python having a character type that is private tostr (basically code points). They exist behind the scenes, there is just no interface to get one in the wild.
 
Strings annoyed me in C++ because it had both char* and std::string, and most of the fun string-y functions only worked on one and not the other
 
Practically like color charged particles.
 
Doubleplus private, considering even the dense unicode API document doesn't elaborate upon the underlying representation beyond "Unicode objects internally use a variety of representations"
 
Yeah, that's it. Just explain strings via the strong interaction. Strings are baryons, bytes are mesons. People will love it.
3
 
5:00 PM
@Kevin didn't they only add std::string in 98?...cause I kinda remember being really happy when that finally existed (and I could stop making char vectors)
 
PEP 393 peeks behind the curtain more by showing some struct definitions. So a unicode string can be an array of Py_UCS<digit>s, or* a PyCompactUnicodeObject, or a void pointer (aka literally anything)
That really narrows it down :-I
 
@Kevin I think these are awesome. Kinda like PyPy's dict/list strategies.
 
@MisterMiyagi Thanks, I'll look into that when I work on the project later today.
 
@LinkBerest My c++ days were '02ish, so I can't comment on the Before Times.
(*or maybe instead of "or", "and"? I don't know why it's not inside the union)
 
ah...well the before time is why that happened
I think I used C++ 2.0 for the first (and only) professional & educational usage I had with it which was '97-01
 
5:05 PM
I can say that the dream of "finally, I can use std::string and nothing else" wasn't quite realized by my time
 
Then came Java & I said "Oh, boy! doesn't this look better" - like the foolish child I was
I will say I always liked C++ development team's guiding principles (and it wasn't my main language when working so half my frustration was the dang it, I know how to do this....which man page was it?! type moments)
 
wim
5:22 PM
@AndrasDeak crikey, that cat has thumbs
they are evolving 😐
 
Are you referring to something like this? stackoverflow.com/questions/55481355/…
 
cbg patch
 
@MisterMiyagi I don't fully understand the machinery, but if python can enforce instance methods being defined at instantiation, surely it can attrs also. Unless of course it can only look at the subclass def rather than running the __init__ and checking afterwards, which to me would merely required a wrapper on the __init__ and checking after running it, which looks like what that answer is implementing.
 
Mapping this beaglebone drive isnt' near as easy as mapping a Windows drive XD
 
im starting to look into the world of UI based applications in Python and wanted to know where you guys would recommend I could focus my initial efforts? There are 3 things I want to focus on currently: a) good image viewing experience b) easy to set up interaction with keystrokes, and c) simple to convert into an .exe (or any executable that doesnt need dependencies or python installed on that system to work)
 
5:34 PM
c is the hardest requirement by far, I reckon
 
wim
d) learn javascript
 
You should probably set up some quick "Hello World!" applications using whichever UI libraries you're considering -- Tkinter, PyQT, etc. Then see which ones you can actually get to compile to exe
 
e) c++ with QT or f) .net if only windows XD
 
wim
not even joking. they are light years ahead of Python in terms of UI stuff.
C++ with Qt == world of pain
 
Meh it's not too bad
Depends if you like C++ or not
 
wim
5:38 PM
It's BAD. Qt wants to memory manage all their own objects. Stuff that's not Qt you have to manage, with boost or whatever.
So as a developer you have to always know what is touching Qt objects memory and what is not. It's awful
 
I did QT when I was dev'ing for RPi stuff since I couldn't use c# at the time
Once you learn it it's not terrible to use
My stuff was super simple tho
 
wim
I start to believe there's a reason the company was called "Trolltech"
 
lul
I can't get this silly Beaglebone to let me map it. We'll get it figured out I guess.
 
wim
actually even std::string had (has?) weird memory leaks
I'm quite impressed with how well unicode works in Python, this stuff is incredibly complicated under the hood and I guess most Python dev don't even realize that. Because the abstraction that str are just like immutable "constants" the same way as integers is done quite well
same for Python int actually (underlying storage is non-trivial)
@AndrasDeak AFAIK it lacks a lot of the capabilities of multi precision arithmetic libs e.g. gmpy2
 
@biggi_ if it doesn't map and your trying to connect Windows to Linux the next step would be sockets or SSH. I would recommend using subprocess with windows OpenSSH for that since its just a single file. However, you also need to look at networking because there's a lot of steps/issues/basic knowledge needed for this
no matter how you connect the device (esp. on server setup with this type of device)
 
5:50 PM
That's what I'm looking at. In the end it may be Linux to Linux, which I'm assuming is easier. But as of right now for the forseeable future, it's going to be Windows to Linux.
 
Linux to Linux is easier in that SSH is installed by default (and less compatibility/porting issues) but it requires the same networking knowledge
I've used RaspberryPi to setup web & print servers before so I know its possible but its beyond this room (more a superuser question at this point and you'll need to research it before hand)
 
Yea; I'm starting to read. Seems like a good learning experience for sure!
 
@wim ha, you let your inner Aussie out :P
@wim sure it does. I was being facetious. Numpy is great for solving problems that numpy is good at.
 
6:34 PM
@toonarmycaptain The machinery you speak of are metaclasses. That's how type works, that's how ABC works. The link you cited looks good.
 
6:45 PM
the difficulty with requirement c) is one of the things that gets really annoying. It'd be very nice to package everything and give someone an application that just works but it always feels like python is fighting you at every step
I feel like its a big thing holding some really nice Python stuff from widespread adoption
also I don't really need it to compile to .exe rather then just make it into some independent executable that is it's own module/doesn't need python to run. It'd be nice to make things easily cross-platform
 
it's the cross-platform part that makes this really complicated. As long as you are on the target platform, you can at least bundle up a working version into an executable archive.
 
@Skyler feels like that with every language really (compiled code is OS specific, jars require the JVM support, etc...) - whole point of "containers" and installers
 
well building two versions, one for unix and 1 for windows, wouldnt be a deal breaker
 
IIRC that is how several "installer" tools work. Comes with serious bloat, though.
You may want to try nuitka – IIRC it offers a standalone compilation. Not sure how far they are in supporting weird Python stuff.
Generally, "build a cross-platform executable" does not seem to be a large priority for most Python users.
 
but are we talking about needing to get into nitty gritty per distro builds and other things when you say things are OS specific
 
00:00 - 19:0019:00 - 00:00

« first day (3517 days earlier)      last day (1414 days later) »