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
in the B was ever expandable.
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
import
^
SyntaxError: invalid syntax
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
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
):
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
, 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
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
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
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
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
-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
/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
Cat Photos
--
Duncan Booth http://kupuguy.blogspot.com
--
https://mail.python.org/mailman/listinfo/python-list
($args
-replace'(\\*)','$1$1\') }
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
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
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
in_sequence(H) :
while H:
yield heappop(H)
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
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
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
.)
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
.
--
Duncan Booth http://kupuguy.blogspot.com
--
https://mail.python.org/mailman/listinfo/python-list
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
.
--
Duncan Booth http://kupuguy.blogspot.com
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
way of writing it is
more readable.
--
Duncan Booth
--
http://mail.python.org/mailman/listinfo/python-list
through.
--
Duncan Booth
--
http://mail.python.org/mailman/listinfo/python-list
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
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
.
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
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
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
, 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
')
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
'
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
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
the
latter.
--
Duncan Booth
--
http://mail.python.org/mailman/listinfo/python-list
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
}
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
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
(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
, browser, date, page, host))
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
#break-and-continue-statements-and-else-clauses-on-loops
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
://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
=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
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
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
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
you feel the need for an empty
function.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
):
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
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
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
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
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
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
'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
+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
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
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
]
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
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
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
', 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
or
special sequences.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
what's going on in more detail.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
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
that is a
safe assumption.
I believe so.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
to itself you've broken the rules for reference counting.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
= list(vertical_neighbours(coords))
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
++ which is nothing at all like
Notepad.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
://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
: oops
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
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 - 100 of 1755 matches
Mail list logo