Re: When do default parameters get their values set?

2014-12-09 Thread Duncan Booth
the code and isn't recompiled unless the source code changes). The default parameters are actually evaluated when the 'def' statement is executed and the function object is created from the default arguments and the previously compiled code block. -- Duncan Booth http://kupuguy.blogspot.com

Re: Storage Cost Calculation

2014-09-28 Thread Duncan Booth
in the B was ever expandable. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: newbee

2014-08-13 Thread Duncan Booth
an introduction to using Idle on the Raspberry Pi at http://www.raspberrypi.org/documentation/usage/python/ -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: eval [was Re: dict to boolean expression, how to?]

2014-08-05 Thread Duncan Booth
as there is no need to specify any namespaces. exec def __new__(_cls, %(argtxt)s): return tuple.__new__(_cls, (%(argtxt)s)) % { 'argtxt': argtxt } also passes the tests. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-05 Thread Duncan Booth
Azure. Extensive support for Django (including Intellisense and debugging for templates and various Django specific commands such as sync db and admin shell). -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-05 Thread Duncan Booth
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Duncan Booth wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Unfortunately, software development on Windows is something of a ghetto, compared to the wide range of free tools available for Linux. I

Re: Multi-line commands with 'python -c'

2014-06-01 Thread Duncan Booth
Peter Otten __pete...@web.de wrote: Duncan Booth wrote: Chris Angelico ros...@gmail.com wrote: On Sat, May 31, 2014 at 7:42 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: In unix shells you can literally use a new line. Or is that only bash? You can in bash, I know, but it's

Re: Multi-line commands with 'python -c'

2014-05-31 Thread Duncan Booth
import ^ SyntaxError: invalid syntax -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Multi-line commands with 'python -c'

2014-05-30 Thread Duncan Booth
as a single unit for easy editing: PS C:\python33 python -c @ import os for root, dirs, files in os.walk('.'): if len(dirs + files) == 1: print(root) @ .\Doc .\Lib\concurrent\__pycache__ .\Lib\curses\__pycache__ ... and so on ... -- Duncan Booth -- https://mail.python.org/mailman/listinfo

Re: Forking PyPI package

2014-05-29 Thread Duncan Booth
): Author: Lev Shamardin Author-email: shamar...@gmail.com License: BSD Still better to get in touch with the author, but he has actually stated the license albeit in the most minimal way possible. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: IDE for python

2014-05-29 Thread Duncan Booth
, IronPython, editing, browsing, Intellisense, mixed Python/C++ debugging, remote linux/MacOS debugging, profiling, IPython, Django, and cloud computing with client libraries for Windows, Linux and MacOS. Designed, developed, and supported by Microsoft and the community. -- Duncan Booth

Re: IDE for python

2014-05-29 Thread Duncan Booth
Duncan Booth duncan.booth@invalid.invalid wrote: Sameer Rathoud sameer.rath...@gmail.com wrote: On Wednesday, May 28, 2014 5:16:41 PM UTC+5:30, Greg Schroeder wrote: Please suggest, if we have any free ide for python development. Anything that writes text is fine. I recommend

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-28 Thread Duncan Booth
string needs I think at least 45 bytes (64 bit Python 2.x, up to double that in Python 3.x) but the list only needs one 8 byte pointer per key. I would always choose this simple solution until such time as it is proved to be a problem. -- Duncan Booth -- https://mail.python.org/mailman/listinfo

Re: object().__dict_

2014-04-23 Thread Duncan Booth
subclass which doesn't include a `__slots__` attribute to get a class that can accept arbitrary attributes. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Tuples and immutability

2014-03-07 Thread Duncan Booth
are the same object? If I say: a = (spam, [10, 30], eggs) then a[0] = a[0] won't actually mutate the object. So tuples could let that silently pass. Then you would be able to safely do: a[1] += [50] but this would still throw an exception: a[0] += x -- Duncan Booth http

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Duncan Booth
-length novels, creating a set from a dict doesn't duplicate any strings. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: [RELEASED] Python 3.4.0 release candidate 1

2014-02-11 Thread Duncan Booth
/i python-3.4.0rc1.amd64.msi /L*v logfile.txt Does it put any useful messages in logfile.txt? -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Google Cloud Platform and GlassSolver Project

2014-02-10 Thread Duncan Booth
Cat Photos -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Vedr: What does means in python?

2014-02-10 Thread Duncan Booth
($args -replace'(\\*)','$1$1\') } -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Ifs and assignments

2014-01-03 Thread Duncan Booth
as it will only break for the expected terminal False, not for 0, , or None. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie question. Are those different objects ?

2013-12-23 Thread Duncan Booth
Gregory Ewing greg.ew...@canterbury.ac.nz wrote: rusi wrote: Good idea. Only you were beaten to it by about 2 decades. More than 2, I think. Algol: x := y Wher := is pronounced 'becomes'. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-03 Thread Duncan Booth
in_sequence(H) : while H: yield heappop(H) -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie - Trying to Help a Friend

2013-11-20 Thread Duncan Booth
to x are not divisible by a, b, or c, which would be a case of re-using some of the above code. For extra credit, calculate and use the least common multiple of a,b and c instead of just using their product. -- Duncan Booth -- https://mail.python.org/mailman/listinfo/python-list

Re: 'isimmutable' and 'ImmutableNester'

2013-11-12 Thread Duncan Booth
of BaseException) are permitted. This means the structure can be as deeply nested as you wish, but can never be recursive and no checks against recursion need to be implemented. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Slicing with negative strides

2013-10-29 Thread Duncan Booth
.) For those of us that don't really want to join another mailing list, could you summarise what change is being proposed? -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Mysql's mysql module

2013-10-07 Thread Duncan Booth
. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Tail recursion to while iteration in 2 easy steps

2013-10-04 Thread Duncan Booth
Neil Cerutti ne...@norwich.edu wrote: On 2013-10-03, Duncan Booth duncan.booth@invalid.invalid wrote: It isn't hard to imagine adding a TAIL_CALL opcode to the interpreter that checks whether the function to be called is the same as the current function and if it is just updates the arguments

Re: Tail recursion to while iteration in 2 easy steps

2013-10-04 Thread Duncan Booth
. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Tail recursion to while iteration in 2 easy steps

2013-10-03 Thread Duncan Booth
would lose stack frames in any traceback. Also it means code for this modified Python wouldn't run on other non-modified interpreters, but it is at least theoretically possible without breaking Python's assumptions. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-20 Thread Duncan Booth
it works on a tablet but it would be worth trying. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Python in XKCD today

2013-09-13 Thread Duncan Booth
Roy Smith r...@panix.com wrote: http://xkcd.com/1263/ So now I guess someone has to actually implement the script. At least, that's (sort of) what happened for xkcd 353 so there's a precedent. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python

Re: semicolon at end of python's statements

2013-09-05 Thread Duncan Booth
C in a Pascalish, Algol68ish style (if I remembered them correctly): #define IF if((( #define AND ))(( #define OR )||( #define THEN ))){ #define ELSE }else{ #define FI } -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2013-09-05 Thread Duncan Booth
as the version I remember as it doesn't 'fix' the logical operator priorities. -- Duncan Booth http://kupuguy.blogspot.com -- https://mail.python.org/mailman/listinfo/python-list

Re: .split() Qeustion

2013-08-15 Thread Duncan Booth
way of writing it is more readable. -- Duncan Booth -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Duncan Booth
through. -- Duncan Booth -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Duncan Booth
Chris Angelico ros...@gmail.com wrote: On Tue, Jul 23, 2013 at 6:06 PM, Duncan Booth duncan.booth@invalid.invalid wrote: I have a very common situation where an overly strict SPF may cause problems: Like many people I have multiple email addresses which all end up in the same inbox. The one

Re: Callable or not callable, that is the question!

2013-07-12 Thread Duncan Booth
that you need _handle_bool as both a static method and a utility function, you probably also need to explain why you can't just use both: class Parser: def _handle_bool(input): ... handle_bool = staticmethod(_handle_bool) -- Duncan Booth http://kupuguy.blogspot.com -- http

Re: Why is regex so slow?

2013-06-19 Thread Duncan Booth
. Or as the source puts it: it's a mix between Boyer-Moore and Horspool, with a few more bells and whistles on the top. Also the regex library has to do a whole lot more than just figuring out if it got a match, so you have massively over-simplified it. -- Duncan Booth http://kupuguy.blogspot.com -- http

Re: object.enable() anti-pattern

2013-05-08 Thread Duncan Booth
and objects that require cleanup were pushed onto that stack after being fully constructed but before calling the initialisation that required cleanup. See http://www.developer.nokia.com/Community/Wiki/Two-phase_construction -- Duncan Booth -- http://mail.python.org/mailman/listinfo/python-list

Re: Running simultaneuos FOR loops

2013-04-23 Thread Duncan Booth
don't need to call the `iterkeys()` method as you need them all to sort and just treating the dict as a sequence will do the right thing. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: howto remove the thousand separator

2013-04-19 Thread Duncan Booth
, just be sure to set the correct locale first: import locale locale.setlocale(locale.LC_ALL, '') 'English_United Kingdom.1252' locale.atoi('1,000') 1000 locale.atof('1,000') 1000.0 locale.setlocale(locale.LC_ALL, 'French_France') 'French_France.1252' locale.atof('1,000') 1.0 -- Duncan Booth

Re: What are some other way to rewrite this if block?

2013-03-18 Thread Duncan Booth
') if should_be_on - EARLY_DELTA = came_on = should_be_on + LATE_DELTA: return 'on time' if came_on should_be_on: return 'delayed' return 'early' Note that none of this will hande situations around midnight such as: should_be_on==23.5, came_on=0.5 -- Duncan Booth

Re: Unicode

2013-03-15 Thread Duncan Booth
' a contains unicode MICRO SIGN, b contains GREEK SMALL LETTER MU -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: FYI: AI-programmer

2013-02-22 Thread Duncan Booth
that (in most cases) runs faster than the original, which is pretty much the same thing. All it needs is a bit of AI stuck on to critique the code and complain about the weather and you're done. -- Duncan Booth -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Newbie

2013-02-22 Thread Duncan Booth
the latter. -- Duncan Booth -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Newbie

2013-02-22 Thread Duncan Booth
Steve Simmons square.st...@gmail.com wrote: On 22/02/2013 15:26, Duncan Booth wrote: Rui Maciel rui.mac...@gmail.com wrote: Chris Angelico wrote: On Fri, Feb 22, 2013 at 10:58 PM, Rui Maciel rui.mac...@gmail.com wrote: Mitya Sirenef wrote: Looks very unclear and confusing to me

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-14 Thread Duncan Booth
} You can't just allow ':' to generate slice objects everwhere without introducing ambiguity, so your proposal would have to be to allow slice objects in wider but still restricted contexts. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: real-time monitoring of propriety system: embedding python in C or embedding C in python?

2013-02-05 Thread Duncan Booth
loop in Python but use callbacks from the library to handle the values as they appear, but again that probably just complicates things. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: confusion with decorators

2013-02-04 Thread Duncan Booth
(nto the script) will have been compiled once and don't compile again until the source changes. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: mysql solution

2013-01-24 Thread Duncan Booth
, browser, date, page, host)) -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Else statement executing when it shouldnt

2013-01-22 Thread Duncan Booth
#break-and-continue-statements-and-else-clauses-on-loops -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Else statement executing when it shouldnt

2013-01-22 Thread Duncan Booth
Duncan Booth duncan.booth@invalid.invalid wrote: Matching 'if' or 'for' or 'while'. or of course 'try'. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: handling return codes from CTYPES

2013-01-21 Thread Duncan Booth
://docs.python.org/2/library/ctypes.html#return-types You can also tell it what parameter types to expect which will make calling it simpler. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2013-01-10 Thread Duncan Booth
=prog, l=l, tc=tc) if hasattr(prog, 'VERSION'): print 'But I challenge them to write code {tc.way} clean without it!'.format(**locals()) if __name__ == '__main__': main() - -- Duncan Booth http

Re: Over 30 types of variables available in python ?

2013-01-07 Thread Duncan Booth
chaouche yacine yacinechaou...@yahoo.com wrote: booleans ints, floats, longs, complexes strings, unicode strings lists, tuples, dictionaries, dictionary views, sets, frozensets, buffers, bytearrays, slices functions, methods, code objects,modules,classes, instances, types, nulls (there is

Re: Python USB control on Windows 7?

2012-12-23 Thread Duncan Booth
Chris Angelico ros...@gmail.com wrote: On Sun, Dec 23, 2012 at 6:28 PM, Tim Roberts t...@probo.com wrote: Duncan Booth duncan.booth@invalid.invalid wrote: In this year's Christmas Raffle at work I won a 'party-in-a-box' including USB fairy lights. They sit boringly on all the time, so does

Python USB control on Windows 7?

2012-12-21 Thread Duncan Booth
In this year's Christmas Raffle at work I won a 'party-in-a-box' including USB fairy lights. They sit boringly on all the time, so does anyone know if I can toggle the power easily from a script? My work PC is running Win7. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pass and return

2012-12-21 Thread Duncan Booth
you feel the need for an empty function. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-21 Thread Duncan Booth
and readable, which one is more pythonic ? The one that doesn't do unexpected things with operators. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with calling function from dll

2012-12-13 Thread Duncan Booth
): raise RuntimeError(Failed to get computer name) return buf.value[:len.value] print GetComputerName() -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: re.search when used within an if/else fails

2012-11-29 Thread Duncan Booth
to the next multiple of 8 spaces. if 1: ... print yes # space + tab ... print no # eight spaces ... yes no If tab expanded to exactly 8 spaces the leading space would have forced an indentation error, but it didn't. -- Duncan Booth http://kupuguy.blogspot.com -- http

Re: how to pass echo t | input to subprocess.check_output() method

2012-11-26 Thread Duncan Booth
accept any old server regardless what certificate it uses, but be aware that this impacts security. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: how to pass echo t | input to subprocess.check_output() method

2012-11-26 Thread Duncan Booth
then connect to it using the external hostname rather than localhost). Or just use http:// configured to allow access through localhost only. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Question regarding running .py program

2012-11-22 Thread Duncan Booth
from the lockscreen until you get to a page with only a '+', add the new widget there, then long press that widget and drag it to be the rightmost page. Then you should be sorted just so long as you don't have any friends with December birthdays. -- Duncan Booth http://kupuguy.blogspot.com

Re: isinstance(.., file) for Python 3

2012-11-08 Thread Duncan Booth
checking types at all? def foo(file_or_string): try: data = file_or_string.read() except AttributeError: data = file_or_string ... use data ... -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Haskell - Python

2012-11-03 Thread Duncan Booth
'functional' version there is also the Python 3.3 variant: def options(heaps): if not heaps: return [] head, *tail = heaps yield from ([h]+tail for h in range(head)) yield from ([head]+t for t in options(tail)) -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org

Re: Float to String %.7e - diff between Python-2.6 and Python-2.7

2012-10-30 Thread Duncan Booth
+02') What do you get printing the value on 2.6 with a '%.20e' format? I seem to remember that 2.7 rewrote float parsing because previously it was buggy. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interactive help()

2012-10-19 Thread Duncan Booth
under 'built-in functions'. http://docs.python.org/library/functions.html#help -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing against multiple versions of Python

2012-10-19 Thread Duncan Booth
don't remembers. I do not see anything on PyPI. Any advice is welcome! Not exactly what you asked for, but if you clone https://github.com/collective/buildout.python then a single command will build Python 2.4, 2.5, 2.6, 2.7, 3.2, and 3.3 on your system. -- Duncan Booth http

Re: Add if...else... switch to doctest?

2012-10-19 Thread Duncan Booth
] return [1, 2] else: def function(): function() [1, 2, 3] return [1, 2, 3] and if it's more than one such function use separate modules. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python

Re: Python interactive help()

2012-10-19 Thread Duncan Booth
Mark Lawrence breamore...@yahoo.co.uk wrote: On 19/10/2012 09:56, Duncan Booth wrote: Mark Lawrence breamore...@yahoo.co.uk wrote: Good morning/afternoon/evening all, Where is this specific usage documented as my search engine skills have let me down? By this I mean entering help

Re: portable unicode literals

2012-10-16 Thread Duncan Booth
-- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: + in regular expression

2012-10-09 Thread Duncan Booth
than following a grammar (_parse is a 238 line function). So I think it really is just trying to match existing regular expression parsers and any possible grammar is an excuse for why it should be the way it is rather than an explanation. -- Duncan Booth http://kupuguy.blogspot.com -- http

Re: Insert item before each element of a list

2012-10-09 Thread Duncan Booth
', 1, 'insertme', 2, 'insertme', 3] I appreciate any and all feedback. Given the myriad of proposed solutions, I'm surprised nobody has suggested good old list slicing: x = [1,2,3] y = ['insertme']*(2*len(x)) y[1::2] = x y ['insertme', 1, 'insertme', 2, 'insertme', 3] -- Duncan Booth

Re: + in regular expression

2012-10-05 Thread Duncan Booth
or special sequences. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Java singletonMap in Python

2012-09-24 Thread Duncan Booth
where id = :barId then you would need a parameter map with a single key-value pair, barId=123. That's a great place to use singletonMap() Of course in Python you just use a dict literal in that case so it's pointless. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org

Re: 'indent'ing Python in windows bat

2012-09-20 Thread Duncan Booth
the triple-quote string containing the CMD commands, just begin the file with a goto to skip into the batch commands and end them by jumping to eof. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorators not worth the effort

2012-09-14 Thread Duncan Booth
on startup so instead of a default of `timeout= 15` you would have a default `timeout=MEDIUM_TIMEOUT` or whatever name is appropriate. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-11 Thread Duncan Booth
has been about how, for random strings, the not-equal case is O(1) as well. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-11 Thread Duncan Booth
the code doesn't attempt to short circuit the not equal but interned case. The comparison code doesn't look at interning at all, it only looks for identity as a shortcut. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing strings from the back?

2012-09-10 Thread Duncan Booth
of comparisons on the same string (otherwise creating the string would be the limiting factor), so at the expense of a single dictionary insertion when the string is created you can get guaranteed O(1) on all the comparisons. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org

Re: is implemented with id ?

2012-09-06 Thread Duncan Booth
are comitted (or aborted). This means that global objects can be safely read from multiple threads without any semaphore locking. See http://mail.python.org/pipermail/pypy-dev/2012-September/010513.html -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python

Re: Python Error

2012-07-30 Thread Duncan Booth
what's going on in more detail. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-16 Thread Duncan Booth
68 which if I remember correctly used := for assignment and = to bind names (although unlike Python you couldn't then re-bind the name to another object in the same scope). -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to safely maintain a status file

2012-07-09 Thread Duncan Booth
the database once and then write out your status every few seconds. import sqlite3 con = sqlite3.connect('status.db') ... with con: cur = con.cursor() cur.execute('UPDATE ...', ...) and similar code to restore the status or create required tables on startup. -- Duncan Booth http

Re: Dictless classes

2012-07-03 Thread Duncan Booth
that is a safe assumption. I believe so. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Hashable object with self references OR how to create a tuple that refers to itself

2012-06-18 Thread Duncan Booth
to itself you've broken the rules for reference counting. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Help doing it the python way

2012-05-24 Thread Duncan Booth
= list(vertical_neighbours(coords)) -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: pyjamas / pyjs

2012-05-04 Thread Duncan Booth
case I still need to sign up to the list to post but definitely don't want to receive emails. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-05 Thread Duncan Booth
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: JSON expects double-quote marks, not single: v = json.loads({'test':'test'}) fails v = json.loads('{test:test}') succeeds You mean JSON expects a string with valid JSON? Quelle surprise. -- Duncan Booth http

Re: string interpolation for python

2012-04-02 Thread Duncan Booth
to one in compactness, what a magic 3! You can avoid the duplication fairly easily: name='Peter' 'Are you {name}?'.format(**vars()) 'Are you Peter?' though if you're doing that it would be better to limit the scope to a specific namespace. -- Duncan Booth http://kupuguy.blogspot.com -- http

Re: Python is readable

2012-03-16 Thread Duncan Booth
to conditionally acquire the lock and return a boolean indicating success or failure. When used inside a `with` statement you can't pass in the optional argument so it acquires it unconditionally but still returns the success status which is either True or it never returns. -- Duncan Booth http

Re: Python is readable

2012-03-15 Thread Duncan Booth
editors or indeed humans) to understand. A little bit of redundancy in the grammar is seen as a good way to minimise errors. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: [RELEASED] Python 3.3.0 alpha 1

2012-03-05 Thread Duncan Booth
about that. Also the what's new doesn't mention PEP 414 although the release page does. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Please verify!!

2012-02-24 Thread Duncan Booth
++ which is nothing at all like Notepad. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: sum() requires number, not simply __add__

2012-02-24 Thread Duncan Booth
types and never having converted my code to C I have no idea whether or not the performance for the intended case would be competitive with the builtin sum though I don't see why it wouldn't be. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: #line in python

2012-02-20 Thread Duncan Booth
://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html for some code that shows you what's in a .pyc -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: #line in python (dirty tricks)

2012-02-20 Thread Duncan Booth
: oops -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-15 Thread Duncan Booth
Rick Johnson rantingrickjohn...@gmail.com wrote: On Feb 14, 5:31 am, Duncan Booth duncan.bo...@invalid.invalid wrote: Rick Johnson rantingrickjohn...@gmail.com wrote: BS! With free healthcare, those who would have allowed their immune system fight off the flu, now take off from work, visit

Re: OT: Entitlements [was Re: Python usage numbers]

2012-02-15 Thread Duncan Booth
Arnaud Delobelle arno...@gmail.com wrote: On 15 February 2012 09:47, Duncan Booth duncan.booth@invalid.invalid wrote: Rick Johnson rantingrickjohn...@gmail.com wrote: [...] Perhaps it's a bit presumptuous of me but... It's tempting to react to his inflammatory posts, but after all Rick

  1   2   3   4   5   6   7   8   9   10   >