led
the first time you ran 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
tional RAM was paged in as necessary but I don't think the RAM
in the B was ever expandable.
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
e between the two systems.
>
All of the above should work just fine on a Pi. The only thing I thing
you could have added is that you also have the option of using Idle to
edit and run Python programs. If you are running Raspian on your Pi then
you will find an icon to run Idle sitting on the initial desktop.
There's 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
Steven D'Aprano wrote:
> Duncan Booth wrote:
>
>> Steven D'Aprano wrote:
>>
>>> Unfortunately, software development on Windows is something of a
>>> ghetto, compared to the wide range of free tools available for
>>> Linux.
>
&
Automatic deployment to Windows 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
;t work.
For that matter I don't understand why tuple.__new__ needs to be pre-bound.
Just referring
to tuple.__new__ directly in the exec simplifies things even more 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
Peter Otten <__pete...@web.de> wrote:
> Duncan Booth wrote:
>
>> Chris Angelico wrote:
>>
>>> On Sat, May 31, 2014 at 7:42 AM, Devin Jeanpierre
>>> wrote:
>>>> In unix shells you can literally use a new line. Or is that only
>> bash?
k("."):
if len(dirs + files) == 1: print(root)
'
$ python -c $script
File "", line 1
import
^
SyntaxError: invalid syntax
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
and in Powershell ISE up-arrow pulls it back
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 wrote:
> Sameer Rathoud 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
go, and cloud computing with client libraries for
> Windows, Linux and MacOS.
>
> Designed, developed, and supported by Microsoft and the community.
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
pwdhash / pwdhash.py.egg-info / PKG-INFO):
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
aracter
strings then each 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://
t__ and the
> object does not accept new attributes.
> Please explain what's going on.
>
>
Not all classes have a __dict__ attribute. Mostly builtin classes (e.g.
tuple, list, int, ...), but also if you have an class using __slots__
which subclasses a class with no __dict__ it won't have a __dict__.
Subclasses don't remove attributes, they only add them (although in
Python you can bend that rule it still applies here). Therefore for any
classes to not have a __dict__ attribute the ultimate base class
'object' has to not have a __dict__.
The consequence, as you found out, is that you cannot add attributes to
an instance of 'object()', you have to create at least an empty 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
hrow an exception on assigning to
the element if the old value and new value 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 s
;t matter whether they were small strings or full-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
/pip from
pypi. Did your system have network access?
What happens if you enable the installer log by running:
msiexec /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
ompt running as administrator enter "Set-ExecutionPolicy
RemoteSigned") and you can just do:
powershell .\Pythoncerts.ps1
I also use Powershell interactively so I have the filters defined in my
startup ($Home\Documents\WindowsPowerShell\profile.ps1):
filter py() { $_ | py.exe ($args -replace'(\\*)"','$1$1\"') }
filter python() { $_ | c:\Python33\python.exe ($args
-replace'(\\*)"','$1$1\"') }
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
Correct: "Cat Facts for Glass"
>
> Incorrect: "Glass Cat Facts", "Glassy Cat Photos"
--
Duncan Booth http://kupuguy.blogspot.com
--
https://mail.python.org/mailman/listinfo/python-list
do have to be sure to get the sentinel value correct 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 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-list
) if H else sentinel, sentinel):
print(N)
Alternatively your 'in_sequence' function would look better without the
exception handling:
def in_sequence(H) :
while H:
yield heappop(H)
--
Duncan Booth
--
https://mail.python.org/mailman/listinfo/python-list
nd how many numbers up 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
s and exception classes (subclasses 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
7;t feel that you have to join yet
> another 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
think the answers to questions 1
and 3 are yes and no respectively. No idea about #2.
--
Duncan Booth http://kupuguy.blogspot.com
--
https://mail.python.org/mailman/listinfo/python-list
ions get removed
> from the stack traces just because they happened to end in tail calls.
Quite so. Losing some stack frames in the traceback because tail recursion
was optimised is probably no big deal. Losing arbitrary stack frames
because of a more widespread tail call optimisation would n
Neil Cerutti wrote:
> On 2013-10-03, Duncan Booth 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 an
e code block. If the function doesn't match it would simply fall through
to doing the same as the current CALL_FUNCTION opcode.
There is an issue that you would lose stack frames in any traceback. Also
it means code for this modified Python wouldn't run on other non-modified
interpreter
;t know how well 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 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-list
gt;
That brings back memories all right, but its not as good 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
syntactic elements are for.
>
> ChrisA
>
Someone I knew actually used these definitions when writing 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
o solve.
> """[1:-1].split("\n")
>
> ?
I suppose the question really is whether the author of the second
example really meant to start with the word 'evelopments'?
If that was a mistake, then the first one is demonstrably less error
prone. If it was intentional then the second one is definitely less
readable.
Either way I think you've proved that the first way of writing it is
more readable.
--
Duncan Booth
--
http://mail.python.org/mailman/listinfo/python-list
Chris Angelico wrote:
> On Tue, Jul 23, 2013 at 6:06 PM, Duncan Booth
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. Th
t Google's fault: they can't ignore the forwarding step otherwise
spammers could bypass SPF simply by claiming to be forwarding the emails.
It is simply a limitation of the SPF protocol. Fortunately they only use
SPF as one indicator so real messages still get through.
--
Duncan Booth
--
http://mail.python.org/mailman/listinfo/python-list
and a utility method rather than
just one or the other and also where you couldn't just have both.
If you can persuade me 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 Pa
skip to checking the 6th and then the 9th. It doesn't have to touch the
intervening characters at all.
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 figu
d a separate
cleanup stack 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
sorted(class_count),
sorted(pixel_count)):
also you 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
ing the locale module, 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
>
should_be_on <= 24.0 and 0.0 <= came_on <= 24.0):
raise ValueError('time not in range')
if should_be_on - EARLY_DELTA <= came_on <= should_be_on + LATE_DELTA:
return 'on time'
if came_on > should_be_on:
return 'delayed'
t characters:
>>> repr(a)
"u'\\xb5m'"
>>> repr(b)
"u'\\u03bcm'"
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
Steve Simmons wrote:
>
> On 22/02/2013 15:26, Duncan Booth wrote:
>> Rui Maciel wrote:
>>
>>> Chris Angelico wrote:
>>>
>>>> On Fri, Feb 22, 2013 at 10:58 PM, Rui Maciel
>>>> wrote:
>>>>> Mitya Sirenef wrote:
&
ame block, or did you think it was
talking about the placement of the opening brace on the same line as the
`if` statement?
I believe that Mitya was talking about the former but that you assumed the
latter.
--
Duncan Booth
--
http://mail.python.org/mailman/listinfo/python-list
ogram?
>
We already have a Python interpreter written in Python 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
ith a step?:
{1:2:3}
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
course mix the two. If it's more convenient put the main 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
es, but after the first run of the program all of the
modules (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
counter.page = %s
AND visitors.host=%s''',
(useros, browser, date, page, host))
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth 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
tp://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
still get the same
> response (65535).
Tell the function what type to return before you call it:
InitScanLib = sLib.InitScanLib
InitScanLib.restype = c_short
See http://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
access your {l[1]}.
{l[0]} people might say {prog.NAME} has no
{tc.no}.''').format(prog=prog, l=l, tc=tc)
if hasattr(prog, 'VERSION'):
print 'But I challenge them to write code {tc.way} clean
without it
chaouche yacine 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 exactly one
> obj
Chris Angelico wrote:
> On Sun, Dec 23, 2012 at 6:28 PM, Tim Roberts wrote:
>> Duncan Booth wrote:
>>>
>>>In this year's Christmas Raffle at work I won a 'party-in-a-box'
>>>including USB fairy lights.
>>>
>>>They sit borin
e.tostring(snippet)
'Hello world'
>
> With the tree syntax proposed in Brython it would just be
>
> doc <= DIV('hello '+B('world'))
>
> If "pythonic" means concise 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
atic way is to use a doc-string as the only body,
that way you can also explain why you feel the need for an empty
function.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
c_int)]
_GetComputerNameW.restype = c_int
def GetComputerName():
buf = create_unicode_buffer(255)
len = c_int(255)
if not _GetComputerNameW(buf, len):
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
xpands 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
ou use (if the svn server is also used by
other machines 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
option so that if the certificate ever does change in the
future the command will fail rather than prompting.
Alternatively use --non-interactive --trust-server-cert to just 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
the default lockscreen widget swipe left 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
her 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
):
yield [h]+tail
for t in options(tail):
yield [head]+t
For a more '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 ([he
calhost ~]$ /opt/local/bin/python2.6 -c "print('%.20e'%
2.096732150e+02,'%.7e'%2.096732150e+02)"
('2.096732149009e+02', '2.0967321e+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
Mark Lawrence wrote:
> On 19/10/2012 09:56, Duncan Booth wrote:
>> Mark Lawrence wrote:
>>
>>> Good morning/afternoon/evening all,
>>>
>>> Where is this specific usage documented as my search engine skills have
>>> let me down? By this I mea
parate functions:
if sys.platform=='win32':
def function():
"""
>>> function()
[1, 2]
"""
return [1, 2]
else:
def function():
"""
>>> function()
[1, 2, 3]
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 h
ented 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
ork in 3.1 and 3.2 there is the uprefix import hook:
https://bitbucket.org/vinay.sajip/uprefix
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
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
--
http://mail.python.org/mailman/listinfo/python-list
most of the others in existence) tend more
to the spaghetti code 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
:= concatenation | basic-re
concatenation ::= simple-re basic-re
basic-re ::= element | element quantifier
element ::= group | nc-group | "." | "^" | "$" | char | charset
quantifier = "*" | "+" | "?" | "{" NUMBER "}" | &q
e cases in Java where you have a
method that takes a map as an argument and you want to pass in a map with a
single
kep/value pair. In that case it lets you replace 3 lines of Java with 1.
e.g. from the comments:
"If you have a simple select statement like "select foo from bar where id =
:ba
is is a CMD script
python -x %~f0 "%1"
echo Back in the CMD script
goto :eof
"""
import sys
print("Welcome to Python")
print("Arguments were {}".format(sys.argv))
print("Bye!")
You can put the Python code either before or after 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
method itself and
nowhere else. Alternatively use named values for different categories of
timeouts and adjust them 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
;t think you've misunderstood how it work, but so far as I can see 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
trings are interned, if s is not t then s != t as well".
Right if the strings differ only in the last character, but the rest of
this thread 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
are created.
For the comparison to be the limiting factor you have to be doing a lot 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
nsactions 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-list
drop you into the debugger
so you can examine what's going on in more detail.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
names.
Albert raised the subject of Algol 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
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
> that every class will have a __dict__, and I wonder whether that is a
> safe assumption.
I believe so.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
empting to add the
tuple to itself you've broken the rules for reference counting.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
for x, y in coords:
yield x, y-1
yield x, y+1
new_coords = list(vertical_neighbours(coords))
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
rough gmane in which 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 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
t;Are you $name$?"
> Template:
>>>> Template("Are you $name?").substitute(name=name)
> It is three to one in compactness, what a magic 3!
You can avoid the duplication fairly easily:
>>> name='Peter'
>>> 'Are you {name}?
argument which can be used 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 r
as text
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
something 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
result for some user defined
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
ng at all like
Notepad.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
foo()
File "foo.bar", line 47, in foo
File "evil.txt", line 667, in bar
Evil line 667
RuntimeError: oops
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
ers in the whole
file: see
http://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
Arnaud Delobelle wrote:
> On 15 February 2012 09:47, Duncan Booth
> wrote:
>> Rick Johnson wrote:
> [...]
>
> Perhaps it's a bit presumptuous of me but...
>
> It's tempting to react to his inflammatory posts, but after all Rick
> is a troll and ex
Rick Johnson wrote:
> On Feb 14, 5:31 am, Duncan Booth wrote:
>> Rick Johnson wrote:
>> > BS! With free healthcare, those who would have allowed their immune
>> > system fight off the flu, now take off from work, visit a local
>> > clinic, and get pumped fu
1 - 100 of 1775 matches
Mail list logo