« first day (2005 days earlier)      last day (2940 days later) » 

1:02 PM
Morning cabbage.
 
Morgan cabbage.
 
Midday cabbage.
 
I just had a look at a rational number class I wrote in Python 1.4 back in 1998... it's not pretty. Eg, it uses type instead of isinstance and the now-obsolete dunder method __coerce__. And my source uses tabs for indentation...
 
Room looks quite international atm \o/
 
@BhargavRao can you manually put me in Budapest, or do I have to finally finish my profile?:P
 
1:07 PM
@AndrasDeak I'm using the library to do that, So I will have to break inside the library to add users manually :/
 
DSM
I used to get Bucharest and Budapest confused all the time. Well, not all the time, really didn't come up that often, but still.
 
@BhargavRao is that a yes or a no?:P
@DSM it's OK. Getting the continent right is already appreciated;)
 
@AndrasDeak it is a sometime later
 
@BhargavRao OK:D
I might just finish my profile then
 
hmm
@Ilja is your profile correct :d
 
1:10 PM
@AnttiHaapala There are 2 people there, See the dark shadow
You and Ilja
 
we want a dark shadow too:(
 
Get some more guys near your place to use the chat room :P
 
@AnttiHaapala ours is the land of dark shadows...
 
Suomi mainittu, torilla tavataan!
 
1:12 PM
@BhargavRao good... GOOOOD....
 
Kiitokset!!
 
@BhargavRao perhaps I should learn to write in the noble language of Canada
 
is kiitokset plural?
 
@AnttiHaapala Start Asap
 
1:14 PM
nice
I appreciate oddities of the Finnish language because it puts it into perspective how odd my own might seem to foreigners:)
 
yeah, Hungarian and Finnish related... right... more like your father's brother's nephew's cousin's former roommate.
 
@AnttiHaapala Learn this letter first -> ಠ_ಠ
 
yeah, I wouldn't say they are all that brotherly:)
 
TestingYard$ python3 Wikip.py "ಠ_ಠ"
 Look of disapproval[13] The Unicode character ಠ is from the Kannada alphabet and can be called differently in HTML notation: ಠ and ಠ (for Unicode)
 
although you say kala, I say hal, and nobody else says anything of the like around
 
1:18 PM
yeah, just looked again at the numbers in Hungarian.
 
(that's as far as my Finno-Ugric knowledge goes)
 
if I'd have to guess which one is which, I'd get about 20 % correct :d
 
yeah, kaksi ~ kettő, plausible
I've spoken to foreigners, and they say the sounding is really familiar for them, I mean Hungarian vs Finnish
 
but then some people said that command of Lithuanian language is useful in India :D
 
I guess the fact that we exclusively stress the first syllable of every word is a very dominant feature
@AnttiHaapala really?:D
 
1:20 PM
yeah, that person said one can understand pretty many words of Hindi after you get the script right...
judging from those examples, much more useful than Finnish in Hungary :D
 
Ok, back to work. Rhubarb all \o
 
user559633
1:38 PM
@BhargavRao where is that data from? it's missing a bunch of users
 
user559633
oh, sorry, was reading back -- sorry to distract you from work
 
Probably from our profiles. Hey, someone is near me \o/
 
So, scifi.se has the world's most annoying link highlighting. Of these two links, which one did I click on.
 
the second one
 
Yup.
The links get lighter when you click them.
 
DSM
1:48 PM
Surprising. When I think of Morgan, I think of the Power Rangers.
 
Ballerina was a dead giveaway for me
<3 Morgan
 
user559633
ugh shut down scifi.se
 
But, regardless, is that not absurdly annoying?
Links get darker when you click them, it's a rule of nature people.
What's next? https redirecting to an insecure site? .php files without security holes? readable css?
3
MADNESS I TELL YOU.
 
http://stackoverflow.com/questions/36574621/running-a-entire-sql-scr‌​ipt-via-python#36574621 needs code badly
 
1:53 PM
How can I loop through data like this in python? I think it's json but json.loads isn't handling it as expected (day 1 of python coding, go easy) pastebin.com/6Sc8snra
 
@Morgan'Venti'Thrappuccino Someone should sic the UX people onto them. :)
 
scifi.se is out of this world, that's why the links are different ;)
 
@PM2Ring I'm very tempted to report it as a dug on their meta.
 
@Silver89 that's a dictionary, not JSON
like, mydict = {u’data’: [{u’title’: u’test’, u’name’: u’bob’}, {u’title’: u’test’, u’name’: u’bob’}, {u’title’: u’test’, u’name’: u’bob’}]}
you iterate over dictionary key values with the .items() function:
for k,v in mydict.items():
    print('Key={}, Value={}'.format(k, v))
Here's a good question/set of answers about iterating over dictionaries: stackoverflow.com/q/3294889/344286
 
Is that a legal python dictionary? Those tick marks aren't standard apostrophes, are they?
 
1:57 PM
@Silver89 I assume that you've programmed in one or more other languages before. If so you should check out the official Python tutorial. It's aimed at people with previous programing experience (preferably in C or one of its relatives), and it doesn't take that long to work through. Also see sopython.com/wiki/What_tutorial_should_I_read%3F
 
compare: ’ and '
 
@Kevin No they aren't. They would need to be changed
 
I didn't notice that
yeah, probably some annoying teacher posted python code in a word doc (facepalm)
 
@Kevin Well spotted!
 
Kevin "Eagle Eye" Kevinson.
 
1:58 PM
KAW KAW
 
@WayneWerner Wouldn't Word "promote" the plain quotes to "smart" quotes?
 
Does it count as "spotted" if I blindly pasted it into a python file and ran it and got SyntaxError: Non-ASCII character '\x92' in file C:\python\test.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details before I noticed anything was wrong?
 
sure ;)
 
@WayneWerner thanks that helps and the second value is a sub dictionary then?
 
Dreams crushed. Fizzy sad.
 
2:01 PM
@PM2Ring primarily php so it's just the odd figuring out of how the syntax works really
 
It's a dictionary that contains a list
 
@WayneWerner got it working now, thanks!
 
It's a dictionary whose keys are strings and whose values are lists whose elements are dictionaries whose keys and values are strings. ~~~Simple~~~.
 
@Silver89 My condolences. :) Python will seem a bit strange at first, but once you've learned to organize things in the Python way, I'm sure you will appreciate it.
 
@Kevin ah see, when you put it like that...
 
2:04 PM
My primary beef with dynamic typing is that there's no standard notation to describe the shape of nested data types.
 
OTOH...
Mar 30 '15 at 12:06, by PM 2Ring
@RobertGrant Understood. OTOH, do we really want ex-PHP programmers going straight into Python? Shouldn't they go through some sort of detox clinic first? :)
 
Other languages can say "that's a Dict<str, List<Dict<str,str>>>" with zero ambiguity
 
Charyou tree...
 
@Kevin I guess you could do something like {str: [{str: str}, ...], ...}
 
OTOH there's nothing stopping me from using that terminology in here, other than the possibility that no one will understand it. But when have I let a little thing like "comprehensibility" stop me?
 
2:08 PM
Technically by saying it's a dictionary you have zero ambiguity
or it's a dictionary with lists as values has zero ambiguity
it's just also really general ;)
 
DSM
Now that we have type hinting, aren't we basically committed to a standard notation?
 
"That's an object". Technically correct. The best kind of correct!
 
On a vaguely related note, what's up with those questions with strange data structures, eg lists of single-item dicts? I guess that it's an attempt at making a list with named fields, but it seems ugly and inefficient to me.
 
DSM
>>> Dict[str, List[Dict[str, str]]]
typing.Dict[str, typing.List[typing.Dict[str, str]]]
 
Aw, OP didn't like my technically correct but slow solution, because it's slow... I guess I can't blame him. I wouldn't want to incur a performance hit on every single attribute access, either.
 
DSM
2:12 PM
The second-best kind of correct, seems like..
 
@DSM Yeah but I keep forgetting that type hints exist.
Also I'm still on 3.4 so the name Dict doesn't exist for me.
 
@PM2Ring Teachers that don't understand Python teaching Python, probably -_-
 
@WayneWerner OP has added Python code, and fixed the { , } typos in his SQL caused by screwing up putting stuff in a code block.
 
@AnttiHaapala not bad
 
DSM
2:16 PM
@Kevin: 3.5's where it's at! How do you program with being able to write async def? ;-)
 
Terribly!
 
2:30 PM
This answer dealt with the OP's stated problem correctly, but totally ignored the old Why do my Tkinter widgets get stored as None? problem that infests the OP's code. But he fixed his answer pretty quickly after I commented. :)
 
cbg all. How's everyone doing?
 
DSM
Hey, inspector! Well enough, though I hope the weather improves soon.
 
inspector! cbg
how are you
things here are OK. Getting over a terrible virus. Still pretty weak =/
 
@DSM: I think we've seen the last snow here (Ottawa). This week brings us to +8, and next week is +22
@idjaw: my head still hurts from lack of sleep last night.
Oh no! @ virus. Did you catch that flu, or did you click on a link that a Nigerian Prince emailed you?
 
@idjaw and the family? Still down?
 
2:36 PM
@AndrasDeak yeah :( . My kids are home today with my wife.
 
I'm patient zero in my household
I infected everyone
 
Yet another victim of LPTHW: stackoverflow.com/questions/36576318/…
 
by the way, how many instances have inherited from you as a parent class (ahem classy parent)
 
two
 
2:37 PM
@idjaw :( All of you get well
 
thanks @AndrasDeak
 
I don't know how that should be said in English, your language is confusing and ambiguous
how can you not have a clear second-person imperative tense:P
"May the force be with you." Or it may not.
 
@AndrasDeak I understood what you meant. To be more proper you would say something like "Hope you all get well soon". Something like that. When you say "All of you get well". It's like you are demanding we all get well.
 
> (He claims if you just keep copying and try to understand the code it will eventually start to make sense)
Noooooo ^
@idjaw aaah, "hope you all get well soon", really tricky:)
 
^ what is he breeding script kiddies?
 
2:39 PM
going around the ambiguity, sounds great, thanks
 
Hey @inspectorG4dget: Here's a song you may enjoy. The late great Aussie vocalist & teacher Kerrie Biddell performing the Tony King song Is that Jazz on daytime TV 20 years ago.
 
@PM2Ring putting it on right now, thanks
 
@idjaw actually, we do say it in a demanding way in Hungarian, and an exclamation mark is mandatory at the end:D
I always have to make an effort to not use any exclamation marks in my emails to foreigners, lest they not get scared
 
haha
that's pretty interesting, actually.
 
feel better @idjaw and family! Shall I send you my license for Avast, to bust your virus?
 
2:41 PM
haha there ^ it is! ;D
 
everyone stop what you are doing
electricity fight!
 
No.
 
@Kevin nice answer on the "wildcard method" question using __getattr__ - I'm going to have to remember that one.
 
Yeah it's a nice trick, although I think it can be prone to misuse.
People want dynamic function names for the same reason they want "variable variables"
 
2:44 PM
@MattDMo link please? I'd like to learn this awesome trick as well
 
Both of the questions I answered today are about getattr. Interesting (to nobody but me) synchronicity.
 
@Kevin true.
 
Witchcraft. Have an upvote.
 
Also, yesterday on my drive home, AC/DC's "Dirty deeds" started playing on the radio. Mere hours after our discussion of "dunders, cheap"
 
2:46 PM
@idjaw WTY
 
:)
 
I know the science involved, but I'd piss my pants if I had to be one of those guys
 
yeah...I wouldn't have the guts to do that either
 
DSM
@PM2Ring: good find. That's almost a perfect example of a guy who's genuinely trying to learn and Shaw's crazy pacing has put him in a frustrating situation.
 
@Kevin "dynamic variable names are bad, and you should feel bad"
 
2:48 PM
Which isn't to say getattr should never be used. When the time is right, you'll know.
 
I'm just surprised that neither of them dressed up in a Goku or Sith Lord costume
 
It's similar to the adage "If you have to ask the price, you can't afford it."
 
OK cat lovers. It's time to send your cats in to battle. Cat armour is now available
3D printed cat armour
 
2:50 PM
I make my cat armour the old fashioned way, using a smithy, none of this 3D printed crap.
 
@DSM And it looks like he appreciates my advice. Yay! Another one rescued just in time. :)
 
Do you mine your own ore?
 
@WayneWerner No I collect meteorite fragments from the ground, only the best for Sir Mittens.
 
I'll hear none of that Fizzy.
 
Come at me brah, my meteorite-clad cat will batter you.
And you're Scottish, so you must know a lot about battering.
 
2:54 PM
Tastes best when deep fried
 
Heya Fizzy! Good to see you after so long
 
I once tried to get a burger and chips from a chippy in Edinburgh, the fella was most insisting that it should be battered.
 
Battered cat ?!
 
@inspector Sup. Things good?
 
well, if battered fish go well with chips, then I don't see why not a battered cat
@Ffisegydd things are good (... enough), thanks. Rediscovering my love for python, through pains with Java
 
2:56 PM
Java isn't as bad as people think (tee'ing up DSM here).
 
Go Jython! The Java folk won't notice any difference.
 
I'm doing a lot of MapReduce (so Java) at the moment.
 
@Ffisegydd The cheese burger is a shock to newcomers, that's for sure.
 
Java's better than BASIC. It's got that going for it.
 
This has been bothering me for a little while, and I can't for the life of me remember the answer. So say I have two variables: name = "Matt"; url = "mattdmo.com". I can put them in a list: l = [name, url]. I can print() the list, and see the strings. However, if I change one of the variables: name = "MattDMo", the list still contains the original strings. Is there a way to make a list of object identifiers, so as the object reference changes the list updates?
 
2:57 PM
@PM2Ring There's a single thing I don't understand regarding LPTHW: why do people want to learn Python the hard way, and why do they complain if it's difficult?
after all, it's not titled "Learn python in a straightforward way"
 
@MattDMo it's because strings are immutable I assume. Your list contains a reference to the "old" string.
 
You'd have to write a class to hold those strings.
 
From LPTHW: "Introduction: The Hard Way Is Easier"
 
When you do name = you're creating a new string with a new memory id (whatever the proper term is)
 
2:59 PM
@Ffisegydd right. I want the list to contain name and url, not "Matt" and "mattdmo.com". So if name changes, the list changes. Is that just because I'm using strings and not lists or dicts or something?
 
Actually, the name = part is not what causes that :P
 
eiwo' ghfgrejorbner
 
names can't point to names, right?
 
gesundheit
 
no wait, I'm not making any sense
 
3:00 PM
Though that's actually accurate - names can only point to values ;)
 
are you going to tell 'em @poke?
 
I don't have a Python install on this computer ;___;
 
@AndrasDeak My guess: people expect it to be some kind of boot-camp style of teaching. And they want that because they respond well to that kind of environment. Zed has the sergeant-major persona down pat, but his boot-camp is not very well-organized, so people don't emerge from it with the skills they expect. He works them hard, but they don't get the rewards they expect from getting pushed hard like that.
 
oh, well
 
That's about the only way to do it if you want to mutate the values in a list.
Or any sequence type.
 
3:02 PM
"foo" creates a string object, the literal does; when you modify that string into something else, e.g. by slicing it, you are creating a new string object.
 
It's a marketing gimmick, nothing else. He's selling the idea that readers need to learn from him and noone else so they'll buy his videos.
 
Is that not what I said?
 
@Ffisegydd a terrible admission. PythonAnywhere FTW
 
Ah I see the confusion. I didn't actually think name = does the magic, I was just too lazy to type the name = "MattDMo"
 
@Ffisegydd The assignment does not create the new string; the assignment just changes what the name references. The new string exists before the assignment.
 
3:03 PM
Everyone knows that you have to put forward effort to learn something. Zed wants you to think you'll only put forward that effort if you're using his book.
 
Yes.
 
yup, that :)
 
@PM2Ring Zed has the sergeant-major persona down pat <- well, he /does/ have a military background
 
@Morgan'Venti'Thrappuccino ok, that works...
 
@MattDMo Is it absurd and overkill? Yes. But it's the only way to do it. :P
 
3:04 PM
A similar thing occurs in tuples IIRC. You can make a tuple of lists which is immutable but then modify the list because it is mutable. So it's still the same tuple (as it is the same collection of objects with reference X) but the list has changed.
 
this also works:
In [31]: a = [1,2,3]

In [32]: b = [4,5,6]

In [33]: c = [a, b]

In [34]: a.append(10)

In [35]: a
Out[35]: [1, 2, 3, 10]

In [36]: c
Out[36]: [[1, 2, 3, 10], [4, 5, 6]]
 
Because a and b are lists, and lists are mutable.
 
but it doesn't work if I assign an entirely new list to a.
 
Indeed.
 
@Ffisegydd True story. But using them as hash keys generates some complaints
 
3:05 PM
Same reason that StringHolder thing worked because StringHolder is a mutable object.
 
@poke OK, I think that's what I was missing - mutability
 
>>> x = ([1, 2,3], 4)
>>> {x: 42}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
cue sad trombone
 
@MattDMo You can wrap the string (or other immutable) isn a list, and mutate the list. Eg,
name, url = ["Matt"], ["mattdmo.com"]
a = [name, url]
name[0] = "Fred"
print(a)
prints
 
Cheeky.
 
[['Fred'], ['mattdmo.com']]
 
3:07 PM
@davidism OP responded and solved the problem from last night!
 
@PM2Ring right, but if I do name = ["Fred"] instead of name[0] = "Fred" it won't work.
 
Because that assignes a new object to name again which will be a different object from the one in your list a.
 
@MattDMo No, because you're binding a new list to name. But you can do
a[1][0]="flintstone.com"
[['Fred'], ['flintstone.com']]
 
Right. So, getting back to my original problem, is there any way (besides a custom class) of making a container that contains the identifier and whatever object it happens to be pointing to at the time? I'm guessing not.
 
Or
name[:] = ["George'"]
[["George'"], ['flintstone.com']]
 
3:11 PM
hmm, hadn't thought about that
 
@MattDMo Dictionary?
 
data = {
    'name': 'Matt',
    'url': 'mattdmo.com'
}
print(data['name'])
data['name'] = 'foo'
print(data['name'])
 
@MattDMo You guess correctly. Python doesn't have pointers. In fact, it doesn't even have variables in the sense of a named region of RAM that you store stuff in. It has objects and names.
 
3:13 PM
Or simple namespaces:
data = SimpleNamespace()
data.name = 'Matt'
data.url = 'mattdmo.com'
print(data.name)
data.name = 'foo'
print(data.name)
 
@MattDMo: Facts and myths about Python names and values, by SO veteran Ned Batchelder, covers this stuff nicely. It's not perfect, IMHO, but it is pretty good.
 
DSM
@poke: since that's what I was betting on, where do I go to claim my winnings? (request.json, I mean.)
 
OK, I'm getting it now. "pointers" was the word I needed.
 
@DSM I’m not convinced that you were betting on that before I wrote my initial comment :P
 
:) remarkable number of badly guessed answers there from many who should know better
 
3:17 PM
oh yeah. I got a chance to see them before they got deleted.
it was rather annoying
 
DSM
@poke: in my defence I don't think I had even read the question before one of you guys linked it, and I can't remember if I read the comment before the question or not. But as soon as I see AttributeErrors, I think "typo", "wrong object", "shadowing", in roughly that order.
 
FGITW battle
 
@JRichardSnape Yeah, it was a real mess. There were some really “interesting” comments too which were deleted later.
@DSM Heh, well as you said yourself, it wasn’t exactly hard to spot :P
 
cbg
 
3:35 PM
cbg, Antti
hey @AnttiHaapala, do you have any nieces or nephews?
 
Gonna make me some python mapping software. The urge has finally overcome my inner sloth
 
Really tempted to set up an RPi Hadoop cluster.
 
DSM
Your temptations are very unusual.
 
@JRichardSnape ArcGIS has a python API, if that helps
 
You have no idea.
 
DSM
3:42 PM
The phrase "you have no idea" is forever linked to Scar for me.
 
Eh actually maybe not. I was hoping you could get some decent speed from a cluster, kinda like the plucky-little-pi-that-could.
Apparently this is not the case, they're really, really slow.
> So how does it perform? Well, I loaded it up with slightly over 300 Mbytes of text data and ran wordcount across 3 non-overclocked worker nodes. It took 23 minutes. The same data running on my Macbook Air (SSD disk) in psuedo-mode took 1 minute 19 seconds.
 
Depends on the task at hand. I think if you had a Macbook Air's worth of RPis, you might be in with a chance?
 
Someone has managed to build their own 4-node cluster for <$300 using actual components.
@IntrepidBrit yes but I already have a MacBook and didn't want to spend £700 on the cluster :P
 
One thing that's surprisingly cost effective is appropriating old consoles
 
Also got to take into account the Missus factor here.
"Fizzy, why do you have an extra 4 PCs in the front room?" "SCIENCE!"
 
3:53 PM
@inspectorG4dget me? no
 
I've found that if I yell SCIENCE excitedly enough, the IntrepidPartner lets me get away with more than I would have otherwise expected.
Definitely worth a shot
 
science has gotten me out of similar trouble before.
worth a shot
 
To be fair FizzyGirl also has a PhD so she is understanding.
 
even more of a reason
 
But we also have quite a small flat and most of my stuff is everywhere, so there's only so far I can push it.
 
3:54 PM
you don't need clothes fizzy. Get rid of your clothes
replace with the cluster
 
I just spent £X on shoes, I can't afford a cluster right now ;_;
 
@Ffisegydd build a cluster of inmos transputers
 
Even better project: Build a Hadoop cluster that can fit into a briefcase.
 
Even, EVEN, better - build a hadoop cluster that's sewn into your CLOTHES
 
@AnttiHaapala ack! I was all set to pun about them calling you Uncle Antti
 
user559633
4:02 PM
bonus: your cluster is also your heater
 
user559633
also, i didn't realize that you were hoarding advanced degrees in your home, fizzypants
 
@DSM My siblings and I actually used to quote Lion King - the entire movie. With song.
I have quite a few different movies and stories and songs and comedy that are linked to various words and phrases. For-ev-errrrr
 
@tristan Some people juggle geese.
 
@WayneWerner I can see what's happening (and they don't have a clue)
 
user559633
@Ffisegydd sure, sure
 
4:06 PM
@Ffisegydd Are you a leaf in the wind?
 
@inspectorG4dget They'll fall in love... (see my point?)
 
@WayneWerner here's the bottom line: our trio's down to two
 
(oh)
youtube.com/watch?v=cMfmzEpvW-g pretty much every word in that is linked to that skit forever
 
galoshes!
hulabaloo. Foible.
Tuberculosis.
@Programmer Didn't even know that was a thing o.O
 
4:09 PM
Am I missing something on Can you make this code about months shorter? 7 comments and no one posts a link to code review, and as soon as I do someone questions me.
 
Shame on us for being busy. It was a great idea
 
This seems like textbook CR to me so I'm boggling at the hostility
 
I don't know that I'd call it hostility, but definitely the correct response to the one who questioned you...
 
I don't think all "I have working code but it's ugly, is there a better way?"-questions are necessarily "code review" questions, as such. i.e. this one is okay (but a duplicate).
 
@Carpetsmoker That might be true, but really I can't think of a good countercase...
like, "This would be better on SO than codereview"
 
DSM
4:14 PM
"Yes, shortening code by reducing redundancy is within the scope of Code Review — it naturally falls under the category of general code improvements."
 
when CR didn't exist, then yeah, sure...
 
In general, if it's a specific single-issue question that would be on-topic without the working code, I leave it be
Nothing wrong with some overlap between CR and SO
 
I can imagine "would be better on SO than codereview" applying for a question where OP has functional code, but is riddled with 'workarounds' that are symptomatic of PEBCAK
In which case the root problem is in OP's understanding of language concepts, rather than the code
 
I can agree with that
 
DSM
I've been a little annoyed at CR ever since a CR-like question I answered on SO was migrated and then eventually deleted. :-/
 
4:19 PM
Unrelated. I've seen two posts today that could have been dupe-closed using my "put text anywhere you want" canonical post. If only I had actually written it. #regret
 
Though I think the case when someone has working code full of WTFs and they're looking to improve it even though they don't understand programming... is probably more rare than getting struck by lightning, in a tornado, and winning the lottery at the same time
@Kevin what is this imaginary post you speak of?
 
We occasionally get questions like this one where OP asks "how do I go up a line on the console?" or "how do I overwrite text I've already written?" or "how do I put a character at position (5,10) on the console?".
 
@WayneWerner I dunno, that sounds like me when I first started programming. I had a vague idea of what I needed to do, but not enough where I wasn't taking the toy plastic hammer that I found and using it to pound in screws, staples, pipe fittings, etc. I knew there were other tools, but all of them made my brain hurt, so I just stuck with the plastic hammer. I don't think it's that uncommon.
 
I am very slowly putting together an authoritative Q&A post that seeks to answer all of these questions simultaneously, in a way that is applicable to any platform.
 
DSM
I'll say this, you don't aim small.
 
4:25 PM
I got as far as this before I decided that the use case was contrived.
 
DSM
curses is another of those modules I've never used outside of SO.
 
I have code for all the [todo - insert X code here] bits, but they all just write "Hello, world" five spaces from the left and ten spaces from the top.
Which isn't really something that OPs specifically want to do? I'd like something actually useful.
OTOH if I spend an extra dozen lines writing something flashy, maybe readers will think "ugh I just need the most basic code possible for changing the position of the cursor, you are just bogging me down with a demo that prints a flashing "EAT AT JOE'S sign""
Also there's a little problem that these all position the cursor absolutely in reference to the upper-left corner of the screen, when a sizable portion of OPs actually need relative positioning. Ex "I want to go up two lines from where I am now".
For approaches like ctypes, that would require another fifty lines of code. For approaches like ANSI escape sequences, it's flat-out impossible.
 
DSM
Really? Isn't there a relative up escape seq?
 
I expect the majority of OPs would be happy to have just absolute positioning, and would be willing to refactor their existing code to use it instead of holding out for a relative approach. But then I could hardly call my post "authoritative" then.
@DSM Not to my knowledge.
 
DSM
The Worldmind suggests you may be mistaken.
 
4:33 PM
Oh, here it is. "ESC[#A moves cursor up # lines". Admittedly, I only researched that approach for like two minutes.
Ok, this is good. So it's only ctypes that's a nightmare.
I'm willing to have exactly one code sample that's horrible. It will act as a duck that makes the user think "well I'll just use one of the sane approaches, then"
 
@Morgan'Venti'Thrappuccino Well, sure. But were you seeking out expert opinions trying to make your code better back then? ;)
 
That depends on if this room counts as experts or not. :P
 
Yeah - up # lines is fun - that's what docker uses (and where I found it)
I knew I could do '\r'... that bit me in a corpus of text and I couldn't figure out why the heck I was displaying weird text
 
Hmm, not sure if colorama does relative positioning... I may need to nix it entirely from the post.
 
if I printed out char by char it had the right ones
I don't remember if I posted a question here on SO about that
but I know someone else pointed me towards the carriage return
I started using that for displaying timers after that ;)
 
4:59 PM
First P60 of a "real job"
 

« first day (2005 days earlier)      last day (2940 days later) »