problem with closures

2006-12-06 Thread alain
z*g print foo(2,5,4,69) The problem is that i get the following error message on line 7: TypeError: arg 5 (closure) must be tuple f.func_closure is indeed empty while f.func_code.co_consts[1].co_freevars is logically equal to ('x','y'). Thanks for responding Alain -- http://mail.python.org/mailman/listinfo/python-list

challenge ?

2007-03-22 Thread alain
value a_value would become a 2-tuple (a_value,rank_of_a_value) I seek an elegant solution. Alain -- http://mail.python.org/mailman/listinfo/python-list

SPE question

2007-03-27 Thread alain
Hi, Could someone tell me how to uninstall SPE under windows? Alain -- http://mail.python.org/mailman/listinfo/python-list

SNMP agent

2007-04-04 Thread alain
Thanks to all in advance Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: SNMP agent

2007-04-04 Thread alain
On Apr 4, 1:30 pm, alf <[EMAIL PROTECTED]> wrote: > twistedmatrix.org? I already took a look at it but the agent functionality is somewhat primitive. I need something production-ready. Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: SNMP agent

2007-04-05 Thread alain
On Apr 5, 6:50 pm, [EMAIL PROTECTED] (Cameron Laird) wrote: > In article <[EMAIL PROTECTED]>, > > alain <[EMAIL PROTECTED]> wrote: > >On Apr 4, 1:30 pm, alf <[EMAIL PROTECTED]> wrote: > > >> twistedmatrix.org? > > >I already took a look at it b

Re: too many values with string.split

2007-09-22 Thread Alain
Shawn Minisall a écrit : > I'm trying to unpack a list of 5 floats from a list read from a file and > python is telling me 5 variables are too many for the string.split > statement. Anyone have any other idea's? NOTE: the only reason I > convert it to a float instead of just leaving it as a st

Re: I earn $36800 a month with google adsense

2007-10-02 Thread alain
ey with your blog.more information there > > > support! > > ! > > good Wow ! I have a question though. If you really make $38600 a month, how come you even bother to spam us? Alain -- http://mail.python.org/mailman/listinfo/python-list

Why does this not work?

2007-02-02 Thread alain
I tried the following: myobj=object() myobj.newattr=5 results in: Traceback (most recent call last): File "", line 1, in ? AttributeError: 'object' object has no attribute 'newattr' Any idea? Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does this not work?

2007-02-02 Thread alain
On Feb 2, 1:57 pm, Bart Van Loon <[EMAIL PROTECTED]> wrote: > It was 2 Feb 2007 04:41:48 -0800, when alain wrote: > > > I tried the following: > > > myobj=object() > > myobj.newattr=5 > > > results in: > > > Traceback (most recent call last): >

Re: Python too complex ?!?!?!

2007-11-19 Thread alain
st likely containing prepackaged binaries. > What have I missed? > > Kay I think i understand his complaint. Have you ever tried to install a package making use of easy_install? If you have, then you understand this is a real pain in the ass, especially if your internet access requires prox

Re: Crackly sound in pygame

2007-11-30 Thread alain
the issue? > > Thanks No, and the more i look at your post, the more i can't see why. Sorry for not being able to help. Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's great, in a word

2008-01-07 Thread alain
done enough to choose. Paraphrasing Steve Jobs but in this context: PYTHON = a bycycle for the mind Best regards Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's great, in a word

2008-01-08 Thread alain
uot;. This is what i feel when programming in Python: a productivity boost compared to pedestrians and an immense pleasure. Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread alain
oopLable is not referenced, and LoopLabel is not defined. > > TIA, >     Bill > > PSwww.SynectixLtd.comis not relevant def __LINE__(): try: raise Exception except: return sys.exc_info()[2].tb_frame.f_back.f_lineno def __FILE__(): return inspe

Re: Python equivt of __FILE__ and __LINE__

2008-02-13 Thread alain
On Feb 12, 7:44 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > It still would be nice to have syntax as clean as __FILE__ and __LINE__. There exists an undocumented builtin called __file__, but unfortunately no corresponding __line__ Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivt of __FILE__ and __LINE__

2008-02-14 Thread alain
On Feb 14, 1:50 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 13 Feb 2008 13:07:31 -0200, alain <[EMAIL PROTECTED]> escribió: > > > There exists an undocumented builtin called __file__, but > > unfortunately no corresponding __line__ > >

import bug?

2009-02-20 Thread alain
ls.py", line 10, in from _functools import partial File "C:\Python25\lib\imputil.py", line 106, in _import_hook raise ImportError, 'No module named ' + fqname ImportError: No module named _functools The mere fact of installing a custom importer seems to break the import functionality. Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: matrix algebra

2008-09-23 Thread alain
werful, its syntax is not intuitive or easy to remember. I therefore welcome any attempt to simplify the api for a specific group of non-power users. Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Apache and suexec issue that wont let me run my python script

2013-06-01 Thread Alain Ketterlin
c.html Read this and check your setup to see if it matches. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best Scripting Language for Embedded Work?

2013-07-09 Thread Alain Ketterlin
keep the GUI aspect separated from the rest. Here is stackoverflow entry discussing the use guis for (unix) shell scripts: http://stackoverflow.com/questions/928019/how-to-make-a-gui-for-bash-scripts (via google "linux shell script gui"). -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Critic my module

2013-07-25 Thread Alain Ketterlin
pawn family" in... the doc. > def go_back(): > version = '0.3' > print(subprocess.Popen('cd !!:1')) Hopeless. Have you tried this? > def reboot(): > version = '0.3' > print(subprocess.Popen('shutdown -r now')) What do you expect this to print? I mean, after shutdown/reboot. > version = '0.6b' So, what's the version? 0.3 or 0.6b (btw, are you sure this "version" is the same as the one you use in all functions?). -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-06-30 Thread Alain Ketterlin
he last restriction (single evaluation of involved expressions) makes this a bit more than raw syntactic sugar. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-06-30 Thread Alain Ketterlin
are comparisons. > As soon as you read it as a ternary operator, the two comparisons are > logically simultaneous. There is no ternary operator, you can chain as many as you want, using whatever operators: if a <= b < c > d >= e: ... Once you view this as a conjonction of conditions, you find back the semantics of "and": short-circuit, left to right evaluation. I find this consistent. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: the meaning of rユ.......ï¾

2012-07-23 Thread Alain Ketterlin
e information. >>>>> fööbär = 3 >>>>> fööbär >> 3 >> >> I didn't know this. How awful. > > Apparently, not all characters are fine with Python. Why can I not have > domino tiles are identifier characters? The answer is in the

Re: print(....,file=sys.stderr) buffered?

2012-08-14 Thread Alain Ketterlin
>> print('>>> entering foo ...',file=sys.stderr) >>> >>> Now, when executing this, I always get >>> >>> +++ before calling foo >>> --- after calling foo >>>>>> entering foo ... This can't happen with "normal" code. Are you playing with lambdas or generators here? Or anything else that could introduce lazyness? -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange behavior

2012-08-14 Thread Alain Ketterlin
#x27;, 'sefwr', 'dfsews']) > > #Thanks for your help! Try with ['xasd', 'sefwr', 'xjkl', 'dfsews'] and you'll understand what happens. Also, have a look at: http://docs.python.org/reference/compound_stmts.html#the-for-statemen

Re: Strange behavior

2012-08-15 Thread Alain Ketterlin
comprehension is, imo, the most useful program construct ever. Extremely useful. But not when it makes the program traverse twice the same list, where one traversal is enough. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange behavior

2012-08-15 Thread Alain Ketterlin
over (before or after the various tutorials, depending on your background). -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host

2012-08-15 Thread Alain Ketterlin
7;. No, it means that connect received a single string "user = 'root'..." instead of a set of individual keyword parameters, and took the whole string to be the name of the host (its first parameter). Of course, there is no host with such a name. The solution is to parse the string into individual values, and pass these in the correct order. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]'f2f68'

2012-08-17 Thread Alain Ketterlin
e = > sqlalchemy.create_engine("mssql+pyodbc://DumpResult:123456@localhost/DumpResult") > c = engine.execute(cmdTest1) > > > ! > case1 :wrong,(sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42000', > "[42000] [Microsoft][ODBC SQL Server Driv

Re: Comparing strings from the back?

2012-09-04 Thread Alain Ketterlin
testing for equality, I can't see how this could matter, even with variable-length encodings. If you're comparing different encodings, then you need different access methods to random characters (but this doesn't affect the algorithm). If you're using variable-length encoding, e.g., UTF-8, accessing at a specific position is not possible. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: which a is used?

2012-09-25 Thread Alain Ketterlin
). If you want to change the binding of a in g(), you can declare it global: def g(): global a a = 20 f() Very tricky, actually. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: parse an environment file

2012-10-01 Thread Alain Ketterlin
Jason Friedman writes: [...] > I want my python 3.2.2 script, called via cron, to know what those > additional variables are. How? This is not a python question. Have a look at the crontab(5) man page, it's all explained there. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Combinations of lists

2012-10-03 Thread Alain Ketterlin
27;, 'bA', 'bA']] I can't make sense of your explanation, which doesn't seem to match your example (the result is not of the same size as h). Here is a way to compute { xh | x in m }, where xh is a list where x is prepended to each element of h. result = [ [ x+l for l in h ] for x in m ] If there is no duplicate in the original lists, then there will be no duplicate in the result. Is that what you are looking for? -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: pyw program not displaying unicode characters properly

2012-10-14 Thread Alain Ketterlin
de characters (at least the ones you use). See http://en.wikipedia.org/wiki/Unicode_font for a start. I don't know enough about Windows to give you a name. Anyone? -- Alain. P/S: and this has not much to do with python, which will happily send out any unicode char, and cannot know which ones

Re: pyw program not displaying unicode characters properly

2012-10-14 Thread Alain Ketterlin
Steven D'Aprano writes: > On Sun, 14 Oct 2012 19:19:33 +0200, Alain Ketterlin wrote: > >> Usenet has no attachments. > > *snarfle* > > You almost owed me a new monitor. I nearly sprayed my breakfast all over > it. [...] I owe you nothing, and you can do whate

Re: ElementTree Issue - Search and remove elements

2012-10-16 Thread Alain Ketterlin
ntrol]"): x = child.find("ParentalControl/Rating").text if x == "NC": ... Note that a complete XPath implementation would make that simpler: your query basically is //*[ParentalControl/Rating=="NC"] -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not take up available physical memory

2012-10-19 Thread Alain Ketterlin
ly unreasonable to load several Gs of data in a 32-bit address space, especially if this is text. So my real advice would be: * read the file line per line and pack the contents of every line into a list of objects; once you have all your stuff, process it -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Split single file into multiple files based on patterns

2012-10-23 Thread Alain Ketterlin
get multiple files like > A1980JE3937.txt and A1980KK18700010.txt, where each file will > contain column2, 3 and 4. Sorry for being completely off-topic here, but awk has a very convenient feature to deal with this. Simply use: awk '{ print $2,$3,$4 > $1".txt&

Re: How to pass class instance to a method?

2012-11-26 Thread Alain Ketterlin
e object referenced by any name, unless you impose strong conventions on the code. > Pseudo-python-code example: > > i = MyClass() > > xxx(i, 1, 2); > > ... > def xxx(self, MyClass myclass, number, foobar): >myclass.classsmethod() #myclass - is an instance of kn

Vigil, the eternal morally vigilant programming language

2013-01-07 Thread Alain Ketterlin
the January | 2013 PLT Games competition. | | Many programming languages claim to take testing, contracts and safety | seriously, but only Vigil is truly vigilant about not allowing code | that fails to pass programmatic specifications. Enjoy. -- Alain. -- http://mail.python.org/mailman/listi

Re: Formate a number with commas

2012-02-09 Thread Alain Ketterlin
ou really want commas whatever locale you're running in, you will need to use setlocale to change number formatting to a locale that uses commas. For instance: locale.setlocale(LC_NUMERIC,"en_US.utf8") locale.format('%d', 2348721, True) -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: subtraction of floating point numbers

2012-02-24 Thread Alain Ketterlin
, or move to specialized packages, like decimal. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it technically possible to give Python option of naming process of running script?

2012-03-14 Thread Alain Ketterlin
e opens a tracker > enhancement issue and presents an argument in favor. It's not. The man page says "This call is Linux-specific." -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a better way to do this snippet?

2012-04-03 Thread Alain Ketterlin
> ... if(g23tag.get(key)): > ... g23tag[key].append(value) > ... else: > ... g23tag[key] = [value] for item in tag23gr: g23tag.setdefault(item[0],[]).append(item[1]) -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a better way to do this snippet?

2012-04-03 Thread Alain Ketterlin
al I dislike the idea of silently inserting a default value when the access is a read, e.g., in x=g23tag[wrung]. Explicit is better than implicit, as they say. YMMV. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: No os.copy()? Why not?

2012-04-04 Thread Alain Ketterlin
.copy only "copies" contents and permissions (no access times, etc.) You probably mean shutil.copy2. And sparse files are really hard to reproduce, at least on Unix: on Linux even the system's cp doesn't guarantee sparseness of the copy (the manual mentions a "crude heuristic"). But of course shutil.copy is the best solution to mimic a raw cp. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-05 Thread Alain Ketterlin
return x # forgot self a = A() x = 1 print a.r() # prints 1 I know there is "no remedy". It's just really tricky. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Alain Ketterlin
., number of open files, or stack-size, or... But of course it's only a guess. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: system call that is killed after n seconds if not finished

2012-04-16 Thread Alain Ketterlin
ck whether the process has finished, and finally Popen.kill() if it has not. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: why () is () and [] is [] work in other way?

2012-04-20 Thread Alain Ketterlin
. I.e., you need several distinct empty lists, to make sure they can change value independently. (In case you wonder: lists in Python are not linked lists of cons-cells, they are more monolithic structures, and two lists cannot share a common tail.) -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: tiny script has memory leak

2012-05-17 Thread Alain Ketterlin
randint(0, sys.maxint) > f.close() sys.version is '2.6.6 (r266:84292, Sep 15 2010, 16:22:56) \n[GCC 4.4.5]' here, and your script works like a charm. BTW, I would use f.write() instead of print >> f (which I think is deprecated). -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic comparison operators

2012-05-24 Thread Alain Ketterlin
mlangenho...@gmail.com writes: > I would like to pass something like this into a function > test(val1,val2,'>=') > > and it should come back with True or False. def test(x,y,c): return c(x,y) Call with: test(v1,v2, lambda x,y:x<=y ). A bit noisy imho. If you have a finite number of comparis

Re: ./configure

2012-06-03 Thread Alain Ketterlin
o compile python? Isn't there a binary package available for your platform? -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help needed with nested parsing of file into objects

2012-06-04 Thread Alain Ketterlin
As noted in another message, you're probably better off using an existing syntax (json, python literals, yaml, xml, ...) -- Alain. #!/usr/bin/env python import sys import re RE = re.compile("( *)(.*)") stack = [("-",[])] # tree nodes are: (head,[children]) for line in sys

Re: Help needed with nested parsing of file into objects

2012-06-05 Thread Alain Ketterlin
ch = re.search("List of \d (.+) elements", couple[0]) return ("%s_elements" % match.group(1),couple[1]) else: pass # put a test here > fo = open(filename, "r") > RE = re.compile("( *)(.*)") > stack = [("-

Re: Help needed with nested parsing of file into objects

2012-06-05 Thread Alain Ketterlin
gt;> >    d=1 >> >    e=2 >> >    f=3 >> >  List of 1 B elements >> >   Instance of B element >> >    a=1 >> >    b=2 >> >    c=3 >> >    List of 2 C elements >> >     Instance of C element >> >      a=1 >&g

Re: Compare 2 times

2012-06-06 Thread Alain Ketterlin
Alain Ketterlin writes: > loial writes: > >> I have a requirement to test the creation time of a file with the >> current time and raise a message if the file is more than 15 minutes >> old. >> Platform is Unix. >> I have looked at using os.path.get

Re: [newbie] Equivalent to PHP?

2012-06-12 Thread Alain Ketterlin
TTP request, you pay the same price again and again for something which is not even related to your scripts' execution. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Something is rotten in Denmark...

2011-06-02 Thread Alain Ketterlin
for i in range(10)] > funcs[0](1) [...] > Do you agree that `a` should be late bound in this situation? No, absolutely, definitely not. But hey, I didn't learn programming with python. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Something is rotten in Denmark...

2011-06-03 Thread Alain Ketterlin
Gregory Ewing writes: > Alain Ketterlin wrote: >> But going against generally accepted semantics should at least >> be clearly indicated. Lambda is one of the oldest computing abstraction, >> and they are at the core of any functional programming language. > > Yes,

Re: Standard Deviation One-liner

2011-06-03 Thread Alain Ketterlin
You get the idea. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Deviation One-liner

2011-06-03 Thread Alain Ketterlin
Alain Ketterlin writes: > aux = lambda s1,s2,n: (s2 - s1*s1/n)/(n-1) > sv = lambda d: aux(sum(d),sum(x*x for x in d),len(d)) Err, sorry, the final square root is missing. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda question

2011-06-05 Thread Alain Ketterlin
to left in the chain of calls pictured as above). Somewhat surprisingly, this is usually less efficient than the one you show. The reason is that here there is some work to do before the recursive call (extracting a chunk) *and* after the call (pasting together the chunk with the result coming back from t

Re: International translation of docs - is it a scam?

2011-06-07 Thread Alain Ketterlin
n considered a scam. See, e.g., http://gcc.gnu.org/ml/gcc/2011-05/msg00046.html and messages referenced therein. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Alain Ketterlin
olling or just dumb: Steven is right, and you look dumb. >>> fibo(4) 3.0004 Even though the math is correct, your program is wrong. It doesn't even produce integers. And it will fail with overflow for big values. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Early binding as an option

2011-08-02 Thread Alain Ketterlin
t orthogonal to that question), at least it couldn't do much better than CPython. It just has to go through all the lookups. IIRC, unladden-swallow has tried the JIT route, using LLVM as the backend. It seems they gave up. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Early binding as an option

2011-08-03 Thread Alain Ketterlin
od one, but probably not because of arithmetic optims, rather because of all the lookups Pike doesn't perform dynamically. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Java is killing me! (AKA: Java for Pythonheads?)

2011-08-12 Thread Alain Ketterlin
rs - re. named parameters with default, use a map, or change the call sites to remove them -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: testing if a list contains a sublist

2011-08-16 Thread Alain Ketterlin
gt; return re.search(s1, s2) This is complete nonsense (try it on [12] and [1,2]). The original problem is "string searching" (where strings here are sequences of numbers instead of characters). See http://en.wikipedia.org/wiki/String_searching_algorithm for any algorithm (Rabin-Karp see

Re: testing if a list contains a sublist

2011-08-16 Thread Alain Ketterlin
somewhere else in this thread is probably the way to go, unless the lists are really long, in which case one of the "string searching" algorithm should be used (I would be surprised noone has implemented Boyer-Moore or Karp-Rabin). -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: pairwise combination of two lists

2011-08-18 Thread Alain Ketterlin
efficient function to do this, especially when > li1 and li2 are long lists. It's not difficult to write your own: def product(l1,l2): for x1 in l1: for x2 in l2: yield x1+x2 use it like: for p in product(l1,l2) ... The call to product() produces a generator, the cros

Re: List spam

2011-08-18 Thread Alain Ketterlin
n academic server). No spam at all. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: List spam

2011-08-18 Thread Alain Ketterlin
o spam, no need to store messages on your machine, auto-purge after a configurable delay, etc. Problem solved. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: List spam

2011-08-18 Thread Alain Ketterlin
for months (I'm talking about 15-20 groups, not comp.lang.python only). The real problem here seems to be google groups, which in some way forwards spam to the mailing-list. How this happens is beyond my understanding. But let's try to fix the real problem. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regular expression in python

2011-08-19 Thread Alain Ketterlin
's regexp, you can build the regexp step by step: number = r"\d\.\d+e\+\d+" numbersequence = r"%s( %s){31}" % (number,number) There are better ways to build your regexp, but I think this one is convenient to answer your question. You still have to append what will match

Re: Why doesn't threading.join() return a value?

2011-09-02 Thread Alain Ketterlin
confuse threads with processes? Re. the original question: since you can define your own Thread subclass, with wathever attribute you want, I guess there was no need to use join() to communicate the result. The Thread's run() can store its result in an attribute, and the "client" can

Re: Why doesn't threading.join() return a value?

2011-09-03 Thread Alain Ketterlin
Adam Skutt writes: > On Sep 2, 2:23 pm, Alain Ketterlin > wrote: >> Sorry, you're wrong, at least for POSIX threads: >> >> void pthread_exit(void *value_ptr); >> int pthread_join(pthread_t thread, void **value_ptr); >> >> pthread_exit can pass

Re: Why doesn't threading.join() return a value?

2011-09-03 Thread Alain Ketterlin
Alain Ketterlin writes: >> Passing a void* is not equivalent to passing anything, not even in C. >> Moreover, specific values are still reserved, like PTHREAD_CANCELLED. > > Thread cancellation is program logic (pthread_cancel), it doesn't mean > you thread crashed, it

Re: Can't use subprocess.Popen() after os.chroot() - why?

2011-09-04 Thread Alain Ketterlin
as well. (Try first with a statically linked executable, e.g., /bin/busybox, and everything should be ok). I agree the message is strange. For some reason, subprocess is calling pickle.loads, which calls rep.decode("string-escape"), which probably needs to access some file and fails because

Re: Parsing numeric ranges

2011-02-25 Thread Alain Ketterlin
#x27;-') if len(bounds) == 1: yield int(bounds[0]) elif len(bounds) == 2: for v in range(int(bounds[0]),1+int(bounds[1])): yield v else: pass # ignore, or throw, or... # Use as in: for x in values(["1",&q

Re: Get Path of current Script

2011-03-14 Thread Alain Ketterlin
he script that the interpreter started with. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Re: DOCTYPE + SAX

2011-04-09 Thread Alain Ketterlin
use HTML's SGML DTD in a XML document. Direct your doctype to XHTML's DTD, and everything will be fine (hopefully). BTW, your installation will probably let you use a locally cached copy of the DTD, instead of fetching a file at every parse. How this works depends somehow on the parse

Re: 3.1.4 release candidate 1

2011-05-30 Thread Alain Ketterlin
> > The Pi release of Python :-) And the same day we get the e release of Python... -- Alain. -- http://mail.python.org/mailman/listinfo/python-list

Typo-squatting PyPi

2017-09-17 Thread Alain Ketterlin
loaded to a Chinese IP address. NBU officials contacted PyPI | administrators last week who removed the packages before officials | published a security advisory on Saturday." -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: integer copy

2017-10-20 Thread Alain Ketterlin
hod, | nor stack trace, stack frame, nor file, socket, window, nor array, nor | any similar types. But who knows what "similar types" are... -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Tips or strategies to understanding how CPython works under the hood

2018-01-09 Thread Alain Ketterlin
w Lua operates too? No. Lua uses a register-based (virtual) machine. See https://www.lua.org/doc/jucs05.pdf I think Lua was the first language in widespread use to move to a register-based machine. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV file edition

2018-01-09 Thread Alain Ketterlin
ck that 39 is correct). Your data look like fixed-width fields. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Doubt in line_profiler documentation

2018-01-27 Thread Alain Ketterlin
/conventional resolution. By the way, the use of gettimeofday() is strange since this function is now deprecated... clock_gettime() should be used instead. It has an associated clock_getres() as well. -- Alain. [*] WTF is wrong with these microsoft developpers? Clocks and performance counters are

Re: "None" and "pass"

2018-02-05 Thread Alain Ketterlin
any side-effect and/or throw an exception). And be fired right after your first code review. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Alain Ketterlin
too complex to capture, testing will be incomplete, and all you can do is run your program and see whether is goes through. As a general rule, if that's all you expect from typing, then, fine, call this "strong". I won't go as far, and just say that it is good enough for th

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Alain Ketterlin
Chris Angelico writes: > On Mon, Feb 19, 2018 at 7:40 PM, Alain Ketterlin > wrote: >> No. C has much stronger rules, not on casting, but on accessing the >> pointees, which basically invalidates your argument. Refer to the C >> standard for details. > > Really

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Alain Ketterlin
Chris Angelico writes: > On Mon, Feb 19, 2018 at 9:04 PM, Alain Ketterlin > wrote: >> Look at the C11 standard, section 6.3.2.3 ("Pointers"), 6.5.§6-7 >> ("effective types"), and 6.5.3.2 ("Address and indirection operators"). >> It i

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread Alain Ketterlin
Steven D'Aprano writes: > On Mon, 19 Feb 2018 09:40:09 +0100, Alain Ketterlin wrote: > >> Tim Delaney writes: >> >> [...] >>> As others have said, typing is about how the underlying memory is >>> treated. >> >> No. It is much more t

Re: Problem with difflib SequenceMatcher

2016-09-12 Thread Alain Ketterlin
ns no matching blocks). It is all due to the "Autojunk" heuristics (see difflib's doc for details), which considers the first characters as junk. Call SM(...,autojunk=False). I have no idea why the maintainers made this stupid autojunk idea the default. Complain with them. -- Al

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Alain Ketterlin
t I haven't checked). Are you sure this is your (real) problem? -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to pick out the same titles.

2016-10-16 Thread Alain Ketterlin
tle will > have the date a year off. > > What I would like to do it output to another file that show those two > as a match. Try the difflib module (read the doc, its default behavior may be surprising). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does this list swap fail?

2016-11-14 Thread Alain Ketterlin
taneously), you just overwrite the first element twice. Congratulations, a very good corner case (you can't call it a bug, since it conforms to the definition of the language). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: The hardest problem in computer science...

2017-01-06 Thread Alain Ketterlin
d horizontal line elements? Box-drawing characters. At least that's how Unicode calls them. Even if you don't draw boxes... https://en.wikipedia.org/wiki/Box-drawing_character -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   >