On Sat, Nov 22, 2014 at 11:49 PM, Patrick Stinson patrickk...@gmail.com wrote:
If I create a module with imp.new_module(name), how can I unload it so that
all the references contained in it are set to zero and the module is deleted?
deleting the reference that is returned doesn’t seem to do
On Sun, Nov 23, 2014 at 2:48 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Sat, Nov 22, 2014 at 11:49 PM, Patrick Stinson patrickk...@gmail.com
wrote:
If I create a module with imp.new_module(name), how can I unload it so that
all the references contained in it are set to zero and the module
On Nov 23, 2014 4:10 AM, Patrick Stinson patrickk...@gmail.com wrote:
m = types.ModuleType('mine')
exec(s, m.__dict__)
print('deleting...')
m = None
print('done')
and the output is:
deleting...
done
__del__
I the “__del__ to come between “deleting…” and “done”. This is not being
run
On Fri, Nov 21, 2014 at 6:07 PM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
On Friday, November 21, 2014 5:59:44 PM UTC-6, Chris Angelico wrote:
In other words, what you want is:
# today's method, import based on search path
import sys
# new explicit path method
import
On Thu, Nov 20, 2014 at 8:53 PM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
FOR INSTANCE: Let's say i write a module that presents a
reusable GUI calendar widget, and then i name the module
calender.py.
Then Later, when i try to import *MY* GUI widget named
calendar, i will not get
On Thu, Nov 20, 2014 at 10:54 PM, Gill Shen gillar...@gmail.com wrote:
How is this behavior implemented under the hood? And why is this allowed at
all? Is it just a curiosity or can you do something useful with it?
Reference cycles are common in Python and other OO languages. For
example,
On Fri, Nov 21, 2014 at 9:12 AM, Tim Chase
python.l...@tim.thechases.com wrote:
The only time I've been stung by name overloading is in the indirect
case of creating a local email.py file and then importing smtplib
only to have things break in unforeseen ways. If smtplib used
relative imports
On Fri, Nov 21, 2014 at 10:39 AM, random...@fastmail.us wrote:
On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote:
Gill Shen gillar...@gmail.com:
How is this [nesting] behavior implemented under the hood?
Pointers.
And why is this allowed at all?
There's no reason not to.
There's
On Fri, Nov 21, 2014 at 11:24 AM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
Are you also going to call drivers fools because they bought
a certain brand of car only to have the airbag explode in
their face?
No, but I'll call them fools if they buy a car and the engine catches
fire
On Fri, Nov 21, 2014 at 3:25 PM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
The only exception is if you're doing import calendar from inside
the ricklib package, and you're using Python 2, and you don't have
from __future__ import absolute_import at the top of your module.
The solution
New submission from Ian Kelly:
I expect this should result in a recursion depth exceeded error, not a
segmentation fault.
$ cat test.py
import itertools
l = []
it = itertools.chain.from_iterable(l)
l.append(it)
next(it)
$ python3 test.py
Segmentation fault (core dumped)
--
components
On Thu, Nov 20, 2014 at 10:42 AM, random...@fastmail.us wrote:
and it means you can't safely
blindly use %s with an unknown object.
You can't safely do this anyway. Whether it's %s with a str and a
unicode, or %s with a unicode and a str, *something* is going to have
to be implicitly encoded
On Thu, Nov 20, 2014 at 11:06 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Thu, Nov 20, 2014 at 10:42 AM, random...@fastmail.us wrote:
and it means you can't safely
blindly use %s with an unknown object.
You can't safely do this anyway. Whether it's %s with a str and a
unicode, or %s
On Thu, Nov 20, 2014 at 12:02 PM, Stefan Behnel stefan...@behnel.de wrote:
There's also the E-factory for creating (sub-)trees and a nicely objectish
way:
http://lxml.de/lxmlhtml.html#creating-html-with-the-e-factory
That looks ugly with all those caps and also hard to extend. Notably
it
On Thu, Nov 20, 2014 at 1:13 PM, Dave Angel da...@davea.name wrote:
dave em daveandem2...@gmail.com Wrote in message:
1. In the factorial() function we call the CPU_Percent() function and write
the CPU utilization value to a file.
- Is this a correct value or will the CPU utilization below
On Thu, Nov 20, 2014 at 1:10 PM, Stefan Behnel stefan...@behnel.de wrote:
Ian Kelly schrieb am 20.11.2014 um 20:44:
On Thu, Nov 20, 2014 at 12:02 PM, Stefan Behnel wrote:
There's also the E-factory for creating (sub-)trees and a nicely objectish
way:
http://lxml.de/lxmlhtml.html#creating
On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel da...@davea.name wrote:
Ian Kelly ian.g.ke...@gmail.com Wrote in message:
On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote:
In a module that might get tangled in a cycle, avoid global code
that depends on other modules. Instead
On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel da...@davea.name wrote:
Charles T. Smith cts.private.ya...@gmail.com Wrote in message:
Well, I guess that's the definitive answer... the tips for delaying
import are good, I'll try to leverage them.
I was hoping there would be a way to have python
On Sun, Nov 16, 2014 at 3:39 AM, Vito De Tullio vito.detul...@gmail.com wrote:
for the right time you can choose to spin a thread and wait to the end of
the load of the module
Yuck. Just add threads is /not/ the answer to everything.
This case looks fairly harmless on the surface, although I
On Sun, Nov 16, 2014 at 1:07 PM, ryguy7272 ryanshu...@gmail.com wrote:
When I type 'import math', it seems like my Python recognizes this library.
Great. When I try to run the following script, I get an error, which
suggests (to me) the math library is not working correctly.
Script:
On Sun, Nov 16, 2014 at 12:36 PM, Abdul Abdul abdul.s...@gmail.com wrote:
My question is, where did PIL go here? Can a module have another module
inside it?
Yes, a module that contains other modules is usually called a package.
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Nov 16, 2014 at 2:45 PM, Abdul Abdul abdul.s...@gmail.com wrote:
I just came across the following line of code:
outputfile = os.path.splitext(infile)[0] + .jpg
Can you kindly explain to me what those parts mean?
import os.path
help(os.path.splitext)
Help on function splitext in
On Sun, Nov 16, 2014 at 2:32 PM, Abdul Abdul abdul.s...@gmail.com wrote:
Hello,
I'm walking through an example that goes as follows:
from PIL import Image
import os
for inputfile in filelist
outputfile = os.path.splitext(inputfile)[0]+.jpg
if inputfile != outputfile:
On Sun, Nov 16, 2014 at 4:22 PM, Terry Reedy tjre...@udel.edu wrote:
If pylint sees 'map(lambda ...: ', it would be appropriate to suggest using
a comprehension or generator expression instead. This avoids the unneeded
creation and repeated call of a new function.
There's actually a separate
On Sun, Nov 16, 2014 at 1:39 PM, ryguy7272 ryanshu...@gmail.com wrote:
Anyway, I open the cmd window, and typed this: 'easy_install python
graphics'. So, it starts up and runs/downloads the appropriate library from
the web. I get confirmation (in the cmd window) that it finishes, then I try
On Sat, Nov 15, 2014 at 10:07 AM, ast nom...@invalid.com wrote:
Hi
I needed a function f(x) which looks like sinus(2pi.x) but faster.
I wrote this one:
--
from math import floor
def sinusLite(x):
x = x - floor(x)
return -16*(x-0.25)**2 + 1 if x 0.5 else
On Fri, Nov 14, 2014 at 12:36 AM, Cameron Simpson c...@zip.com.au wrote:
On 13Nov2014 15:48, satishmlm...@gmail.com satishmlm...@gmail.com wrote:
import sys
for stream in (sys.stdin, sys.stdout, sys.stderr):
print(stream.fileno())
io.UnsupportedOperation: fileno
Is there a
On Fri, Nov 14, 2014 at 4:37 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Ethan Furman wrote:
There's no way to make the CONFUSED status be handled without actually
changing the code. The difference is that this version will not
incorrectly treat CONFUSED as WARNING; it
On Fri, Nov 14, 2014 at 3:17 PM, Richard Riehle rrie...@itu.edu wrote:
In C, C++, Ada, and functional languages, I can create an array of functions,
albeit with the nastiness of pointers in the C family. For example, an
array of functions where each function is an active button, or an array
On Thu, Nov 13, 2014 at 11:32 AM, Ethan Furman et...@stoneleaf.us wrote:
On 11/12/2014 01:51 PM, Ian Kelly wrote:
On Wed, Nov 12, 2014 at 2:33 PM, Chris Kaynor wrote:
A decorator is an interesting idea, and should be easy to implement (only
lightly tested):
def main(func):
if func
On Thu, Nov 13, 2014 at 1:44 PM, Skip Montanaro
skip.montan...@gmail.com wrote:
On Thu, Nov 13, 2014 at 2:33 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
... other things decorated with atexit.register
might actually be called before the main function
I don't think that will happen. The atexit
On Thu, Nov 13, 2014 at 1:53 PM, Skip Montanaro
skip.montan...@gmail.com wrote:
On Thu, Nov 13, 2014 at 2:44 PM, Skip Montanaro
skip.montan...@gmail.com wrote:
What's not documented is
the behavior of calling atexit.register() while atexit._run_exitfuncs
is running. That's an implementation
On Wed, Nov 12, 2014 at 8:33 AM, Fabio Zadrozny fabi...@gmail.com wrote:
As a reference, I recently found a blog post related to that:
http://lucumr.pocoo.org/2014/8/16/the-python-i-would-like-to-see/ (the Slots
part comments on that).
It does seem a bit counter-intuitive that this happens
On Wed, Nov 12, 2014 at 2:33 PM, Chris Kaynor ckay...@zindagigames.com wrote:
A decorator is an interesting idea, and should be easy to implement (only
lightly tested):
def main(func):
if func.__module__ == __main__:
func()
return func # The return could be omitted to
On Wed, Nov 12, 2014 at 2:56 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Ethan Furman et...@stoneleaf.us:
On 11/12/2014 01:41 PM, Marko Rauhamaa wrote:
Or I might indicate the exhaustion of possibilities:
if status == OK:
...
elif status == ERROR:
...
On Wed, Nov 12, 2014 at 3:04 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Wed, Nov 12, 2014 at 2:56 PM, Marko Rauhamaa ma...@pacujo.net wrote:
How would it be better if you removed the assert then?
You don't need to remove it. Just reorganize it to make sure it
indicates actual exhaustion
On Wed, Nov 12, 2014 at 3:09 PM, Chris Kaynor ckay...@zindagigames.com wrote:
I was thinking along the lines of replacing:
if __name__ == __main__:
block of code
with
@main
def myFunction()
block of code
Both blocks of code will be called at the same time.
99% of the time the
On Wed, Nov 12, 2014 at 3:13 PM, Anton anschat...@gmail.com wrote:
On Wednesday, November 12, 2014 2:05:17 PM UTC-8, Ian wrote:
You don't need to remove it. Just reorganize it to make sure it
indicates actual exhaustion of possibilities. E.g. using the assert
False pattern from your post:
if
On Wed, Nov 12, 2014 at 3:48 PM, Anton anschat...@gmail.com wrote:
On Wednesday, November 12, 2014 2:42:19 PM UTC-8, Ian wrote:
On Wed, Nov 12, 2014 at 3:13 PM, Anton an...@gmail.com wrote:
If the code is run optimized and asserts are ignore CONFUSED statement
would still not be handled and
On Wed, Nov 12, 2014 at 3:47 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Ian Kelly ian.g.ke...@gmail.com:
Although to be honest I'd rather use something like raise
RuntimeError('Unreachable code reached') than assert False here. If
the expectation is that the code will never be executed
On Tue, Nov 11, 2014 at 12:44 AM, Paddy paddy3...@gmail.com wrote:
Thanks Ian. The original author states ...and it is sure that the given
inputs will give an output, i.e., the inputs will always be valid., which
could be taken as meaning that all inputs are sufficient, well formed, and
On Tue, Nov 11, 2014 at 2:21 AM, Paddy paddy3...@gmail.com wrote:
On Tuesday, 11 November 2014 09:07:14 UTC, Ian wrote:
On Tue, Nov 11, 2014 at 12:44 AM, Paddy paddyxxx-at-xmail.com wrote:
Thanks Ian. The original author states ...and it is sure that the given
inputs will give an output,
On Tue, Nov 11, 2014 at 9:53 AM, Mary-Frances McNamee
maryfrances.mcna...@epas-ltd.com wrote:
I am currently working on a bit of coding for a raspberry pi, I was
wondering maybe I could get some advice? I want my program to run for a
certain time, for example 7am-2.30am everyday. Is this
On Mon, Nov 10, 2014 at 12:19 PM, Peter Otten __pete...@web.de wrote:
I'm not sure this works. I tried:
Here's a simpler failure case.
ineq = f2 f3
... f3 f1
[Previously posted code elided]
greater_thans
set([('f3', 'f1'), ('f2', 'f3')])
sorted(all_f, cmp=lambda t1, t2: 0 if t1==t2 else
On Mon, Nov 10, 2014 at 2:45 PM, sohcahto...@gmail.com wrote:
On Monday, November 10, 2014 1:01:05 PM UTC-8, Grant Edwards wrote:
On 2014-11-10, sohcahtoa82 sohcahtoa82 wrote:
Please help me this assignment is due in an hour. Don't give me
hints, just give me the answer because I only
On Mon, Nov 10, 2014 at 8:09 PM, Paddy paddy3...@gmail.com wrote:
On Monday, 10 November 2014 18:45:15 UTC, Paddy wrote:
Hi, I do agree with
Raymond H. about the relative merits of cmp= and key= in
sort/sorted, but I
On Sat, Nov 8, 2014 at 3:31 PM, Gregory Ewing
greg.ew...@canterbury.ac.nz wrote:
(BTW, I'm actually surprised that this technique makes c callable.
There must be more going on that just look up __call__ in the class
object, because evaluating C.__call__ just returns the descriptor
and doesn't
On Sun, Nov 9, 2014 at 2:06 AM, Veek M vek.m1...@gmail.com wrote:
https://docs.python.org/3.4/library/functools.html
1. A key function is a callable that accepts one argument and returns
another value indicating the position in the desired collation sequence.
x = ['x','z','q'];
On Nov 6, 2014 1:06 AM, Rustom Mody rustompm...@gmail.com wrote:
In studying (somewhat theoretically) the general world of
collection data structures we see
- sets -- neither order nor repetition
- bags -- no order, repetition significant
- lists -- both order and repetition
Sometimes
On Nov 6, 2014 10:47 PM, Sturla Molden sturla.mol...@gmail.com wrote:
Grant Edwards invalid@invalid.invalid wrote:
According to
http://www.theregister.co.uk/2014/11/06/hackers_use_gmail_drafts_as_dead_drops_to_control_malware_bots
:
Attacks occur in two phases. Hackers first infect a
On Nov 6, 2014 10:51 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Nov 6, 2014 1:06 AM, Rustom Mody rustompm...@gmail.com wrote:
Calling a bag as counter is inappropriate for an analogous reason
to why calling a dictionary as a 'hash' is inappropriate --
it confuses an implementation
On Nov 2, 2014 5:31 AM, Denis McMahon denismfmcma...@gmail.com wrote:
And perhaps that also addresses the square - rectangle (or circle -
ellipse) issue - square, rectangle and rhombus are all forms of
quadrilateral, and perhaps should all inherit a base class Quadrilateral,
rather than trying
On Fri, Oct 31, 2014 at 7:06 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
And there are times when using getters and setters is the right choice.
Properties should only be used for quite lightweight calculations, because
attribute access is supposed to be fast. If your
On Fri, Oct 31, 2014 at 8:05 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
Because the topic of that lesson was getter setter.
I can construct an __init___ but I was practicing get/set.
Doesn't sound like a very good lesson to me. Getters and setters are
the Java way of doing things.
On Thu, Oct 30, 2014 at 11:01 AM, Rustom Mody rustompm...@gmail.com wrote:
On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote:
On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote:
On Wednesday, October 29, 2014 11:10:06 AM UTC+5:30, Zachary Ware wrote:
Of course, that's 3
On Thu, Oct 30, 2014 at 11:09 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Thu, Oct 30, 2014 at 11:01 AM, Rustom Mody rustompm...@gmail.com wrote:
On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote:
On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote:
On Wednesday
On Mon, Oct 27, 2014 at 10:17 AM, Wolfgang Maier
wolfgang.ma...@biologie.uni-freiburg.de wrote:
See
https://docs.python.org/3/library/stdtypes.html?highlight=list#common-sequence-operations
under Note 2 .
Also asked and answered multiple times at stackoverflow, e.g.,
On Sat, Oct 25, 2014 at 5:58 AM, Ned Batchelder n...@nedbatchelder.com wrote:
You mention standard Python idioms. I think this style of
conditional-via-indexing is becoming quite uncommon, and is no longer one of
the standard Python idioms. This is now in the category of outdated hack.
I
On Sat, Oct 25, 2014 at 12:46 AM, Larry Hudson
org...@yahoo.com.dmarc.invalid wrote:
name=123-xyz-abc
for x in name:
if x in range(10):
x is a character (a one-element string). range(10) is a list of ints. A
string will never match an int. BTW, as it is used here, range(10) is for
On Fri, Oct 24, 2014 at 9:56 AM, Rustom Mody rustompm...@gmail.com wrote:
Range(10) stores the min max values and loads each number in between
when needed.
It loads?? As in 'load-up-a-van'??
As in loads into memory.
When you see:
10
10
1. Does someone (a clerk maybe) in the computer
On Fri, Oct 24, 2014 at 10:37 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
If I could explain to you why something doesn't work then I could fix
it myself. I don't understand why it doesn't work. The best I can do
is repost the code.
You don't need to be able to explain why it
On Fri, Oct 24, 2014 at 11:03 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
Actually I was a little frustrated when I added that line back in as
the other lines all work.
Using list(range(10)) Doesn't throw an error but it doesn't work.
http://i.imgur.com/DTc5zoL.jpg
The interpreter.
On Fri, Oct 24, 2014 at 7:07 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info if j 10:
j += 1
else:
j = 3
or:
j = j + 1 if j 10 else 3
or:
j = (lambda: 3, lambda: j + 1)[j 10]()
Certainly not the third one. That's needlessly obfuscated for
On Fri, Oct 24, 2014 at 2:58 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
name=123-xyz-abc
for x in name:
if x in range(10):
print (Range,(x))
if x in str(range(10)):
print (String range,(x))
It doesn't throw an error but it doesn't print what you would
On Thu, Oct 23, 2014 at 1:20 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
If you were to read and digest what is written it would help. You're trying
to run IDLE. We're talking the interactive interpreter.
IDLE includes the interactive interpreter.
If (at least on
Windows) you run a
On Thu, Oct 23, 2014 at 7:44 AM, Marko Rauhamaa ma...@pacujo.net wrote:
However, the [f, g][cond]() technique is how pure lambda calculus
implements conditional branching so it is interesting in its own right.
I wasn't aware that lambda calculus had lists and indexing built in.
IOW, you can
On Thu, Oct 23, 2014 at 8:30 AM, Simon Kennedy sffjun...@gmail.com wrote:
Just out of academic interest, is there somewhere in the Python docs where
the following is explained?
https://docs.python.org/3/reference/expressions.html#booleans
3 == True
False
if 3:
print(It's Twue)
On Thu, Oct 23, 2014 at 11:07 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
BTW I forgot to add that example 2 and 3 don't seem to be too useful
in Python 3, but they are in Python 2. I don't understand how the
Python 3 is an improved version.
In Python 2, range returns a list
On Wed, Oct 22, 2014 at 5:02 AM, Peter Otten __pete...@web.de wrote:
Michiel Overtoom wrote:
On Oct 22, 2014, at 12:29, Peter Otten wrote:
That looks like log(a) while a parity check takes constant time:
$ python3 -m timeit -s 'a = 10**10' 'a 1'
Do you mean 'parity' as in
On Wed, Oct 22, 2014 at 4:43 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2014-10-22 12:29, Peter Otten wrote:
That looks like log(a) while a parity check takes constant time:
$ python3 -m timeit -s 'a = 10**10' 'a 1'
1000 loops, best of 3: 0.124 usec per loop
$ python3 -m
On Tue, Oct 21, 2014 at 2:45 AM, Simon Kennedy sffjun...@gmail.com wrote:
On Monday, 20 October 2014 18:56:05 UTC+1, Ian wrote:
Rather, I'm saying that where the blank line is should be the start of
a new function. There would still be a blank line, just no longer
inside the function.
Now,
On Mon, Oct 20, 2014 at 9:54 AM, Simon Kennedy sffjun...@gmail.com wrote:
Not having ever attempted to go beyond even the basics of Perl, the aspect
that causes me to refer to Perl 'dismissively' as well comment in this
thread, is that I don't find Perl to be an aesthetically pleasing
On Mon, Oct 20, 2014 at 11:54 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Oct 20, 2014 at 9:54 AM, Simon Kennedy sffjun...@gmail.com wrote:
Not having ever attempted to go beyond even the basics of Perl, the aspect
that causes me to refer to Perl 'dismissively' as well comment
On Mon, Oct 20, 2014 at 1:04 PM, Juan Christian
juan0christ...@gmail.com wrote:
Ok, new code using ?:
I suspect you meant to post this to some other thread.
def get_db(_id):
cursor = db.execute(SELECT ID, URL, AUTHOR, MESSAGE FROM TOPICS WHERE ID =
?, (_id))
return cursor.fetchone()
(_id)
On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
For starters I would like to know if you can make a single item list
and then turn it into a 2 item list. Is there a command for that?
You mean like this?
the_list = ['first_item']
On Mon, Oct 20, 2014 at 2:23 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly ian.g.ke...@gmail.com
wrote:
On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
For starters I would like to know if you can make
On Mon, Oct 20, 2014 at 3:25 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
I think what I am going to have to have is a master list that keeps
track of several things and I will need to change some of them so I
know that rules out tuples.
It sounds to me like what you really want is a
On Mon, Oct 20, 2014 at 5:29 PM, Mike Boyle moboyl...@outlook.com wrote:
I'm modifying an extension written with the c-api to have a datatype of
quaternions https://github.com/moble/numpy_quaternion, with one of the
goals being python 3 support. It works nicely in python 2.7, but for python
On Thu, Oct 16, 2014 at 7:44 AM, Simon Kennedy sffjun...@gmail.com wrote:
When you looked through the other answers and found a solution you're happy
with that does not use the standard library you can look through the
documentation and find a stdlib
On Wed, Oct 15, 2014 at 12:39 PM, Shiva
shivaji...@yahoo.com.dmarc.invalid wrote:
Hi,
I am trying to search a string through files in a directory - however while
Python script works on it and writes a log - I want to present the user with
count of number of strings found. So it should
On Wed, Oct 15, 2014 at 11:12 AM, Terry Reedy tjre...@udel.edu wrote:
On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote:
It should parse this as
else:
print 'false'
print 'done'
Why? Because things like `print 'done'` usually have an empty line before
it:
There is no
On Oct 15, 2014 7:04 PM, Cameron Simpson c...@zip.com.au wrote:
On 15Oct2014 16:09, Dan Stromberg drsali...@gmail.com wrote:
On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 ryanshu...@gmail.com wrote:
#1) That's very bizarre to mix single quotes and double quotes in a
single language. Does
On Mon, Oct 13, 2014 at 5:39 AM, Venugopal Reddy
venugopal.re...@tspl.com wrote:
Dear All,
How to write a program for reading or parsing the XML file in Sub root Wise.
I don't know what Sub root Wise is. You can find an overview of
Python's XML parsing interfaces at
On Sun, Oct 12, 2014 at 6:55 AM, roro codeath rorocode...@gmail.com wrote:
How to implement it in my class?
class Str(str):
def __init__(self, *args, **kwargs):
pass
Str('smth', kwarg='a')
The error is coming from the __new__ method. Because str is an
immutable type, you should
On Fri, Oct 10, 2014 at 12:31 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote:
- you need to escape the backslashes (or just use forward slashes, they work
on windows too)
Or use a raw string. There is usually no reason to have escape
sequences at all in a file system path.
--
On Oct 9, 2014 6:53 AM, Gelonida N gelon...@gmail.com wrote:
I'm using Puthon 2.7 for the given project and there sys.meta_path is [].
Just for fun I started Python3.3 and looked at it's meta_path, which
contained for example _frozen_importlib.PathFinder
Unfortunately python 2.7 does not seem
On Wed, Oct 8, 2014 at 8:34 PM, Rustom Mody rustompm...@gmail.com wrote:
On Thursday, October 9, 2014 7:12:41 AM UTC+5:30, Ben Finney wrote:
Seymore4Head writes:
I want to toggle between color=Red and color=Blue
It's good to cultivate ongoing familiarity with the standard library
And
On Wed, Oct 8, 2014 at 10:29 AM, George Trojan george.tro...@noaa.gov wrote:
This does not look right:
dilbert@gtrojan python3.4
Python 3.4.1 (default, Jul 7 2014, 15:47:25)
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux
Type help, copyright, credits or license for more information.
On Wed, Oct 8, 2014 at 3:05 PM, Gelonida N gelon...@gmail.com wrote:
On 10/8/2014 9:09 PM, Terry Reedy wrote:
On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
According to the documentation, operator.__add__ is the official
function,
and operator.add is just there for convenience.
You are
On Wed, Oct 8, 2014 at 4:53 AM, Gelonida N gelon...@gmail.com wrote:
Hi,
I just read about sys.meta_path, which allows to install custom importers
*BEFORE* the default importers.
However I have a use case where I would like to add a custom importer
*AFTER* all other import methods have
On Tue, Oct 7, 2014 at 10:15 AM, jonathan.slend...@gmail.com wrote:
Logically, I'd think it should be possible by running the input string
against the state machine that the given regex describes, and if at some
point all the input characters are consumed, it's a match. (We don't have to
On Thu, Oct 2, 2014 at 7:24 AM, Didymus lynt...@gmail.com wrote:
The '|=' operator, I read should be like a = a | b, but this appears to
add the two numbers as long as it's more than the previous:
Note that:
a = a or b
and:
a = a | b
are different operations. It sounds like
On Thu, Oct 2, 2014 at 10:33 AM, c...@isbd.net wrote:
Ah, so at least there is a reason for it, I'm far from being a
mathematician though so it's not particularly obvious (for me anyway).
You're not alone; a lot of people find the terminology not intuitive.
Even GvR has publicly lamented the
On Thu, Oct 2, 2014 at 11:34 PM, Viet Nguyen
vhnguy...@yahoo.com.dmarc.invalid wrote:
Hi,
When I am debug mode, is there some command which will help display the
source code for a Python function of interest? Much like you'd use info
proc to display contents of Tcl proc.
Thanks,
Viet
On Mon, Sep 29, 2014 at 7:52 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Whether you prefer to use setdefault, or a defaultdict, is a matter of
taste.
There is potentially a significant difference in performance -- with
setdefault, the subordinate data structure is created
On Mon, Sep 29, 2014 at 7:19 PM, alf...@54.org wrote:
I would like to add the ability to JSONEncode large iterators. Right now
there is no way to do this without modifying the code.
The JSONEncoder.default() doc string suggests to do this:
For example, to support arbitrary
On Fri, Sep 26, 2014 at 12:53 PM, Abohfu venant zinkeng
vice...@gmail.com wrote:
This site was written by a person (in 2009) who had considered this amazing
trend. He collected a lot of data about hard drive capacity and price. The
formula he extrapolated by using the data he found is
cost
On Sat, Sep 27, 2014 at 11:12 AM, Chris Angelico ros...@gmail.com wrote:
On Sun, Sep 28, 2014 at 3:01 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
As a side note, it would be handy to compare HD cost to CD cost.
I am still trying to get my own personal copy of the Internet.
If you
On Sat, Sep 27, 2014 at 5:25 PM, Milson Munakami milson...@gmail.com wrote:
I am trying to set the precondition for the test first prior to test other
test cases. But as you can see in my code the precondition print command is
not fired! Can you explain the cause and solution how to fire the
On Sat, Sep 27, 2014 at 8:47 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
http://www.theregister.co.uk/Print/2011/11/30/bbc_micro_model_b_30th_anniversary/
At the time, the BBC Micro memory was (I think) expandable: the Model B
could be upgraded to 128K of memory, double
1401 - 1500 of 3469 matches
Mail list logo