« first day (1716 days earlier)      last day (3227 days later) » 

12:00 AM
def to_int(a):
    return to_int(a[:-1])*26 + (ABC.index(a[-1]) + 1) if a else 0

def to_alpha(n):
    return to_alpha(-(-n // 26) - 1) + ABC[(n % 26) - 1] if n else ''
ABC is string.ascii_uppercase
So now that I've set myself up for more potential embarrassment, I'm going to run these for a bunch of arguments in my terminal and see if I missed any more edge-cases.
 
@Owatch long time no see - how ya been?
 
@Skylion or import re then print(re.split('[+$%M]', line))
 
@JonClements I've been working on a project I guess. Summer's come around now and I've got some plans to travel again this fall.
It's almost done. Then I can finally relax.
 
Just good to see you're well ;)
 
It's a bit sad I've been so absent.
But I'm always on SO
 
12:05 AM
Wouldn't worry about it - most of us have things called "lives" that need doing :p
 
Once I'm done with what I'm currently working on, I think I'll come back to Python for a bit. So you should see me more often.
I've got something I want to do with Flask, and then I saw some neat plotting a guy in the math chat room was doing with Python, so I want to try that too.
 
Owatch based on my quick search, we started in this room about the same time. Based on my first comment, I seemed to think someone wanted to chat with me here.
It could have been hubris. I've been known to have that quality some times.
(It's actually ironic hubris, but you can never tell with me.)
 
I was sure I'd seen your username somewhere. I just didn't remember what you did.
Thank you for refreshing me.
 
Yeah, my first recorded interactions here seemed to be me helping someone with regex.
 
I didn't help anyone at all. Only asked questions.
 
12:16 AM
No I searched wrong, first time in the room Jon welcomed me.
2013
 
I, will be going now.
I generally go swimming in the evening
And it's about time now. I've got my podcast downloaded for the car.
 
Have fun. Don't dive in the shallow end.
Swim parallel to the beach to escape a rip tide.
 
The pool is pretty shallow in general.
Only 4.25ft at its deepest.
 
Then watch out for alligators.
covers all the bases
 
I usually watch out for drop-bears, that tend to hang out around the hedges and overhang near the entrance to the complex.
 
12:19 AM
what about crocodiles or water snakes?
 
Alright, I'm out-
 
Large reptiles or other predators.
Polar bears can be pretty nasty.
 
12:53 AM
@JGreenwell Could you please tell me the proper regex expression? I been struggling with this for almost an hour. Once again I need to split a string on *,X,+,-, and%
 
"it just crashes when it reaches that line" come on, you should know by now to be more specific than that
 
@skylion it was in my reply
import re
print(re.split('[+$%M]', line))
and change print to whatever type of assignment you want
except change M to X and add -* to the character class
 
1:38 AM
for float rounding problems: is it preferred to use math.ceil (or floor) and the standard mathematical equations or is there a function on Decimal that I'm just blind to?
 
@JGreenwell gimme use-case.
You need strings?
or you need rounding to arbitrary precision? use round for that
format for strings
 
just writing a knapsack change program and had a few outliers that hit float rounding issues....can just use ceil and force round up for these cases (+/- .01 would prefer plus was a condition) but was trying to think of a better method
 
>>> round(999.911111, 2)
999.91
>>> round(2/3.0, 2)
0.67
>>> round(1/3.0, 2)
0.33
@JGreenwell is that what you're looking for?
 
hmm...yeah, using round...still getting outliers; must be error in my code somewhere else
If I find it or get too lost, I'll make up a use-case/question and post it
Thanks though that helped
 
That's what I aim to do.
Though sometimes I play Don Quixote.
 
1:50 AM
yeah, just going to pull the math aspects out and start running through them - either I'll find the error or develop a new proof. I call it a win either way
*slaps self in head
I rounded the total calculations but not the change due ones
 
That's programming!
 
2:12 AM
Hobbits!
 
2:27 AM
K. project completed (after silly error). Mid-Term time. Rbrb all
 
2:44 AM
Nice.
 
2:58 AM
HAH! 11 minutes out of 1 hour and a perfect score....+10 points extra credit :)
 
3:15 AM
score
Congrats, I'm being called to bed, good night everybody!
 
good night @AaronHall; its off to bed for me too
 
 
3 hours later…
6:20 AM
cbg
 
Cabbage @AnttiHaapala
 
@JGreenwell multiply by 100
@JGreenwell add *-, @Skylion you need to remember that - in character class must come first or last; [a-z] is different from [az-], so [+$%M*-]
 
 
1 hour later…
7:47 AM
Hey up
 
8:25 AM
hello
 
9:04 AM
Hey up Reut, been a while.
 
9:15 AM
That's it. I'm done with Ubuntu. You've double crossed me for the last time.
Any suggestions on a linux distro which won't suddenly "unclaim" both my network adapters would be much appreciated
(cabbage folks)
 
@Intrepid OS X?
 
Nope!
 
I kid. People recommend Arch.
And by people I mean davidism and Peter off the top of my head.
 
Hm, I hesitate over "bleeding edge" *nix installs
I've basically spend last night and this morning trying to get Ubuntu to work, so I can do some nibada, and I've realised I've spent more time in trying to tame the last 2 ubuntu versions than working under it
and part of the reason is that an automatic update has borked my system
Although, I do like the sound of Arch's methodology. Only installs the minimal amount to get it to work
 
9:39 AM
@Intrepid well @davidism especially raves about it (literally, he actually froths at the mouth).
 
9:54 AM
Hey @Ffisegydd , yeah, I'm in a new city with a new job
 
10:14 AM
@ReutSharabani congrats!
Exciting new times?
 
 
1 hour later…
11:39 AM
CBG!
AttributeError("type object 'datetime.datetime' has no attribute 'datetime'",)
I did import datetime but still I'm getting this error
import datetime
`now = datetime.datetime.now()
 
@MartijnPieters yeah it's nice, working with good people...
Not that the previous job was bad
 
12:02 PM
cbg
 
12:14 PM
Oh! I see
I had done from datetime import datetime
and then
now = datetime.datetime.now()
@AnttiHaapala CBG!
 
cabbage
@d-coder Don't worry, just about everybody who's ever used datetime has done that sort of thing at least once. :) I recommend just doing import datetime. Sure, it makes your method calls longer to type, but it will save you from a world of pain.
 
12:31 PM
@d-coder python is at fault there :D
the naming is just bad, and what is worse, it wasn't fixed for Python 3.
 
@PM2Ring Yes! I totally agree with you! :)
@AnttiHaapala : HA! How about it in Python 4 ? :P
 
1:01 PM
Cbg!
 
Hey up again
I personally prefer import datetime as dt
Shortens the name but keeps things nice and easy to understand.
 
Don't know why, but was messing around and made a little pi calculator which overwrites stdout each time and just keeps perfecting pi. I'm such a nerd but it's quite nice to watch it go
from __future__ import division
import sys

current = 0
max_int_length = len(str(sys.maxint))

for i in xrange(sys.maxint):
    current += 4 * (-1)**i / (2*i + 1)
    sys.stdout.write(
        "\r({precision:0{max_int_length}d}) Pi Estimate = {estimate}".format(
            precision=i, max_int_length=max_int_length, estimate=current
        )
    )
    sys.stdout.flush()
 
@Ffisegydd Yeah. Good thinking.
@IanClark You could use a better pi algorithm. That Leibniz arctan(1) series is one of the slowest known ways to compute pi.
If you want to stick with arctan series, try a Machin-like formula.
 
@PM2Ring :D, I'm sure you're right - and I'm not actually trying to compute pi for any real reason, but it's nice to watch it tick up slowly and see how the precision progresses
 
Fair enough. OTOH, if you want something that's even faster than arctan series, take a look at this code I wrote for the Salamin / Brent / Gauss Arithmetic-Geometric Mean.
FWIW, a decade or so ago I computed pi by hand (i.e., pen & paper, no calculator) to about 10 decimals using a Machin-like formula.
pi=4*(4*(2*atan2(1,10)-atan2(1,515))-atan2(1,239))
The series for atan2(1,10) is nice for manual calculation, and the other 2 series converge pretty quickly, so you don't need to compute many terms of them.
 
1:19 PM
Cabbage!
 
@poke Cbg :)
 
How is everyone’s Sunday?
 
Splendid TY, and yours?
 
So far very lazy, which is good ;)
 
@poke Hi, Poke. My Sunday will be over in 37 minutes. :) It's been ok.
 
1:24 PM
Poor Australia… ^^
 
1:46 PM
@poke: enabler :-P
Here was me trying to steer the user into actually asking a decent question rather than firing of an answer..
(and I have answered so plenty of times in the past anyway, I am not innocent here).
 
Sorry :P
But for such super simple questions, I often don’t have the energy to wait for them to improve the question when it’s just a super simple question that takes me a minute ^^"
I know I should do better than that.
 
There's a current Meta SO post about answering easy questions... :)
 
 
1 hour later…
2:55 PM
So I am trying the regex "[+$%X*-]" as recommended last night, but it's not splitting on Xs.
 
Please provide an actual problem (so people don't have to skip back to last night).
Along with strings that it should pass and fail on.
And any possible edge cases you know of.
 
3:15 PM
Okay, so I just want to split a string on +, %, /, *, - and X
I am pretty sure most of those are special characters though
 
It works for me...
>>> import re
>>> p=re.compile(r'[+$%X*-]')
>>> p.split('abc+def$ghi%jklXmno*pqr-stu')
['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu']
@Skylion You (mostly) don't have to worry about regex's special characters inside character classes.
The exceptions are  `^`, `]` and `-`
 
3:31 PM
rhubarb
 
@Skylion that split works, if your having a problem it is elsewhere in the implementation. Note @AnttiHaapala noted the fact that '-' should be at the end last night, as it is one of the rare special characters within a regex character class.
 
lol I was just using string.split instead of compile
Thank you so much
 
@JGreenwell not only at the end, but you may place it at the start or at the middle(you need to escape that)
@PM2Ring I simply use re.split(r'\W+', s)
sorry forget the X
>>> re.split(r'[X\W]+', 'abc+def$ghi%jklXmno*pqr-stu')
['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu']
 
3:51 PM
yes, putting it at the end was just how it was related last night :)
 
4:18 PM
hmm.. I think I found a somewhat interesting problem: I want to create some factory classes, which has inheritable variable properties, and which can also act as an instance of its own instance.. here is an example: gist.github.com/petervaro/db6607e9bafd89c4a3b7
I tried several things, mostly tinkering with __new__ and __call__
but what I cannot achieve is how to make the variable property inheritance work, without hardcoding all the details
(maybe this is an XY question, and the problem is in the original design concept, so any suggestions are welcome)
 
user559633
4:46 PM
If an answer is added and removed from a question (flagged down or otherwise), does the question still show as "active" for the day?
 
@tristan I believe any activity will make it “active”
 
user559633
@poke Thanks. It now looks like I dug up a 2 year old question :/ (i didn't bother to check the dates before answering)
 
Digging out old questions isn’t a problem at all
there’s even a badge for it
 
user559633
[nope, not excavator]
 
@PeterVaro That’s a super interesting problem
 
4:58 PM
@poke it is, isn't it?
 
I don’t think it’s fully possible though
 
in your opinion, which subproblem is the "bottleneck"?
 
class Data:
    def __init__ (self, default = None, option = None):
        self.default = default
        self.value = default
        self.option = option

    def __call__ (self, value = None):
        x = self.__class__()
        x.value = value or self.default
        x.option = self.option
        return x

    def __repr__ (self):
        return ('class: {0.__class__.__name__},'
                ' value: {0.value},'
                ' option: {0.option}'.format(self))
There. Solved.
 
nah, this is not a real solution, because as I mentioned, I don't want to hardcode the variable properties' inheritance
+ this means, each of the instances are storing the exact same data
it is not stored in the class object
 
uhh
Do you have an example for that?
also how is the default/value thing supposed to work then, when it’s not built into the type/factory?
Or are you just talking about option and similar parameters?
 
5:13 PM
I have an example, a solid 500 lines of code => which is not working at the moment => that's why I created an SSCCE
and yes, option is just an example
 
Can you provide some more test cases though that show that variable variables part?
 
there could be any number of anything
 
Okay, but value and default are always there?
 
those two are always there, yes
 
So Data(default=X, **kwargs) will create a new object, which when called creates a new object that sets the value (first parameter) and inherits all the kwargs?
 
5:15 PM
the other example: not only primitive types, but also containers/collections can be there as well: which needs parsing methods, extendinf the default values methods, and base-types
@poke yepp
also **kwargs should be stored in the "base-instance" class
as it is redundant data, to hold by each instances created by the base-instance class
 
I think I have an idea how to do this..
 
can't wait to see that ;)
 
5:31 PM
class Data:
    def __init__ (self, **kwargs):
        if '__parent' in kwargs:
            self.__parent = kwargs['__parent']
            del kwargs['__parent']

        if 'default' in kwargs:
            self.value = kwargs['default']

        for k, v in kwargs.items():
            setattr(self, k, v)

    def __getattr__ (self, name):
        return getattr(self.__parent, name)

    def __call__ (self, value = None):
        x = self.__class__(__parent=self)
        x.value = value or self.value
There; it will not copy any values into the created subobject, and instead, the subobject will look up into the parent for any attribute it couldn’t find. The parent is passed as a special __parent keyword argument.
default is only special in the way that it initializes the value
 
@poke feels pretty hackish, but ofc it is a working solution -- nice idea btw
 
And value is only special in that it is set explicitely when calling the object.
Your requirement is pretty hackish too :P
 
is it? ;)
 
You could probably avoid that __parent key, if you were to create the instance in __call__ without invoking the initializer.
 
@poke One sec and I will use it, and let's find out how it works
@poke (something totally different, but AFAIK you are interested in C development as well) => if you ever need a strictly standard compilant, portable and truly generic pointer in C, here it is: Convertible Pointer
 
5:48 PM
nvm -- my bad
 
Yo, I am trying to load image from a file that is not saved anywhere with PIL, any idea how to do this?
 
@Skylion just a friendly advice: use Pillow instead of PIL as the latter is abandoned for quite a while now
 
user559633
Don't 'yo' me if you don't know me.
 
"I am trying to load image from a file that is not saved anywhere..." wat? How are you hoping to load it then if it doesn't exist?
 
6:09 PM
@PeterVaro I’ve updated my solution a bit, making it a bit more robust: gist.github.com/petervaro/db6607e9bafd89c4a3b7#comment-1482178
 
@poke I've already rewritten your previous version, but will take a look at the new one in a sec
anywho, thanks for the cooperation ;)
 
:)
I like difficult requests :P
 
6:27 PM
hey!
how can i install py2app with pip if I have python 2 and 3 installed on my computer
 
user559633
@feners look into virtual environments. it will solve this request and so much more for you
 
I tried sudo pip install -U py2app but that installed on python2
 
user559633
also, welcome :)
 
i see..
thanks
 
user559633
 
6:28 PM
cbg
class Reset(luigi.Task):
  is_complete = False
  def complete(self):
    return self.is_complete
  def run(self):
    print 'resetting'
    rmtree('./data')
    cur = conn.cursor()
    cur.execute("""TRUNCATE table_updates, F_entrances, F_purchases, D_products, D_stores, D_customers;""")
    self.is_complete = True
For some reason, this isn't completing. Is there anything axiomatically wrong?
 
user559633
@SomeKittens where is it stopping/failing? what if you comment out the DB execute command to rule that out?
 
@tristan The task runner (Luigi) isn't exiting
 
user559633
[assuming there's not some magic in luigi.Task that i'm not aware about]
 
user559633
@SomeKittens does luigi call reset.complete() to determine state? same question with DB in case your conn is hanging.
 
So we had someone who had installed Anaconda and was trying to use virtual environments at Office Hours. I convinced her to just stick with Anaconda. Is anyone familiar with using virtual environments with Anaconda?
 
6:32 PM
Ah, yep, it's the DB
works fine when that's commented out
 
user559633
I'm a wizard. It's always the DB. Or the network. Or you sent your code to run on a toaster. Or all of the above.
 
hey tristan, i manged to install using pip3 install -U py2app..... any issue with this you can think of, or would it be fine? @tristan
 
@tristan My toaster isn't even plugged in, that may be it
 
user559633
@SomeKittens Oh, yeah, and it's Sunday, so you should either have a toasted sandwich or a drink in your hand. I'll wait.
 
/me is slowly nursing his coffee
 
user559633
6:37 PM
@feners Did you activate the virtual environment? what happened when you tried it?
 
actually, this is a good time for a refill
ah, looks like a table lock issue!
exciting
 
@tristan i managed to do it without a virtual environment..
 
user559633
@feners okay, good luck. i hope it works for you
 
@tristan ahaha know I'm left wondering if that was a wrong thing to do.. lol
but i can import it now without problems, until now I guess..
 
user559633
@feners i suggested using virtualenvs and linked you to the documentation for a reason. if you decided to go for it a different way, i'd have to guess what you did, which gets boring
 
6:42 PM
...it is oddly difficult to return to a sync state of mind
 
7:03 PM
No thoughts on my Anaconda question?
 
@AaronHall Generally they don't want anything if you lack bread to surround your meat-based sandwich.
 
I don't follow that
 
user559633
I thought anaconda used its own package manager
 
@AaronHall My anaconda don't want none unless you've got buns, hun.
 
@tristan exactly, so we don't need virtual environments at all, right?
By the way, is your talk good to go?
 
user559633
7:10 PM
@AaronHall not what i'm saying, just wondering if there was something built into their package manager to address versioning/sealed environments
 
user559633
@AaronHall nope. did the outline and was waiting to hear back before i started putting work into it. $employer is encouraging me to speak, so i'll have time to work on it if it gets accepted
 
user559633
How about your talk?
 
I wrote a huge outline, pretty sure we're gonna do it, only question is do I get 55 minutes or 25.
I'm lobbying for 55.
 
user559633
Cool. I'm sticking to the 25 because a chunk of my talk is going to be "assume i'm not telling you lies, but please follow this link to github to see if i'm doing it on accident"
 
7:32 PM
I'm going to make a huge slide-deck.
and submit it to my firm for approval.
 
7:44 PM
I disagree with not needing a virtualenv, even with Anaconda. What if one project has to have a certain dependency that is not usual? i.e. a bleeding edge install. You may have another project that needs the standard release.
Of course it might be that the person was fine, in which case just using Anaconda is okay I suppose, but you should make them aware of it.
Otherwise you may be setting them up for a fall in X months time.
I assume this person was using Windows of course, which makes dev a bit more difficult sometimes. I've never personally found the need to use Anaconda on anything else.
 
Actually was using on OS X
 
Anaconda on OS X? Really? I'd never suggest that.
You can use homebrew to install your own python (as ideally you want to avoid using the system install in case you muck it up).
I then use virtualenvs for everything I do.
 
She wanted latest pandas/requests/oauth2 etc...
 
That shouldn't be a problem as you're using pip. In fact I've had more issues with Anaconda not supporting the most up-to-date versions.
 
anaconda lets me be platform agnostic (for the most part)
 
7:50 PM
cbg
 
So does using a virtualenv though? It's the same in Linux/Windows/OS X. You just use pip instead of conda install xxx (can't remember the exact syntax).
 
solves/bypasses all (current) package problems
plus I've never sorted out virtual environments.
 
You should try them out, they're much better (IMO).
 
so it's either virtual environments with pip install or conda.
And now there's docker containers
 
For example sopython used the bleeding edge version of Flask, which makes it useful to install within a virtualenv.
 
user559633
7:52 PM
i wouldn't add docker to the confusion for a user that didn't get virtualenvs sorted
 
Yeah definitely.
 
the venv is the sanctioned python way now
especially with python 3.4/pyvenv
 
Yeah, that's why I'm doing anaconda
simple, single install, many things out of the box
 
I am not even understanding docker myself
 
user559633
@AnttiHaapala It's linux containts + convenience scripts + a shitload of marketing
 
7:54 PM
I do like virtualbox but that's kinda different, more fully formed OS.
 
but I do not understand what is so convenient in it :d
maybe I've become old but if I do not understand something then usually I think it is not worth it
 
user559633
i call my friend mike and i'm like "hey mike go to the apple store and buy a new one, i have a script that i want to dictate to you"
 
user559633
@AnttiHaapala you can pass around a container as an artifact to run on an arbitrary machine
 
causality: you probably didn't figure something out because you didn't think it was worth it.
Haven't figured out flask or django yet myself.
I'm still trying to build a strong understanding of core Python.
 
8:08 PM
@PeeHaa closed.
 
user559633
Typically I'd feel bad for stomping a question out in under 5 minutes, but that one was really bad and had 3 comments pointing the user to how to ask
 
@AaronHall ty
 
It was particularly egregious.
 
user559633
and re-open vote.
 
OP still hasn't explained what the issue is
Damnit. I'm too slow @tristan
 
user559633
8:11 PM
because it's a new user and we dogpiled before he/she could respond to criticism
 
with self.output().open('w') as out_file:
  for row in rows:
    # print row
    out_file.write('{}\t{}\t{}\t{}\t{}\t{}\t{}\n'.format(
      row[0],
      row[1],
      row[2],
      row[3],
      row[4],
      row[5],
      row[6]
    ))
is there a non-silly way to do this?
 
Yah use '\t'.join(row)
Note you'll also have to add a '\n'
So it'll become something like out_file.write('\t'.join(row) + '\n')
 
awesome, thanks
 
Though this assumes that row only has 7 elements. So you may need something like row[:6] in there if you actually have more but only want to print the first 7.
 
it'll always be outputting all the row contents
 
user559633
8:16 PM
python3 or 2?
 
user559633
HISSSSS throws rock
 
@tristan It's what was installed
 
user559633
i'm just being a fart; you don't need to explain yourself to me
 
several of us still use python 2
 
8:18 PM
Would there be a better way to do that in 3?
 
user559633
@JGreenwell yeah, i use it too sometimes
 
user559633
@SomeKittens nah, just tailoring to your version for a paste
 
yeah - most of the boxes I use I can only use 2. I use 3 where I can, to get used to it.
 
Is the python 3 migration still in such sad shape?
 
I know, you were "cursing" that fact once....or was that me and you agreed with me..eh, blends together too much sometimes
 
8:20 PM
so were we going to reopen that question?
 
Or is it just you @JRichardSnape?
 
user559633
@JGreenwell Nah, if someone uses 2, that's entirely fine with me. If it's a new user and he's saying he's learning python for the first time and going with 2, that's one of the few reasons I'd trade a few lines about a major version choice
 
@AaronHall I am more than happy reopen it once all the needed info is added to the question and there is an actuual question
 
@AaronHall did we ever truly close it?
 
@PeeHaa Nah, I write code that has to run on boxes where I have no control over versions installed. I am also in bad shape, but that is another issue. My impression is that Python 3 is in very good shape.
 
8:23 PM
@JRichardSnape Ah good to know 3 finally picked up. That is/was some proper shitty situation
 
must have been me then....oh, yeah. When I was saying how silly it was that a college course here used python 2 and you must of said something....or working on this last essay is causing me to go crazy................yeah, one of those has to be true
 
And now my tables aren't truncating
 
I have similar issues with Java and the new Streams in Java 8, but this is neither the time nor the place.
 
Python 3 is progressing nicely. Most* major libraries now support both, or if they don't then there's a new library developed to surpass it in its 3ness.
 
user559633
if you end up with a lot of lines @SomeKittens, you could do something like this:

>>> tea = ['green', 'black', 'red']
>>> my_line = ("\t".join(t for t in tea)) + "\n"
>>> my_line
'green\tblack\tred\n'
 
8:23 PM
it's just that the # of lines keeps changing
so I forget to change a bit and then get some error about tuples but I check and my food's still fresh.
 
@AaronHall I voted reopen. Tempted to edit what's in comments to make it a proper question as an educational tool.
 
@JRichardSnape OP is so close to an actual question I can almost taste it :P
 
@tristan Is there any particular reason why you've done t for t in tea and not just tea?
 
yeah - hopefully they will work it out and edit it in for themselves. Also the requirement to limit input to 0<=x<=180
 
user559633
@Ffisegydd no good reason, nope! (i was heading down the path of a niftier looking *args setup)
 
8:28 PM
Ah ok. Thought I was missing something there, turns out you're just dumb.
<3
 
user559633
@Ffisegydd Yeah that should be the default assumption
 
user559633
Coupled with the fact that I'm working on threaded code for the "authoritative source of truth" at $employer, this should be a fun week.
 
user559633
 
user559633
jeez wikipedia, not every image has to be updated for the topic of the moment..
 
the "authoritative source of truth"? Is that your pet name when you start talking about yourself in the 3rd person?
 
8:32 PM
I would tell you my pet name for tristan but it's NSFC.
 
user559633
@JRichardSnape haha, no, i'm closer to the night's watch if anything.
 
user559633
8:50 PM
If the GIL makes it so only one bytecode thread may be running at any given time, what is the strategy for when two tasks try to run at the exact same time? (answer: there are checks at every sys.setcheckinterval())
 
user559633
@AaronHall Say that you have two threads that return from a sleep at the same time
 
9:40 PM
How can I get locale form ll_CC in django app
 
9:56 PM
3
Q: django i18n not working

Leo HwangA python newbie here. I wanna my website support English and Chinese. So I just follow django book, chapter 19 internationalization. But it seems doesn't work for me, string I hope to be displayed as chinese, still english there. My code and settin is as following. [settings.py] LANGUAGE_CODE =...

has a good example of changing locale form
 
 
1 hour later…
11:06 PM
Whoa, what's with the flags?
ok, so two threads, returning from sleep at same time? It's gotta come in an order. First one, then the other. Even sets that aren't semantically ordered have an arbitrary order.
 
11:25 PM
any suggestions on how to create a blank txt file locally on the computer if it does not exist loop..
 
11:38 PM
touch would do it
it would update the timestamp if it does exist.
you have a race condition if you're checking if the file exists first
But that may not be a problem.
why do you want to do that?
 
because I want the program to create a file, in x computer, whenever it's runned for the first time(but I believe a loop the checks if file exists would do)..
 
>>> import subprocess
>>> subprocess.call(['touch', 'filename.txt'])
0
>>> quit()
$ ls
filename.txt
 
a .txt file
 
that may not work on windows
 
let me try that, i'm on osx
 
11:43 PM
If the file exists, it updates the timestamp, otherwise it is idempotent.
This might do it on Windows: superuser.com/a/764721/59052
 
nice, thanks for that
 
@feners and let me disabuse you of the notion that there is such a thing as a .txt file. There are only files.
.txt is just a suffix that indicates how it is intended to be used.
 
noted sir!
 

« first day (1716 days earlier)      last day (3227 days later) »