Re: Detect file is locked - windows

2012-11-15 Thread Aahz
't access the file, you can't access it. (Not to >dismiss your question; I just wonder how you're going to handle the >different cases) Real-life use case for user-requested operation: if no permission, skip the file "permanently" (until it changes, at least); if locke

Re: debugging in eclipse

2012-11-15 Thread Aahz
In article , Roy Smith wrote: >In article , > Dave Angel wrote: >> >> I'd also add a print statement, just to assure yourself that it's running. > >My trick to make sure something is running is to add "assert 0". ``1/0`` is

DNS from Python (was Re: Subprocess puzzle and two questions)

2012-11-14 Thread Aahz
s lying around: domain = MAILTO.split('@',1)[1] server = str(dns.resolver.query(domain, 'MX')[0].exchange) You'll need to play around a bit to find out what that does, but it should point you in the right direction. -- Aahz (a...@pythoncraft.com) <*&g

Re: Python garbage collector/memory manager behaving strangely

2012-11-14 Thread Aahz
amespace >to the function readlines so there should be no confusion. At least not >for a moderately experienced programmer, beginners can be confused by the >littlest things sometimes. Actually, as an experienced programmer, I *do* think it is confusing as evidenced by the mistake

Re: Single leading dash in member variable names?

2012-11-10 Thread Aahz
port *`` ignores any module global names in foo that start with a single leading underscore. Obviously, this has little effect for most Python programs because you DON'T USE ``import *``. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Normal is what cuts off your sixth finger and your tail..." --Siobhan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-10 Thread Aahz
gt; print(x) >> print(y) > >I was tempted to post that myself, but he said /simpler/ ;) >From my POV, that *is* simpler. When you change the parameters for foo, you don't need to change the arg pre-processing. Also allows code reuse, probably any program needing this

Re: Numpy combine channels

2012-11-09 Thread Aahz
gt; >>> (a[:, 0] + a[:, 1]) / 2 >array([1, 1, 2]) I'd actually think it should be the max. Consider a stereo where one side is playing a booming bass while the other side is playing a rest note -- should the mono combination be half as loud as as the bass? -- Aahz (a...@pythoncraf

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-11-09 Thread Aahz
sometimes do. (Or so I am lead to believe.) > >This sonds like a good use case for a context manager, like the one in >decimal.Context.get_manager(). Note that because get_manager() applies to a specific Context instance it is safe in a threaded application, which is NOT tr

Re: __unicode__() works, unicode() blows up. (Never mind!)

2012-11-04 Thread Aahz
self.username > >to be: > >def __unicode__(self): >return unicode(self.username) > >This never got noticed before because normally, self.username already is >a unicode string, so it just works. You apparently need more coffee when programming after waking up! (

Re: Proper place for everything

2012-11-03 Thread Aahz
, and will probably sneer or laugh at you > privately. And possibly publicly too. > >- If you hope to convince the Python community to change , > we are constrained by backwards-compatibility issues, policies, and > design decisions. Frequently there are (mis-)features that

Re: Haskell -> Python

2012-11-03 Thread Aahz
ks clumsy next to the Haskell. If you want more Pythonic, follow PEP8 in your formatting. ;-) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Normal is what cuts off your sixth finger and your tail..." --Siobhan -- http://mail.python.org/mailman/listinfo/python-list

Re: is implemented with id ?

2012-11-03 Thread Aahz
In article <50959154$0$6880$e4fe5...@news2.news.xs4all.nl>, Hans Mulder wrote: >On 3/11/12 20:41:28, Aahz wrote: >> In article <50475822$0$6867$e4fe5...@news2.news.xs4all.nl>, >> Hans Mulder wrote: >>> On 5/09/12 15:19:47, Franck Ditter wrote: >>>

Re: is implemented with id ?

2012-11-03 Thread Aahz
bage collected. That's old news, fixed in 2.5 or 2.6 IIRC -- interned strings now get collected by refcounting like everything else. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Normal is what cuts off your sixth finger and your tail.

Re: is implemented with id ?

2012-11-03 Thread Aahz
hey'll still be compared char-for-char >until there's a difference. Without looking at the code, I'm pretty sure there's a hash check first. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Normal is what cuts off your sixth finger and your tail..." --Siobhan -- http://mail.python.org/mailman/listinfo/python-list

Re: is implemented with id ?

2012-11-03 Thread Aahz
g the life time of an object. > >It's usually phrased as "a and b are the same object". If the object >is mutable, then changing a will also change b. If a and b aren't >mutable, then it doesn't really matter whether they share a physical >address. That last sen

Re: Feature suggestion -- return if true

2011-04-18 Thread Aahz
uestion, I find this more readable: if x not in cache: Without testing, I'm not sure, but I believe it's more efficient, too (creates fewer bytecodes). -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found

Re: Questions about GIL and web services from a n00b

2011-04-16 Thread Aahz
le.loads() releases the GIL, but it doesn't; you need to use pickle.load() (and cStringIO if you want to do it in memory). -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doub

Re: Forcing absolute package imports in 2.7?

2011-04-13 Thread Aahz
rams? from __future__ import absolute_import -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doubt and just refer to comments in code as 'lies'. :-)" --Mic

Re: Dump interpreter history?

2011-04-12 Thread Aahz
In article , Terry Reedy wrote: >On 4/11/2011 11:54 AM, Aahz wrote: >> In article, >> Ken D'Ambrosio wrote: >>> >>> Hey, all. A co-worker asked me a question, and I've got no idea how (or >>> if) it can be done. Bottom line: he'd like

Re: threading.Semaphore (quite long)

2011-04-12 Thread Aahz
MainThread? Or should this be done in a >separate thread being informed about a keyboard exception by the main >thread? Outside of signals, there should not be a problem with that. I don't have time to look further, I just noticed that nobody responded. -- Aahz (a...@pythoncraft.com

Re: Dump interpreter history?

2011-04-11 Thread Aahz
hat you want, and now you just need to gussy it up in an editor. I've never used it myself, but IIRC ipython does what you want very nicely. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit

Re: python on iPad (PyPad)

2011-04-09 Thread Aahz
ronment. It's available in iTunes >at http://itunes.apple.com/us/app/pypad/id428928902?mt=8# There's nothing wrong with advertising this, I suggest that you also announce it on c.l.py.announce -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ &

Re: Guido rethinking removal of cmp from sort method

2011-04-08 Thread Aahz
In article <4d9f32a2$1...@dnews.tpgi.com.au>, Lie Ryan wrote: >On 04/09/11 01:08, Aahz wrote: >> >> Actually, my take is that removing __cmp__ was a mistake. (I already >> argued about it back in python-dev before it happened, and I see little >> point reh

Re: Guido rethinking removal of cmp from sort method

2011-04-08 Thread Aahz
ll out the cmp= >argument in cases where they use the cmp() builtin in 2.x? Actually, my take is that removing __cmp__ was a mistake. (I already argued about it back in python-dev before it happened, and I see little point rehashing it. My reason is strictly efficiency grounds: when compariso

Re: PostgreSQL vs MySQL

2011-03-17 Thread Aahz
In article <87bp1a3g59@benfinney.id.au>, Ben Finney wrote: >a...@pythoncraft.com (Aahz) writes: > >>>(I always recommend people to use PostgreSQL, though; which is >>>superior in almost every way, especially the C client library and the >>>wire protoc

Re: reimport module every n seconds

2011-03-17 Thread Aahz
gt;>> doubt that it's enough faster to warrnat this kludge). >> >> I'm with Aahz. =A0Don't do that. >> >> I don't know what you're doing, but I suspect an even better solution >> would be to have your program run a "reconfigu

PostgreSQL vs MySQL (was Re: How to handle sockets - easily?)

2011-03-16 Thread Aahz
ery way, especially the C client library and the wire protocol.) Can you point at a reference for the latter? I have been trying to convince my company that PG is better than MySQL. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Beware of companies t

Re: Idea for removing the GIL...

2011-02-28 Thread Aahz
r, and that was considered too >drastic a change. ...especially given CPython's goal of easy integration with C libraries. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Programming language design is not a rational science. Most reasoning abou

Re: Plumber, an alternative to mixin-based subclassing

2011-02-28 Thread Aahz
[posted & e-mailed] In article , Florian Friesdorf wrote: > >An alternative to mixin-based subclassing: > >http://pypi.python.org/pypi/plumber You'll probably get more interest if you provide a summary. -- Aahz (a...@pythoncraft.com) <*>

Re: reimport module every n seconds

2011-02-17 Thread Aahz
ta import data > >As the data often changes, I would like to reimport it every n (e.g. >10) seconds. Don't do that. ;-) I suggest using exec instead. However, I would be surprised if import worked faster than, say, JSON (more precisely, I doubt that it's enough

Re: Which is the best book to learn python

2011-02-14 Thread Aahz
In article , Jean-Michel Pichavant wrote: > >Python is easy to learn, I'm not sure it's possible to write a bad book >about it. Yes, it is. I can name two: Deitel: Python How to Program Perl to Python Migration -- Aahz (a...@pythoncraft.com) <*> h

Re: Which non SQL Database ?

2011-02-11 Thread Aahz
istake we made because our performance requirements are fairly modest. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Programming language design is not a rational science. Most reasoning about it is at best rationalization of gut feelings, and at

Re: Multiple independently started python processes and sharing of a module

2011-02-06 Thread Aahz
ltiple open connections and assign them per request. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Programming language design is not a rational science. Most reasoning about it is at best rationalization of gut feelings, and at worst plain wrong."

Re: apscheduler error

2011-01-29 Thread Aahz
an exit handler that converts your thread to daemon? (Or something like that.) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson -- http://mail.python.org/mailman/listinfo/python-list

Re: how to read the last line of a huge file???

2011-01-29 Thread Aahz
t;line = nextline It's a Bad Idea to mix direct file operations with the iterator API. Use f.read() instead of f.next(). -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating custom Python objects from C code

2011-01-27 Thread Aahz
>custom objects from C and pass them as arguments to a function call. You should definitely investigate Cython, but if you really want to roll your own, look in the examples inside the Python source itself. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.c

Re: issubclass(dict, Mapping)

2011-01-18 Thread Aahz
In article , kj wrote: > >standard OOP semantics "...some experts might say a C++ program is not object-oriented without inheritance and virtual functions. As one of the early Smalltalk implementors myself, I can say they are full of themselves." --zconcept -- Aahz (a...

Re: Trying to parse a HUGE(1gb) xml file

2011-01-13 Thread Aahz
. Thanks! I updated our codebase this afternoon... -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "The volume of a pizza of thickness 'a' and radius 'z' is given by pi*z*z*a" -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing string for " "

2011-01-12 Thread Aahz
In article <0d7143ca-45cf-44c3-9e8d-acb867c52...@f30g2000yqa.googlegroups.com>, Daniel da Silva wrote: > >I have come across a task where I would like to scan a short 20-80 >character line of text for instances of " ". Ideally > could be of any tense. In Sovie

Re: Integrating doctest with unittest

2011-01-09 Thread Aahz
In article <4d038b63$0$3$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > >Is there a way to have unittest.main() find and run doc_test_suite >together with the other test suites? You probably need to use nose or something. (That's what

Re: surprised by import in python 2.6

2011-01-08 Thread Aahz
>and > >import test Just adding to this thread for Gooja: Don't use "import *" -- it makes debugging difficult because you can't tell where a name comes from. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Think of it

Re: Trying to decide between PHP and Python

2011-01-04 Thread Aahz
entheses. >> >> I haven't heard that version before. The one I heard was: >> "Lots of Irritating Single Parentheses". > >Long Involved Stupid Parentheses. http://www.netfunny.com/rhf/jokes/90q2/lispcode.html -- Aahz (a...@pythoncraft.com) <*&g

Re: Trying to decide between PHP and Python

2011-01-04 Thread Aahz
In article , Google Poster wrote: > >The syntax reminds me of Lots of Interspersed Silly Parentheses >(L.I.S.P.), but without the parentheses. You're not the first person to make that observation: http://norvig.com/python-lisp.html See also: http://norvig.com/python-iaq.ht

Re: Catching user switching and getting current active user from root on linux

2010-12-30 Thread Aahz
In article , mpnordland wrote: > >First, to pacify those who hate google groups: What is a good usenet >client? trn3.6 ;-) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Think of it as evolution in action." --Tony Rand -- http:

Re: How to initialize each multithreading Pool worker with an individual value?

2010-12-30 Thread Aahz
e kind of class instance that works with multiprocessing and emits one port number when its __call__() method gets invoked. (There may be other ways to accomplish the same effect, but that's what springs to mind.) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Think of it as evolution in action." --Tony Rand -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison with False - something I don't understand

2010-12-03 Thread Aahz
In article , Harishankar wrote: >On Thu, 02 Dec 2010 17:33:47 -0800, Aahz wrote: >> >> Please demonstrate that using ``if`` blocks for True/False is impler and >> cleaner than using ``try`` blocks to handle exceptions. > >It is my personal preference and coding sty

Re: Comparison with False - something I don't understand

2010-12-02 Thread Aahz
r than using ``try`` blocks to handle exceptions. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Think of it as evolution in action." --Tony Rand -- http://mail.python.org/mailman/listinfo/python-list

Re: Get frame object of last called function

2010-12-02 Thread Aahz
In article , moerchendiser2k3 wrote: > >Hi, is there any chance to get the frame object of the previous called >function? sys._current_frames(), sys._getframe() -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Think of it as evolution in a

Re: a regexp riddle: re.search(r'(?:(\w+), |and (\w+))+', 'whatever a, bbb, and c') =? ('a', 'bbb', 'c')

2010-11-26 Thread Aahz
In article , Phlip wrote: > >Thanks all for playing! And as usual I forgot a critical detail: > >I'm writing a matcher for a Morelia /viridis/ Scenario step, so the >matcher must be a single regexp. Why? (You're apparently the author of Morelia, but I don't real

Re: playful coding problems for 10 year olds

2010-11-26 Thread Aahz
e herself maybe after some initial help. What other interests does she have? Might Python play a role? http://micheinnz.livejournal.com/1080735.html (Agent Weasel ended up making a presentation at the NZ PyCon.) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-25 Thread Aahz
us job used this rather heavily, but I can't provide you with code. I suspect we weren't the only people, but I have no clue how to locate samples. Were you searching code.google.com or something else? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/

Re: is list comprehension necessary?

2010-11-21 Thread Aahz
tiline lambdas have been >averted. The weird "functional if" syntax additions were a cave-in to >the functional crowd, and may have been a mistake. Did you actually read the PEP explanation for *why* Guido decided to add conditional expressions? -- Aahz (a...@pythoncraft.com)

Where's the bug? (cPickle/thread edition) (was Re: How to optimize and monitor garbage collection?)

2010-11-20 Thread Aahz
GIL. Much easier than finding the problem in the first place...) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Look, it's your affair if you want to play with five people, but don't go calling it doubles." --John Cleese anticipates Usenet -- http://mail.python.org/mailman/listinfo/python-list

Re: Python has a "really hidden encapsulation"?

2010-11-18 Thread Aahz
x(self): return 42 >... >>>> a = A() >>>> a.__dict__['x'] = 24 >>>> a.x >42 >>>> a.__dict__['x'] >24 > >This is documented, but I actually don't know the reason for it. Because otherwise you would be able to overwri

Re: Komodo 6, why "Workspace Restore" after every restart?

2010-11-16 Thread Aahz
> Injection-Info: g20g2000prg.googlegroups.com; posting-host=115.64.196.128; >> posting-account=rYyWJQoAAACVJO77HvcyJfa3TnGYCqK_ >> User-Agent: G2/1.0 >> X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) >> AppleWebKit/534.12 (KHTML, like Gecko) Chrome/9.0.576.0 >> Safari/534.12,gzip(gfe) >> -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Look, it's your affair if you want to play with five people, but don't go calling it doubles." --John Cleese anticipates Usenet -- http://mail.python.org/mailman/listinfo/python-list

Re: OO and game design questions

2010-11-15 Thread Aahz
bePlace() method and add(), remove() and getItem() methods >for each list. It may be possible to use a single list for all types of >object, in which case the object itself would be very small indeed. Maybe you want a rule-based approach: http://eblong.com/zarf/essays/rule-based-if/ --

Re: how to identify currently running threads QTHreads

2010-11-14 Thread Aahz
In article <4cdfe050$0$10182$426a3...@news.free.fr>, News123 wrote: > >Is there a simple way in Python to identify all active Threads / >QThreads when trying, such that I can locate the thread, itls related >python code and fix it? threading.enumerate() or sys._current_fr

Re: how to handle network failures

2010-11-06 Thread Aahz
ta=self.get_page_data() >return data Use urllib2 so that you can set a timeout (Python 2.6+). -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list

Re: What people are using to access this mailing list

2010-11-03 Thread Aahz
t too O/T - I was just wondering how people read/send to >>>>> this mailing list, eg. normal email client, gmane, some other software >>>>> or online service? >>>> Usenet via my ISP, on comp.lang.python. >>>> >>> Us

Re: embedding python in macOS 10.6

2010-10-28 Thread Aahz
ou still haven't figured it out, try pythonmac-sig. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list

Re: Certificate validation with HTTPSConnection

2010-10-27 Thread Aahz
er, I think that using scare quotes around a person's name is insulting and not appropriate. That goes triple if you misspell their name. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do

Re: Introducing Kids to Programming: 2 or 3?

2010-10-26 Thread Aahz
*now* which path to take: 2 or 3? As we >will be translating the notes we'll probably stick with out choice for >the next few years. One reason not otherwise mentioned is that overall Unicode support is better in Python 3, and given your international audience, that&

Re: minimal D: need software testers

2010-10-26 Thread Aahz
app on bugs and give ideas. You should probably explain what minimal-D is, I'm certainly not going to look at something when I have no clue. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional t

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Aahz
ed classes. Surely it's an argument against >writing Foo in Python? Maybe, but there's no reason for posting that ten times! ;-) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a profession

Re: Design: Module interface vs. library interface

2010-10-10 Thread Aahz
ss, it should have been named `_FTPFile`. When your class isn't public, it doesn't matter much exactly how you expose it internally. (I essentially never use __all__ myself, but I don't write libraries for public consumption.) -- Aahz (a...@pythoncraft.com) <*>

Re: Help needed with Windows Service in Python

2010-09-23 Thread Aahz
In article , Ian Hobson wrote: > >I am attempting to create a Windows Service in Python. BTW, you probably want to subscribe to http://mail.python.org/mailman/listinfo/python-win32 -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you thi

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Aahz
n't and tinyurl & friends are really helpful in that >context. There's no reason you can't cater to that problem by using tinyurl *in* *addition* to the full regular URL. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "The volume of a p

Re: C++ - Python API

2010-09-19 Thread Aahz
In article , Thomas Jollans wrote: >On Sunday 19 September 2010, it occurred to Aahz to exclaim: >> In article , >> Thomas Jollans wrote: >>>On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: >>>> >>>> So the feature overvie

Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-19 Thread Aahz
zero help to anyone who might later want to look it up (and also no accessibility if tinyurl ever goes down). At the very least, include the original URL for reference. (Yes, I realize this is probably a joke given the smiley I excised, but too many people do just post tinyurl.) -- Aahz (a...@pyth

Re: This Is International Don’t-Squawk-Like-A -Parrot Day

2010-09-19 Thread Aahz
In article , Tim Chase wrote: >On 09/18/10 23:46, Lawrence D'Oliveiro wrote: >> >> Do your bit to help stamp out parrocy. > >Did you send this by mistake? It looks like a parroty-error. I >think it's a bit off... Agh! -- Aahz (a...@pythoncra

Re: C++ - Python API

2010-09-19 Thread Aahz
In article , Thomas Jollans wrote: >On Wednesday 01 September 2010, it occurred to Markus Kraus to exclaim: >> >> So the feature overview: > >First, the obligatory things you don't want to hear: Have you had >a look at similar efforts? A while ago, Aahz posted so

Re: compile Py2.6 on SL

2010-09-17 Thread Aahz
nother argument against TLAs. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "The volume of a pizza of thickness 'a' and radius 'z' is given by pi*z*z*a" -- http://mail.python.org/mailman/listinfo/python-list

Re: WMI in Python

2010-09-13 Thread Aahz
mailman/listinfo/python-win32 Before you ask questions there, do a bit of searching first -- there are lots of examples. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologies and programmers] "Fancy tail fins on a brand new '

Re: Looking for Python and Python/Django workplaces in Chicago

2010-09-13 Thread Aahz
refer Python in Chicago I could keep >an eye on. Nobody else has responded, so I'll just refer you to the usual job boards, including http://www.python.org/community/jobs/ -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologi

Re: Anyone using python on Mint Linux ?

2010-09-12 Thread Aahz
In article , wrote: > >Just read that Mint is a fine version of Debian Linux. >Any comments about python on this ? Why would there be? Either it works or it's broken, and given that it's Debian, I'd certainly bet that Python works. -- Aahz (a...@pythoncraft.com)

Re: How Python works: What do you know about support for negative indices?

2010-09-12 Thread Aahz
nt in this case. The effort devoted to >explaining this issue far outweighs the burden it caused initially. I'll >try to be more explicit when presenting it in future, to forestall this. s/explicit/accurate/ Had you noted that some lines of code were wrapped short, I would have agreed with y

Re: palindrome iteration

2010-09-11 Thread Aahz
;[a-z]') def is_palindrome(s): letters = pat.findall(s.lower()) return letters == reversed(letters) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologies and programmers] "Fancy tail fins on a brand new '59 Cadillac didn&

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Aahz
looks like *your* problem to me; except for exactly one paragraph, I don't see comb-style formatting in Lynx at that URL. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologies and programmers] "Fancy tail fins on a

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Aahz
s problems with reading various emails, >newsgroup postings, forums and what not, to start using modern tools >that work with the vast majority of other tools. Why? Raymond's post worked fine for me with trn3.6 -- Aahz (a...@pythoncraft.com) <*> http://

Re: cPickle segfault with nested dicts in threaded env

2010-09-08 Thread Aahz
In article , Thomas Jollans wrote: > >Also, Python 2.5 is frightfully old. [...] "Frightfully"??? I'm sure plenty of people are still using Python 2.3 in production environments (certainly my last job did as of 1.5 years ago, and I would be mildly surprised if they upgra

Re: Confused about nested scopes and when names get added to namespaces

2010-09-08 Thread Aahz
iate), rather than the namespace lookup just >moving up the hierarchy when not found. This is confusing to me and >is making me question my understanding of namespace lookups. Are >nested scopes a special case where the lookup is handled differently? > >What if I wan

Re: problem with simple multiprocessing script on OS X

2010-09-08 Thread Aahz
n of IPython, a function that used to >return None if there was no instance of an IPython interactive shell >now creates and returns a new instance. This was the cause of the >error I was reporting. Hoist on your own petard, eh? ;-) Thanks for reporting the solution. -- Aa

Re: Speed-up for loops

2010-09-07 Thread Aahz
manuals trying >to understand the subtle difference, until your friend comes over and >says, "You dolt, you just wasted half the afternoon. They're the same >thing. Move on, this is not the bug you're looking for". ...and if you're a Python guru, you

Re: Speed-up for loops

2010-09-07 Thread Aahz
range = 42 > >at some point. That explains a lot about the difficulties of implementing >Python efficiently. (And the xrange=range trick works well thanks.) Actually, range() is a function. But the same point applies, squared -- you really can never know what kind of object is hiding

Re: Iterative vs. Recursive coding

2010-09-06 Thread Aahz
for Python that you *can* use recursion; it's usually the simplest way of walking a tree structure (such as a directory tree). Python would be an extraordinarily limited language if recursion were not available. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/

Re: Iterative vs. Recursive coding

2010-09-06 Thread Aahz
understanding of recursion, and the same would apply to callback functions, FSM, linked lists, and so on. (I mostly think I do really understand polymorphism and hashtables.) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support,

Re: String substitution VS proper mysql escaping

2010-09-04 Thread Aahz
gt;>> 1, 2, 3 (1, 2, 3) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue cleanup

2010-09-04 Thread Aahz
e. Many people still use 32-bit Python -- an int is twelve bytes there. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list

Re: killing all subprocess childrens

2010-09-02 Thread Aahz
utput.split('\n')[1:] # skip the header for row in output: if not row: continue child_pid, parent_pid = row.split() if parent_pid == str(pid): child_pid = int(child_pid) os.kill(child_pid, signal.SIGUSR1) --

Re: Performance: sets vs dicts.

2010-09-01 Thread Aahz
In article , Jerry Hill wrote: >On Tue, Aug 31, 2010 at 10:09 AM, Aahz wrote: >> >> I suggest that we should agree on these guarantees and document them in >> the core. > >I can't get to the online python-dev archives from work (stupid >filter!) so I can

Re: Performance: sets vs dicts.

2010-08-31 Thread Aahz
In article , Jerry Hill wrote: >On Mon, Aug 30, 2010 at 7:42 PM, Aahz wrote: >> >> Possibly; IMO, people should not need to run timeit to determine basic >> algorithmic speed for standard Python datatypes. > >http://wiki.python.org/moin/TimeComplexity takes a stab at

Re: Performance: sets vs dicts.

2010-08-30 Thread Aahz
In article <878w3ogpvq@benfinney.id.au>, Ben Finney wrote: >a...@pythoncraft.com (Aahz) writes: >> >> That reminds me: one co-worker (who really should have known better ;-) >> had the impression that sets were O(N) rather than O(1). > >For settling exactly

Re: Performance: sets vs dicts.

2010-08-30 Thread Aahz
hough writing that off as a brain-fart seems appropriate, it's also the case that the docs don't really make that clear, it's implied from requiring elements to be hashable. Do you agree that there should be a comment? -- Aahz (a...@pythoncraft.com) <*> http:

Re: Queue cleanup

2010-08-30 Thread Aahz
to the actual management of the reference counter, you're correct, but it's especially not clear that your second sentence is so restricted. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Problem but tough for me if i want it in linear time

2010-08-30 Thread Aahz
totically >approach O(log n) if the question is well formed, but O(2^n) if >flaming, indentation/line-length preferences, the meaning of OOP, >SQL-parameter escaping, McNugget combinations, or suggestions that >Python is "just a scripting language" are involved... +1 QOT

Re: Pop return from stack?

2010-08-29 Thread Aahz
ies the traceback to me, it it's helped >me diagnose their issues a lot. That only really works for non-GUI applications. For GUI apps, log files are the way to go. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support,

Re: problem in using linalg solver in numpy

2010-08-29 Thread Aahz
y-discussion -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue cleanup

2010-08-28 Thread Aahz
other main reason being that refcounting is much easier for a random C library. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue cleanup

2010-08-28 Thread Aahz
In article <4c78572c$0$28655$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Fri, 27 Aug 2010 09:16:52 -0700, Aahz wrote: >> In article , MRAB >> wrote: >>> >>>An object will be available for garbage collection when nothing refers >

Re: Queue cleanup

2010-08-27 Thread Aahz
mean that objects get reaped as soon as nothing points at them. OTOH, CPython does also have garbage collection to back up refcounting so that when you have unreferenced object cycles they don't stay around. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.co

  1   2   3   4   5   6   7   8   9   10   >