On Thu, Jun 11, 2015 at 10:39 AM, subhabrata.bane...@gmail.com wrote:
On Thursday, June 11, 2015 at 9:20:59 PM UTC+5:30, Ian wrote:
On Thu, Jun 11, 2015 at 9:40 AM,
if write this it is working fine, but if I write
if (AND in inp1) or (OR in inp1) or (NOT in inp1) or ( in inp1)
or (
On Wed, Jun 10, 2015 at 2:11 PM, Sebastian M Cheung via Python-list
python-list@python.org wrote:
On Wednesday, June 10, 2015 at 6:06:09 PM UTC+1, Sebastian M Cheung wrote:
Say in 2014 April to May whole weeks would be 7th, 14th 28th April and May
would be 5th, 12th and 19th. So expecting 7
On Wed, Jun 10, 2015 at 11:05 AM, Sebastian M Cheung via Python-list
python-list@python.org wrote:
Say in 2014 April to May whole weeks would be 7th, 14th 28th April and May
would be 5th, 12th and 19th. So expecting 7 whole weeks in total
from datetime import date
d1 = date(2014, 4, 7)
d2
On Wed, Jun 10, 2015 at 11:03 AM, Thomas 'PointedEars' Lahn
pointede...@web.de wrote:
Jussi Piitulainen wrote:
Thomas 'PointedEars' Lahn writes:
Jussi Piitulainen wrote:
Thomas 'PointedEars' Lahn writes:
8 3 6 3 1 2 6 8 2 1 6.
There are more than four hundred thousand ways to get those
On Wed, Jun 10, 2015 at 8:01 PM, Sebastian M Cheung via Python-list
python-list@python.org wrote:
yes just whole weeks given any two months, I did looked into calendar module
but couldn't find specifically what i need.
cal.monthdays2calendar(2014, 4) + cal.monthdays2calendar(2014, 5)
[[(0,
On Wed, Jun 10, 2015 at 9:19 PM, Michael Torrie torr...@gmail.com wrote:
On 06/10/2015 02:11 PM, Sebastian M Cheung via Python-list wrote:
On Wednesday, June 10, 2015 at 6:06:09 PM UTC+1, Sebastian M Cheung wrote:
Say in 2014 April to May whole weeks would be 7th, 14th 28th April and May
On Sun, Jun 7, 2015 at 10:44 AM, Chris Angelico ros...@gmail.com wrote:
On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn
pointede...@web.de wrote:
The greater the multiplier, the lower the chance that any element will
have no hits.
Wrong.
[ex falso quodlibet]
Huh. Do you want to
On Fri, Jun 5, 2015 at 12:10 PM, Wesley nisp...@gmail.com wrote:
Hi Laura,
Sure, I got special requirement that just parse html file into DOM tree, by
only general basic modules, and based on my DOM tree structure, draft an
bitmap.
So, could you give me an direction how to get the DOM
On Thu, Jun 4, 2015 at 5:47 PM, stephenpprane...@gmail.com wrote:
On Thursday, June 4, 2015 at 4:15:29 PM UTC-7, stephenp...@gmail.com wrote:
hey, i really need help, im a straight up beginner in scripting and i need
to figure out how to make an inverted particle emitter using python in maya
On Thu, Jun 4, 2015 at 5:15 PM, stephenpprane...@gmail.com wrote:
hey, i really need help, im a straight up beginner in scripting and i need to
figure out how to make an inverted particle emitter using python in maya
No idea. This sounds more like a Maya question than a Python question.
Maybe
On Wed, Jun 3, 2015 at 3:56 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
Now does Python pass by value or by reference? Happily sits back and waits
for 10**6 emails to arrive as this is discussed for the 10**6th time.
Troll.
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Jun 3, 2015 at 3:08 PM, Rustom Mody rustompm...@gmail.com wrote:
On Tuesday, June 2, 2015 at 7:50:58 PM UTC+5:30, Ian wrote:
On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody wrote:
For that matter even this works
But I am not sure whats happening or that I like it
[x[-2:] for x in
On Wed, Jun 3, 2015 at 2:57 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote:
In Python, classes are little more than constructor functions.
[...]
Classes give you an inheritance
On Tue, Jun 2, 2015 at 12:10 PM, Ned Batchelder n...@nedbatchelder.com wrote:
On Tuesday, June 2, 2015 at 1:59:37 PM UTC-4, BartC wrote:
Javascript primitives include Number and String.
What does Python allow to be done with its Number (int, etc) and String
types that can't be done with their
On Tue, Jun 2, 2015 at 3:47 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
The classic response to Super Considered Harmful for those who may be
interested is
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ and
recently https://www.youtube.com/watch?v=EiOglTERPEo
I feel
On Tue, Jun 2, 2015 at 11:19 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Steven D'Aprano st...@pearwood.info:
On Fri, 29 May 2015 12:00 pm, Steven D'Aprano wrote:
[...]
in a language where classes are
themselves values, there is no reason why a class must be instantiated,
particularly if
On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody rustompm...@gmail.com wrote:
For that matter even this works
But I am not sure whats happening or that I like it
[x[-2:] for x in lines]
['12', '42', '49', '56', '25', '36', '49', '64', '81', '00']
x[-2:] selects all items in the sequence with
On Mon, Jun 1, 2015 at 4:59 PM, BartC b...@freeuk.com wrote:
I'm developing a new language along the lines of Python, perhaps a brief
description of how things are done there might help. Or just give a
different perspective.
Objects in this language are tagged: there's a code attached to each
On Mon, Jun 1, 2015 at 11:13 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 1, 2015 at 10:23 AM, gm notmym...@mail.not wrote:
Hi.
I am new to python so am still in learning phase.
I was thinking to make one program that will print out all possible
combinations of 10 pairs. I think
On Mon, Jun 1, 2015 at 10:23 AM, gm notmym...@mail.not wrote:
Hi.
I am new to python so am still in learning phase.
I was thinking to make one program that will print out all possible
combinations of 10 pairs. I think this is a good way for something bigger
:-).
This is how this looks
On Mon, Jun 1, 2015 at 3:33 PM, greenbay.gra...@gmail.com wrote:
According to this https://docs.python.org/3.4/library/venv.html#module-venv
'Each virtual environment has its own Python binary (allowing creation of
environments with various Python versions)'
So how would I create a virtual
On Sun, May 31, 2015 at 1:58 PM, Denis McMahon denismfmcma...@gmail.com wrote:
reversed returns an iterator, not a list, so it returns the reversed list
of elements one at a time. You can use list() or create a list from
reversed and then join the result:
$ python
Python 2.7.3 (default, Dec
On Fri, May 29, 2015 at 2:05 AM, anatoly techtonik techto...@gmail.com wrote:
Added Mailman to my suxx tracker:
https://github.com/techtonik/suxx-tracker#mailman
What a useless tool. Instead of tiredly complaining that things suck,
why not take some initiative to make them better?
I'm curious
On Fri, May 29, 2015 at 4:44 AM, Jon Ribbens
jon+use...@unequivocal.co.uk wrote:
On 2015-05-29, Ian Kelly ian.g.ke...@gmail.com wrote:
On Fri, May 29, 2015 at 2:05 AM, anatoly techtonik techto...@gmail.com
wrote:
Added Mailman to my suxx tracker:
https://github.com/techtonik/suxx-tracker
On Thu, May 28, 2015 at 9:01 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Anssi Saari a...@sci.fi:
Do you have an example of state pattern using nested classes and
python? With a quick look I didn't happen to find one in any language.
Here's an sampling from my mail server:
I think I would be
On Tue, May 26, 2015 at 2:52 PM, Michael Torrie torr...@gmail.com wrote:
On 05/26/2015 08:57 AM, zipher wrote:
Comprende? I'm not trying to be cryptic here. This is a bit of OOP
theory to be discussed.
No, sorry. Maybe an actual example (with use case) would spur discussion.
Better yet,
On Mon, May 25, 2015 at 8:17 PM, Steven D'Aprano st...@pearwood.info wrote:
PEP 8 states that developers should never invent their own dunder methods:
__double_leading_and_trailing_underscore__ :
magic objects or attributes that live in user-controlled
namespaces. E.g.
On Mon, May 25, 2015 at 1:21 PM, ravas ra...@outlook.com wrote:
I read an interesting comment:
The coolest thing I've ever discovered about Pythagorean's Theorem is an
alternate way to calculate it. If you write a program that uses the distance
form c = sqrt(a^2 + b^2) you will suffer from
On Sat, May 23, 2015 at 5:34 PM, hamilton hamil...@nothere.com wrote:
So if you are a Member of Islamic State you have rights, other wise you are
an infidel and subject to death from the whim of Allah or whom ever thinks
they are Allah.
Does that sound right ??
Please don't reply to
On Sat, May 23, 2015 at 8:57 PM, Michael Torrie torr...@gmail.com wrote:
On 05/23/2015 05:40 AM, Chris Angelico wrote:
On Sat, May 23, 2015 at 9:34 PM, Tim Chase
python.l...@tim.thechases.com wrote:
A self-signed certificate may be of minimal worth the *first* time you
visit a site, but if
On Sat, May 23, 2015 at 7:53 PM, Dr. John Q. Hacker
zonderv...@gmail.com wrote:
The post on different types of inheritence... brought up a thought.
Let's say, I'm adding flexibility to a module by letting users change class
behaviors by adding different mix-in classes.
What should happen
On Fri, May 22, 2015 at 1:34 PM, MRAB pyt...@mrabarnett.plus.com wrote:
On 2015-05-22 20:14, Laura Creighton wrote:
The first time you discover that in javascript typeof(null) is 'object'
and
not 'null' you will scream. I wonder how many home versions of typeof
to replace the system one
On Fri, May 22, 2015 at 2:55 PM, Tim Chase
python.l...@tim.thechases.com wrote:
I've wondered this on multiple occasions, as I've wanted to just make
an attribute bag and have to do something like
class AttrBag(object): pass
ab = AttrBag()
ab.x = 42
ab.y = some other value
because
On Fri, May 22, 2015 at 10:30 PM, Michael Torrie torr...@gmail.com wrote:
On 05/22/2015 10:10 PM, Ian Kelly wrote:
Sure it is. Without some prior reason to trust the certificate, the
certificate is meaningless. How is the browser to distinguish between
a legitimate self-signed cert and a self
On Fri, May 22, 2015 at 10:20 PM, Ben Finney ben+pyt...@benfinney.id.au wrote:
Ian Kelly ian.g.ke...@gmail.com writes:
On Fri, May 22, 2015 at 9:31 PM, Michael Torrie torr...@gmail.com wrote:
On 05/22/2015 07:54 PM, Terry Reedy wrote:
On 5/22/2015 5:40 PM, Tim Daneliuk wrote:
Lo
On Fri, May 22, 2015 at 9:31 PM, Michael Torrie torr...@gmail.com wrote:
On 05/22/2015 07:54 PM, Terry Reedy wrote:
On 5/22/2015 5:40 PM, Tim Daneliuk wrote:
Lo these many years ago, I argued that Python is a whole lot more than
a programming language:
On Fri, May 22, 2015 at 10:59 AM, georgeryo...@gmail.com wrote:
[python 2.7]
I need to use a configparser that is case-sensitive for option names, but
does not do magical interpolation of percent sign.
I.e.:
[Mapping0]
backupHost = eng%26
dbNode = v_br_node0001
should be read (and
On May 21, 2015 12:41 AM, Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote:
Am 20.05.2015 um 18:44 schrieb Robin Becker:
not really, it's just normal to keep event routines short; the routine
which beeps is after detection of the cat's entrance into the
On Thu, May 21, 2015 at 4:31 PM, Ben Finney ben+pyt...@benfinney.id.au wrote:
{foo:d}.format(foo=foo)
'4567'
{foo:b}.format(foo=foo)
'1000111010111'
Which since there's nothing else in the format string can be simplified to:
format(foo, b)
'1000111010111'
--
On Wed, May 20, 2015 at 7:02 AM, AKHIL RANA akh...@iitk.ac.in wrote:
Hi,
I am student at IIT Kanpur and working on a Opencv based Python project. I
am working on program development which takes less time to execute. For that
i have tested my small program hello word on python to now the time
On Wed, May 20, 2015 at 9:48 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote:
Or measure the actual CPU clock cycles taken instead of the wall clock run
time.
Then you should get a fairly constant number, if the program does the same
work every
time you run it.
phobos:~ irmen$ time python
On Wed, May 20, 2015 at 1:51 PM, Mario Figueiredo mar...@gmail.com wrote:
On Wed, 20 May 2015 03:07:03 +1000, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Yes, a slice can be expensive, if you have (say) a ten billion element list,
and take a slice list[1:].
Since nothing seems
On Tue, May 19, 2015 at 7:10 PM, Gregory Ewing
greg.ew...@canterbury.ac.nz wrote:
On Tue, May 19, 2015 at 8:54 AM, Chris Angelico ros...@gmail.com
mailto:ros...@gmail.com wrote:
On Linux (and possibly some other Unixes), /proc/self/fd may be of
use.
On MacOSX, /dev/fd seems to be
On Wed, May 20, 2015 at 12:54 PM, Cecil Westerhof ce...@decebal.nl wrote:
Op Wednesday 20 May 2015 19:03 CEST schreef Zachary Ware:
try:
import tkinter as tk
from tkinter import ttk
except ImportError:
import Tkinter as tk
import ttk
When there goes something wrong with:
from tkinter
On May 19, 2015 4:16 AM, Serhiy Storchaka storch...@gmail.com wrote:
On 19.05.15 12:45, Steven D'Aprano wrote:
On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote:
From the above link it seems slices work in linear time on all cases.
I wouldn't trust that is always the case, e.g.
On Tue, May 19, 2015 at 8:44 AM, Cecil Westerhof ce...@decebal.nl wrote:
I looked at the documentation. Is it necessary to do a:
p.wait()
afterwards?
It's good practice to clean up zombie processes by waiting on them,
but they will also get cleaned up when your script exits.
--
On Mon, May 18, 2015 at 1:23 PM, Mario Figueiredo mar...@gmail.com wrote:
I'd like to understand what I'm being told about slices in
https://wiki.python.org/moin/TimeComplexity
Particularly, what's a 'del slice' and a 'set slice' and whether this
information pertains to both CPython 2.7 and
On Sat, May 16, 2015 at 10:22 AM, bruceg113...@gmail.com wrote:
# Chris's Approach
#
lines = ss.split(\n)
new_text = \n.join(line[8:] for line in lines)
Looks like the approach you have may be fast enough already, but I'd
wager the generator expression could be replaced
On Fri, May 15, 2015 at 6:43 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
How much time would it save? Probably very little. After all, unless the
method call itself did bugger-all work, the time to create the method
object is probably insignificant. But it's a possible
On Fri, May 15, 2015 at 9:00 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Fri, May 15, 2015 at 6:43 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
How much time would it save? Probably very little. After all, unless the
method call itself did bugger-all work, the time
On Thu, May 14, 2015 at 12:06 PM, Billy Earney billy.ear...@gmail.com wrote:
Hello friends:
I saw the following example at
http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments
and did not believe the output produced and had to try it for myself
See also
On May 14, 2015 7:55 PM, Chris Angelico ros...@gmail.com wrote:
(Though when
it comes to the bikeshedding phase, I'm sure there'll be some who say
if it can't be trashed, just hard delete it, and others who say if
it can't be trashed, raise an exception. And neither is truly wrong.)
The
On Wed, May 13, 2015 at 8:42 AM, andrew cooke and...@acooke.org wrote:
On Wednesday, 13 May 2015 11:36:12 UTC-3, Thomas Rachel wrote:
Am 13.05.2015 um 15:25 schrieb andrew cooke:
class Foo:
... def __new__(cls, *args, **kargs):
... print('new', args, kargs)
...
On Wed, May 13, 2015 at 8:45 AM, andrew cooke and...@acooke.org wrote:
class Foo:
... def __new__(cls, *args, **kargs):
... print('new', args, kargs)
... super().__new__(cls)
...
class Bar(Foo):
... def __init__(self, a):
... print('init', a)
...
Bar(1)
On Wed, May 13, 2015 at 12:07 PM, zipher dreamingforw...@gmail.com wrote:
On Wednesday, May 13, 2015 at 10:27:23 AM UTC-5, Ian wrote:
I don't know why I'm replying to this...
Because you're trying to get an answer to a question that even Academia
hasn't answered or understood.
On Wed, May
I don't know why I'm replying to this...
On Wed, May 13, 2015 at 8:44 AM, zipher dreamingforw...@gmail.com wrote:
On Tuesday, May 12, 2015 at 10:35:29 PM UTC-5, Rustom Mody wrote:
How history U-turns!!
Lisp actually got every major/fundamental thing wrong
- variables scopes were dynamic by
On Tue, May 12, 2015 at 1:29 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, May 13, 2015 at 5:13 AM, zljubisic...@gmail.com wrote:
If I find an error in command line parameters section I cannot call function
usage() because it is not defined yet.
I have few options here:
1. Put
On Tue, May 12, 2015 at 9:34 AM, zipher dreamingforw...@gmail.com wrote:
* when it comes to built-in functions (e.g. sum, map, pow)
and types (e.g. int, str, list) there are significant and
important use-cases for allowing shadowing;
Name one significant and important use case for
On Tue, May 12, 2015 at 9:11 PM, zipher dreamingforw...@gmail.com wrote:
I know. That's because most people have fallen off the path
(http://c2.com/cgi/wiki?OneTruePath).
You wrote that, didn't you? I recognize that combination of delusional
narcissism and curious obsession with Turing
On Sun, May 10, 2015 at 7:39 PM, zipher dreamingforw...@gmail.com wrote:
Similarly, you'd want:
encode(codestr)
to instantiate all objects in the codestr. You can't do this with eval,
because it doesn't allow assignment (eval(n=2) returns InvalidSyntax).
Is exec what you're looking for?
On Sun, May 10, 2015 at 9:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Sun, May 10, 2015 at 7:39 PM, zipher dreamingforw...@gmail.com wrote:
Similarly, you'd want:
encode(codestr)
to instantiate all objects in the codestr. You can't do this with eval,
because it doesn't allow
On Sun, May 10, 2015 at 3:16 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Scheme is my favorite language. I think, however, it is a pretty
advanced language and requires a pretty solid basis in programming and
computer science.
Python, in contrast, is a great introductory programming language.
On Sun, May 10, 2015 at 10:34 AM, Mark Rosenblitt-Janssen
dreamingforw...@gmail.com wrote:
Here's something that might be wrong in Python (tried on v2.7):
class int(str): pass
This defines a new class named int that is a subclass of str. It has
no relation to the builtin class int.
int(3)
On Sun, May 10, 2015 at 10:14 AM, Peter Otten __pete...@web.de wrote:
When there was an actual speed-up I also had a look at
PyEval_GetGlobals/Locals() which in turn call
PyEval_GetFrame()
and
PyEvalPyFrame_FastToLocalsWithError()
whatever these do. (The first function reminded me of
On Fri, May 8, 2015 at 9:50 AM, Michael Welle mwe012...@gmx.net wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
If your language uses late binding, it is very inconvenient to get early
binding when you want it. But if your language uses early binding, it is
very simple to
On Sat, May 9, 2015 at 12:30 PM, Antranig Vartanian
antra...@pingvinashen.am wrote:
Hay,
I learned the basics of python using the book Think Python
(http://www.greenteapress.com/thinkpython/) which was good (IMHO), and it
teaches in Python 2.7. Now I'm trying to write my first python+gtk
On May 8, 2015 9:46 AM, Tommy C tommyc168...@gmail.com wrote:
I'm trying to apply OOP in this bouncing ball code in order to have
multiple balls bouncing around the screen. The objective of this code is to
create a method called settings, which controls all the settings for the
screen and the
On May 8, 2015 9:26 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Do you think that Python will re-compile the body of the function every
time
you call it? Setting the default is part of the process of compiling the
function.
To be a bit pedantic, that's not accurate. The
On Thu, May 7, 2015 at 8:03 AM, Chris Angelico ros...@gmail.com wrote:
On Thu, May 7, 2015 at 11:44 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Whole programming cultures, idioms and right ways differ between
platforms. What's the right way to write a service (daemon)? That's
probably
On Tue, May 5, 2015 at 7:27 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Only the minimum is statistically useful.
I disagree. The minimum tells you how fast the code *can* run, under
optimal circumstances. The mean tells you how fast it *realistically*
runs, under typical
On Wed, May 6, 2015 at 12:22 PM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2015-05-06 19:08, MRAB wrote:
You could tell it to quote any value that's not a number:
w = csv.DictWriter(f, pol_keys,
quoting=csv.QUOTE_NONNUMERIC)
It looks like all of the values you have are
On Wed, May 6, 2015 at 1:08 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Wednesday 06 May 2015 15:58, Ian Kelly wrote:
On Tue, May 5, 2015 at 7:27 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Only the minimum is statistically useful.
I disagree
On Wed, May 6, 2015 at 9:12 AM, Paul Rubin no.email@nospam.invalid wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
Multiplying upwards seems to be more expensive than multiplying
downwards... I can only guess that it has something to do with the way
multiplication is
On May 5, 2015 5:46 AM, Cecil Westerhof ce...@decebal.nl wrote:
Op Tuesday 5 May 2015 12:41 CEST schreef Steven D'Aprano:
# Untested.
def get_message_slice(message_filename, start=0, end=None, step=1):
real_file = expanduser(message_filename)
messages = []
# FIXME: I assume this is
On Tue, May 5, 2015 at 9:22 AM, Paul Moore p.f.mo...@gmail.com wrote:
I'm working my way through the asyncio documentation. I have got to the
Tasks and coroutines section, but I'm frankly confused as to the difference
between the various things described in that section: coroutines, tasks,
On Tue, May 5, 2015 at 12:45 PM, Dave Angel da...@davea.name wrote:
When the simple is True, the function takes noticeably and consistently
longer. For example, it might take 116 instead of 109 seconds. For the
same counts, your code took 111.
I can't replicate this. What version of Python
On Tue, May 5, 2015 at 3:23 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Tue, May 5, 2015 at 3:00 PM, Dave Angel da...@davea.name wrote:
def loop(func, funcname, arg):
start = time.time()
for i in range(repeats):
func(arg, True)
print({0}({1}) took {2:7.4}.format
On Tue, May 5, 2015 at 3:00 PM, Dave Angel da...@davea.name wrote:
def loop(func, funcname, arg):
start = time.time()
for i in range(repeats):
func(arg, True)
print({0}({1}) took {2:7.4}.format(funcname, arg, time.time()-start))
start = time.time()
for i in
On Mon, May 4, 2015 at 9:17 AM, Peter Otten __pete...@web.de wrote:
OK, you convinced me. Then I tried:
with open(tmp.txt, wb) as f: f.write(0\r\n3\r5\n7)
...
assert len(open(tmp.txt, rb).read()) == 8
f = open(tmp.txt, rU)
f.readline()
'0\n'
f.newlines
f.tell()
3
f.newlines
'\r\n'
On Mon, May 4, 2015 at 9:20 AM, Cecil Westerhof ce...@decebal.nl wrote:
Potential dangerous bug introduced by programming in Python as if it
was C/Java. :-(
I used:
++tries
that has to be:
tries += 1
Are there other things I have to be careful on? That does not work as
in C/Java,
On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
On 04/05/2015 16:20, Cecil Westerhof wrote:
Potential dangerous bug introduced by programming in Python as if it
was C/Java. :-(
I used:
++tries
that has to be:
tries += 1
Are there other things I
On Mon, May 4, 2015 at 12:59 PM, Cecil Westerhof ce...@decebal.nl wrote:
I want to change an old Bash script to Python. When I look at:
https://docs.python.org/2/library/email-examples.html
Then from and to have to be used two times? Why is that?
Once to construct the message headers, and
On Sat, May 2, 2015 at 4:35 AM, Dave Angel da...@davea.name wrote:
I can't see how that is worth doing. The recursive version is already a
distortion of the definition of factorial that I learned. And to force it
to be recursive and also contort it so it does the operations in the same
order
On Sat, May 2, 2015 at 5:42 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Christian Gollwitzer aurio...@gmx.de:
That's why I still think it is a microoptimization, which helps only
in some specific cases.
It isn't done for performance. It's done to avoid a stack overflow
exception.
If your
On Sat, May 2, 2015 at 9:53 AM, Joonas Liik liik.joo...@gmail.com wrote:
Top-posting is heavily frowned at on this list, so please don't do it.
Balancing of trees is kind of irrelevant when tree means search space
no?
I think it's relatively rare that DFS is truly the best algorithm for
such
On Sat, May 2, 2015 at 9:55 AM, Chris Angelico ros...@gmail.com wrote:
On Sun, May 3, 2015 at 1:45 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Sat, May 2, 2015 at 5:42 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Christian Gollwitzer aurio...@gmx.de:
That's why I still think
On Sat, May 2, 2015 at 1:51 PM, BartC b...@freeuk.com wrote:
On 02/05/2015 20:15, Mark Lawrence wrote:
On 02/05/2015 19:34, BartC wrote:
OK, so it's the programmer's fault if as fundamental a concept as a
for-loop ranging over integers is implemented inefficiently. He has to
transform it
On Sat, May 2, 2015 at 3:28 PM, Tony the Tiger tony@tiger.invalid wrote:
On Fri, 01 May 2015 14:42:04 +1000, Steven D'Aprano wrote:
use l as a variable name, as it looks too much like 1
If you use a better font, they are very different. Besides, a variable
name cannot start with a digit (nor
On Sat, May 2, 2015 at 7:57 PM, Tim Chase python.l...@tim.thechases.com wrote:
So it sounds like you have to request such a mark-and-sweep from
the gc module.
You *can* request it. But as long as it hasn't been explicitly
disabled (by calling gc.disable()), the mark-and-sweep garbage
collection
On Sat, May 2, 2015 at 2:17 PM, Tim Chase python.l...@tim.thechases.com wrote:
If you know that you're creating such cyclical structures, it's best
to manually unlink them before freeing them:
lst = []
lst.append(lst) # create the cycle
lst[:] = [] # break the cycle
# or
On Sat, May 2, 2015 at 5:51 PM, Terry Reedy tjre...@udel.edu wrote:
On 5/2/2015 5:31 PM, Ian Kelly wrote:
Would it have been better if range() had been implemented as xrange()
from the beginning? Sure, that would have been great. Except for one
small detail: the iterator protocol didn't exist
On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Rather than 10**7, how about trying (10**500 + 2). Is it happy?
Using the Python code from Wikipedia:
https://en.wikipedia.org/wiki/Happy_number
SQUARE = dict([(c, int(c)**2) for c in 0123456789])
On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof ce...@decebal.nl wrote:
I implemented happy_number function:
_happy_set = { '1' }
_unhappy_set= set()
def happy_number(n):
Check if a number is a happy number
On Thu, Apr 30, 2015 at 10:07 AM, Tim jtim.arn...@gmail.com wrote:
I noticed this today, using Python2.7 or 3.4, and wondered if it is
implementation dependent:
You can use 'extend' to add set elements to a list and use 'update' to add
list elements to a set.
It's not implementation
On Wed, Apr 29, 2015 at 12:06 AM, Cecil Westerhof ce...@decebal.nl wrote:
Op Monday 27 Apr 2015 22:35 CEST schreef Albert-Jan Roskam:
def some_func(arg, _memoize={}):
try:
return _memoize[arg]
except KeyError:
result = some_expensive_operation(arg)
_memoize[arg] = result
return result
On Wed, Apr 29, 2015 at 12:24 PM, Cecil Westerhof ce...@decebal.nl wrote:
I was wondering if there is a way to do this:
for del_index in range((sieve_len // skip_count) * skip_count - 1,
skip_count - 2, -skip_count):
del
On Wed, Apr 29, 2015 at 1:03 PM, Peter Otten __pete...@web.de wrote:
I was judging from the look of your MovingAverage.
I don't like the interface, it really should take an iterable so that you
can write
list(moving_average([1,2,3], 2))
[1.5, 2.5]
The problem with this is that many use
On Wed, Apr 29, 2015 at 3:45 PM, Cecil Westerhof ce...@decebal.nl wrote:
Op Wednesday 29 Apr 2015 21:57 CEST schreef Ian Kelly:
And although it's not clear to me what this is supposed to be doing,
you probably no longer need the middle term if the intention is to
continue deleting all the way
On Wed, Apr 29, 2015 at 6:01 PM, Cecil Westerhof ce...@decebal.nl wrote:
Op Thursday 30 Apr 2015 00:38 CEST schreef Ian Kelly:
In that case you can definitely omit the middle term of the slice,
which will be both more concise and clearer in intent, though
probably not significantly faster
On Wed, Apr 29, 2015 at 6:11 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Thu, 30 Apr 2015 05:57 am, Ian Kelly wrote:
On Wed, Apr 29, 2015 at 12:24 PM, Cecil Westerhof ce...@decebal.nl
wrote:
I was wondering if there is a way to do this:
for del_index
1001 - 1100 of 3469 matches
Mail list logo