mtbc: maze I (white-red)
[personal profile] mtbc
For our software at work we use Python in some components. I am not much of a fan of Python — for me it brings the worst of Perl while omitting the best — but I have been trying to become more comfortable with it. I have found it easy to write buggy code: for instance, flake8 is quite happy with,
x = 'foo'
for x in range(5):
    pass
print(x)
That prints 4 which means that I must be very careful about tracking variable names: scoping may not be as I expect.

I have also found myself having to be wary in other ways. For example, recently I tried experimenting with the multiprocessing module and if too careless then I am easily surprised. If I fire off a process to print something to standard output then return a result, then having gotten that result and written something else to standard output, those output lines may appear out of order if I do not first join() from that other process, at least unless I manually flush or adjust buffering. Or, if I pass an object as an argument to apply_async or somesuch, it may effectively get passed by value instead of by reference so its state changes are lost as side-effects: I must remember that data may be pickled on its way about. In some situations it thus turns out that I must be doubly wary.

I have a large multidimensional numpy array that I was hoping to have multiple processes read from without copying it around. On trying to work out correspondences between ctypes and dtypes and whatnot I kind of gave up there and figured that I would prefer a night's sleep.
This account has disabled anonymous posting.
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

mtbc: photograph of me (Default)
Mark T. B. Carroll

December 2025

S M T W T F S
 12 3456
78910111213
14 15161718 19 20
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 30th, 2025 02:00 pm
Powered by Dreamwidth Studios