I see you are using Python 2
correct
Firstly, in Python 2, the compiler assumes that the source code is encoded in
ASCII
gar, i must have been looking at doc for v3, as i thought it was all assumed to
be utf8
# -*- coding: utf-8 -*-
okay, did that, still no change
you need to use u ...
David M. Cotter wrote:
Steven wrote:
I see you are using Python 2
correct
It's hard to say what *exactly* is happening here, because you don't explain
how the python print statement somehow gets into your C++ Log code. Do I
guess right that it catches stdout?
yes, i'm redirecting stdout to
snarf wrote:
Greetings,
As I tread through my journey of OO I am trying to determine if there is a
good approach for exception handling within classes.
From my readings and gatherings - it seems I have found a common theme, but I
am trying to solicit from the experts.
Here is what I
On Fri, Aug 23, 2013 at 9:30 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Is there a fast way to convert a Decimal into a pair of numbers numerator/
denominator? It *must* be exact, but it doesn't have to be simplest form.
For example, Decimal(0.5) = (5, 10) would be okay,
On Sat, Aug 24, 2013 at 1:37 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
I time this function at about 33% faster than your version for a
six-digit decimal, and almost 50% faster for a 12-digit decimal. My
guess would be because it's not calling str() on every individual
digit.
def
Peter Otten wrote:
Ian Simcock wrote:
Greetings all.
I'm using Python 2.7 under Windows and am trying to run a command line
program and process the programs output as it is running. A number of
web searches have indicated that the following code would work.
import subprocess
p =
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[...]
* Seems like exception handing within Classes is largely avoided and is
typically only used when calling external libraries.
There is certainly no rule avoid exceptions inside classes. Methods
often raise exceptions to signal an error,
Hello All,
I am simply fetching data from robots.txt of a url. Below is my code.
siteurl = siteurl.rstrip(/)
--
http://mail.python.org/mailman/listinfo/python-list
On Saturday, August 24, 2013 4:15:01 PM UTC+5:30, malhar vora wrote:
Hello All,
I am simply fetching data from robots.txt of a url. Below is my code.
siteurl = siteurl.rstrip(/)
Sorry for last complete. It was sent by mistake.
Here is my code.
siteurl = siteurl.rstrip(/)
Thank you all for the reply.
Actually yes this was a confusing question, and borne out of trying to make
a shortcut.
I didnt ask to convert the contents of var into a string.
All I needed was to get the literal equivalent var because I needed to
use it in another dict object - whose keys i named
On 23-8-2013 14:32, lightai...@gmail.com wrote:
I want to send a broadcast packet to all the computers connected to my home
router.
The following 2 lines of code do not work;
host=192.168.0.102
s.connect((host, port))
Can someone advise?
Thank you.
Use UDP (datagram) sockets. Use
Steven D'Aprano wrote:
I have a need to convert arbitrary non-complex numbers into numerator/
denominator pairs. Numbers could be ints, floats, Fractions or Decimals.
For example:
2 = (2, 1)
0.25 = (1, 4)
Fraction(2, 3) = (2, 3)
Decimal(0.5) = (1, 2)
The first three cases are easy
malhar vora wrote:
On Saturday, August 24, 2013 4:15:01 PM UTC+5:30, malhar vora wrote:
Hello All,
I am simply fetching data from robots.txt of a url. Below is my code.
siteurl = siteurl.rstrip(/)
Sorry for last complete. It was sent by mistake.
Here is my code.
siteurl
On Sat, Aug 24, 2013, at 2:45, David M. Cotter wrote:
you need to use u ... delimiters for Unicode, otherwise the results you
get are completely arbitrary and depend on the encoding of your terminal.
okay, well, i'm on a mac, and not using terminal at all. but if i
were, it would be utf8
On 08/23/2013 09:13 AM, inq1ltd wrote:
Python help,
I am running iMacros from linux/firefox
and doing most of what I want.
But, there are times when I want to do
something of the net and then back
to the iMacros script.
Are there any projects out there
that will connect python
On 24/08/2013 11:27, Steven D'Aprano wrote:
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[snip]
* Using
Exception is typically a bad. More specific the better.
Yes, you should always try to catch the specific exceptions you care
about:
# Best
except ValueError, OverflowError,
What _are_ you using?
i have scripts in a file, that i am invoking into my embedded python within a
C++ program. there is no terminal involved. the print statement has been
redirected (via sys.stdout) to my custom print class, which does not specify
encoding, so i tried the suggestion above
Hi,
My 20 csv files has string header, and first two columns are string (e.g.,
1999-01-02, 01:00:00) among the 50 columns. Other columns store numerical
values (int, or float)
I need to do data analysis for these data. For example, extract the each
month data from each of the cvs files (each
Le samedi 24 août 2013 18:47:19 UTC+2, David M. Cotter a écrit :
What _are_ you using?
i have scripts in a file, that i am invoking into my embedded python within a
C++ program. there is no terminal involved. the print statement has been
redirected (via sys.stdout) to my custom print
On 08/23/2013 09:13 AM, inq1ltd wrote:
Python help,
I am running iMacros from
linux/firefox and doing most of
what I want.
But, there are times when I want to
do something of the net and then
back to the iMacros script.
Are there any projects out there
that will
On Sat, Aug 24, 2013 at 9:47 AM, David M. Cotter m...@davecotter.com wrote:
What _are_ you using?
i have scripts in a file, that i am invoking into my embedded python within a
C++ program. there is no terminal involved. the print statement has been
redirected (via sys.stdout) to my
On 8/24/2013 6:27 AM, Steven D'Aprano wrote:
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[...]
* Seems like exception handing within Classes is largely avoided and is
typically only used when calling external libraries.
There is certainly no rule avoid exceptions inside classes. Methods
Thanks. I probably will do exactly like you suggested later on. But, those two
lines have solved the problem I had and I can work on the actual program now. I
can come back to the GUI later.
Here is what it looks like now: http://i.imgur.com/sLiSU6M.png
On Friday, August 23, 2013 7:35:53 PM
Can anyone help me for the tasks below in nltk
1. The system mustdemonstrate false positiveand false
negativeexamples
using any stemmer (Task 1.1)
2. The system mustdemonstrate the differences between
successive layers
This may be of interest to readers of this newsgroup:
Original article:
http://lnkd.in/taAFNt
Content (without links):
A new way of writing socket servers has been introduced with the Linux kernel
3.9.
It involves the ability to bind multiple listening sockets to the same port on
the same
On 24 August 2013 13:30, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
def convert(d):
sign, digits, exp = d.as_tuple()
num = int(''.join([str(digit) for digit in digits]))
if sign: num = -num
return num, 10**-exp
which is faster, but not fast enough. Any
On 25 August 2013 07:59, Tim Delaney timothy.c.dela...@gmail.com wrote:
Breakdown of the above (for 19 digits):
d.as_tuple() takes about 35% of the time.
The multiply and add takes about 55% of the time.
The exponentiation takes about 10% of the time.
Bah - sent before complete.
Since
On Sat, 24 Aug 2013 15:57:55 -0400, Terry Reedy wrote:
# Worst
except:
Don't use the last one, except maybe in the interactive interpreter,
Stick with never. except: means the same thing as except
BaseException:, except that the latter indicates a deliberate choice
rather than an
Hi Steven,
Yea this is great. Thanks for the feedback.
On Saturday, August 24, 2013 3:27:45 AM UTC-7, Steven D'Aprano wrote:
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[...]
* Seems like exception handing within Classes is largely avoided and is
typically only used when
Appreciate the feedback. I was hoping to get as much perspective as possible.
On Saturday, August 24, 2013 12:18:59 AM UTC-7, Dave Angel wrote:
snarf wrote:
Greetings,
As I tread through my journey of OO I am trying to determine if there is a
good approach for exception
Musical Notation musicdenotat...@gmail.com writes:
Is it possible to write a Turing-complete lambda function (which does
not depend on named functions) in Python?
The wording of this question is questionable. Turing completeness is not
an attribute of a function, but of a system (for example a
On Sat, Aug 24, 2013, at 12:47, David M. Cotter wrote:
What _are_ you using?
i have scripts in a file, that i am invoking into my embedded python
within a C++ program. there is no terminal involved. the print
statement has been redirected (via sys.stdout) to my custom print class,
which
This is the second part of my posting on the Turing completeness of
Python's lambda expressions. This time I am going to define a recursive
function as a lambda expression (I use lambda when I am talking about
Python's lambda expressions, and λ for the theory – λ calculus.)
Now of course it is
Steven D'Aprano wrote:
As for why None, True and False are treated differently than built-ins,
if I remember the reason why, it is because they are considered
fundamental to the inner workings of Python, unlike mere builtins like
len, map, etc. and therefore should be protected.
It's
#Linux, #Python? This this hash tag stuff is getting out of hand, don't
you think?
--
http://mail.python.org/mailman/listinfo/python-list
Hi Python Friends,
I came across an example which is as below,
var = [1, 12, 123, 1234]
var
[1, 12, 123, 1234]
var[:0]
[]
var[:0] = var
var
[1, 12, 123, 1234, 1, 12, 123, 1234]
Here in var[:0] = var we are assigning an entire list to the beginning of
itself. So shouldn't it be something
On Sat, Aug 24, 2013 at 8:52 PM, Krishnan Shankar
i.am.song...@gmail.com wrote:
Hi Python Friends,
I came across an example which is as below,
var = [1, 12, 123, 1234]
var
[1, 12, 123, 1234]
var[:0]
[]
var[:0] = var
var
[1, 12, 123, 1234, 1, 12, 123, 1234]
Here in var[:0] = var we
On Sat, Aug 24, 2013 at 7:08 PM, Michael Torrie torr...@gmail.com wrote:
#Linux, #Python? This this hash tag stuff is getting out of hand, don't
you think?
Didn't you hear? In an effort to redefine itself for the modern
Internet, Usenet is adding support for hash tags and limiting posts to
140
On 08/24/2013 10:06 PM, Benjamin Kaplan wrote:
On Sat, Aug 24, 2013 at 7:08 PM, Michael Torrie torr...@gmail.com wrote:
#Linux, #Python? This this hash tag stuff is getting out of hand, don't
you think?
Didn't you hear? In an effort to redefine itself for the modern
Internet, Usenet is
On Sun, 25 Aug 2013 09:22:27 +0530, Krishnan Shankar wrote:
Hi Python Friends,
I came across an example which is as below,
var = [1, 12, 123, 1234]
var
[1, 12, 123, 1234]
var[:0]
[]
var[:0] = var
var
[1, 12, 123, 1234, 1, 12, 123, 1234]
Here in var[:0] = var we are assigning an
I am unable to check homogeneity of Array.
I have take Array type Int to be default for my code.
Instead of getting Error on NON-INT Values.
I want to take input as string.
Then check if all input is in (0-9) form, I typecast it into int and Accept.
Else, I would like to skip that input.
eg. my
Changes by Martin Panter vadmium...@gmail.com:
--
nosy: +vadmium
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15125
___
___
Python-bugs-list
Changes by Martin Panter vadmium...@gmail.com:
--
nosy: +vadmium
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17974
___
___
Python-bugs-list
Nick Coghlan added the comment:
Using tulip-inspired method names (when tulip hasn't landed) to duplicate
existing data input functionality (feed() and close()) seems a rather dubious
design decision to me.
Given how popular lxml.etree is as an alternative to the standard library's
etree
Armin Rigo added the comment:
@Serhiy: it's a behavior change and as such not an option for a micro release.
For example, the following legal code would behave differently: it would
compute s = '\\u1234' instead of s = 'UTF8:\xe1\x88\xb4'.
try:
s = repr(x)
except
Martin Panter added the comment:
I was surprised to discover that “option straddling” doesn’t work this way with
nargs=*. It seems to work fine with most other kinds of positional arguments
I have tried, and I imagine that this was by design rather than accident. Many
Gnu CLI programs also
Martin Panter added the comment:
It sounds like this bug might cover Issue 15112, which is only concerned with
options between different positional parameters.
--
nosy: +vadmium
___
Python tracker rep...@bugs.python.org
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +scoder
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17410
___
___
Python-bugs-list
Charles-François Natali added the comment:
Here's a patch.
Note that I'm still not sure whether it belong to the socket module or
test.support.
--
keywords: +needs review, patch
stage: needs patch - patch review
versions: +Python 3.4
Added file:
Michele Orrù added the comment:
Ping.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18538
___
___
Python-bugs-list mailing list
Unsubscribe:
STINNER Victor added the comment:
On Linux, many tests of test_socket are failing with the pure Python
implementation.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18643
___
Charles-François Natali added the comment:
On Linux, many tests of test_socket are failing with the pure Python
implementation.
The only failing tests I see are due to the fact that the Python
implementation uses AF_INET instead of AF_UNIX, which is normal since
Windows doesn't have AF_UNIX.
New submission from Sworddragon:
On configuring a logger with logging.basicConfig() and using
logging.exception() the traceback is always written implicitly to the end. This
makes it not possible to create a formation that writes something beyond the
traceback. For example it could be
New submission from Sworddragon:
For logging.exception() and similar variants the msg argument must be passed
but on a formation the LogRecord message is not mandatory. In this case
wouldn't it be better to make the msg argument optional? At default it could be
None or ''.
--
Francisco Freire added the comment:
Thanks for the review. I corrected some issues in my code. Here is the new
patch.
--
Added file: http://bugs.python.org/file31453/mywork2.patch
___
Python tracker rep...@bugs.python.org
Charles-François Natali added the comment:
Alright, I've updated the patch to have a distinct selectors module,
and with Guido's comments.
Before I post it for final review, I have three more questions:
1) In the documentation, I don't know how to best refer to files
object registered: is file
Tamas K added the comment:
After a quick glance, I can't see how this patch would fix the problem. It
still depends on threading's Thread.join, which is affected by the race
condition in __bootstrap_inner.
We already did a Thread.join before calling Py_EndInterpreter and still got
bitten by
Antoine Pitrou added the comment:
Well, that's a good point. It does bring in line subinterpreters with the main
interpreter when it comes to automatically joining non-daemon threads, but it
doesn't solve the race condition you talked about. I forgot a bit too fast
about it :-)
--
STINNER Victor added the comment:
Do you see other failures?
I applied your patch and I just replace the hasattr with:
hasattr(_socket, Xsocketpair). test_socket failures:
==
FAIL: test_sendall_interrupted
Nick Coghlan added the comment:
Reopening this as per discussion on python-dev. I haven't reverted anything at
this point, as subsequent changes mean a simple hg backout is no longer
sufficient.
--
resolution: fixed -
stage: committed/rejected - needs patch
status: closed - open
Roundup Robot added the comment:
New changeset 59f98b96607e by Nick Coghlan in branch 'default':
Close #18538: ``python -m dis`` now uses argparse.
http://hg.python.org/cpython/rev/59f98b96607e
--
nosy: +python-dev
resolution: - fixed
stage: - committed/rejected
status: open - closed
Nick Coghlan added the comment:
Reopening this - rewording the issue title to cover the problem to be solved
(i.e. accounting for RFC 6598 addresses) rather than a specific solution (which
isn't appropriate, since the RFC *explicitly* states that shared addresses and
private addresses aren't
Févry Thibault added the comment:
Ezio : Yes, I was just following Reddy's advice from another bug report (issue
18466)
Terry : Yes, looks like I was tired while doing that...
Should be fixed in the updated patch
--
Added file: http://bugs.python.org/file31454/more_typos.diff
Charles-François Natali added the comment:
New changeset fe949918616c by Antoine Pitrou in branch 'default':
Issue #18756: Improve error reporting in os.urandom() when the failure is due
to something else than /dev/urandom not existing.
http://hg.python.org/cpython/rev/fe949918616c
Charles-François Natali added the comment:
Or more precisely, just run the test in a subprocess. That should fix
the OS X failure if we don't restore the RLIMIT_NOFILE limits, and
will make the test more robust (but you can't reuse the new test,
since it won't work with lazy-opening).
Antoine Pitrou added the comment:
Here is a patch to remove the race condition. The patch is sufficiently
delicate that I'd rather reserve this for 3.4, though.
--
nosy: +neologix
Added file: http://bugs.python.org/file31455/threadstate_join.patch
Roundup Robot added the comment:
New changeset b9e62929460e by Antoine Pitrou in branch '3.3':
Issue #18756: make test_urandom_failure more robust by executing its code in a
subprocess
http://hg.python.org/cpython/rev/b9e62929460e
New changeset 68ff013b194c by Antoine Pitrou in branch
Antoine Pitrou added the comment:
Ok, the tiger should feel better now :-)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18756
___
___
Antoine Pitrou added the comment:
Since nobody seems to object to the patch, I'm commit it :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18772
___
Roundup Robot added the comment:
New changeset 2f1bac39565a by Antoine Pitrou in branch 'default':
Issue #18772: fix the gdb plugin after the set implementation changes
http://hg.python.org/cpython/rev/2f1bac39565a
--
___
Python tracker
Antoine Pitrou added the comment:
Well, it should be ok now (at least now the test passes here).
--
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18772
New submission from Donald Stufft:
I noticed today that the builtin reversed() requires an explicit sequence and
won't work with an iterator instead it throws a TypeError like:
reversed(x for x in [1, 2, 3])
TypeError: argument to reversed() must be a sequence
It would be really great if
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18826
___
___
Python-bugs-list
Antoine Pitrou added the comment:
Alright, I've updated the patch to have a distinct selectors module,
and with Guido's comments.
Didn't you forget to upload it?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16853
Donald Stufft added the comment:
As an additional note this works how I would expect it to work if you're using
sorted() instead of reversed() which I think is a stronger point in the favor
of making reversed() work this way as well.
sorted(x for x in [1, 2, 3])
[1, 2, 3]
--
Antoine Pitrou added the comment:
So, to come back to the original topic, is everyone sold on the idea of caching
the urandom fd lazily?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18756
Donald Stufft added the comment:
Lazily opening urandom and holding it open sounds like a sane thing to do to me
+1
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18756
___
STINNER Victor added the comment:
It may be related to #18408 (changeset 5bd9db528aed) and #18664.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18746
___
STINNER Victor added the comment:
See also issue #18746.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18664
___
___
Python-bugs-list mailing
Charles-François Natali added the comment:
Didn't you forget to upload it?
I wanted to have answer to my questions first :-):
Before I post it for final review, I have three more questions:
--
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
Didn't you forget to upload it?
I wanted to have answer to my questions first :-):
Ah, indeed, sorry!
1) In the documentation, I don't know how to best refer to files
object registered: is file descriptor OK, or is it too low-level?
Otherwise I'd be
Changes by paul j3 ajipa...@gmail.com:
--
nosy: +paul.j3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15112
___
___
Python-bugs-list mailing list
New submission from Alexander Schier:
Return the total number of seconds contained in the duration. Equivalent to
(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
computed with true division enabled.
Should be
Return the total number of seconds contained in the
Tim Peters added the comment:
The docs look correct to me. For example,
from datetime import *
td = datetime.now() - datetime(1,1,1)
td
datetime.timedelta(735103, 61756, 484000)
td.total_seconds()
63512960956.484
^
What the
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18582
___
___
Python-bugs-list
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17134
___
___
Python-bugs-list
Alexander Schier added the comment:
Err, sorry my fault. Too late in the evening ;).
I saw the division by one million, but not the multiplation by one million
before. Additionally i was confused, because i expected that seconds are added
to each other in the parenthesis.
closing.
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9146
___
___
Python-bugs-list
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17128
___
___
Python-bugs-list
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18233
___
___
Python-bugs-list
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14518
___
___
Python-bugs-list
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18454
___
___
Python-bugs-list
Charles-François Natali added the comment:
self.assertEqual(sock.family, socket.AF_UNIX)
AssertionError: 2 != 1
This is normal.
==
FAIL: test_sendall_interrupted (test.test_socket.GeneralModuleTests)
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8813
___
___
Python-bugs-list
Changes by Donald Stufft donald.stu...@gmail.com:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13655
___
___
Python-bugs-list
Changes by Donald Stufft don...@stufft.io:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16113
___
___
Python-bugs-list mailing
Changes by Donald Stufft don...@stufft.io:
--
nosy: +dstufft
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8106
___
___
Python-bugs-list mailing
Roundup Robot added the comment:
New changeset ffb01a6c0960 by Vinay Sajip in branch 'default':
Closes #18807: pyvenv now takes a --copies argument allowing copies instead of
symlinks even where symlinks are available and the default.
http://hg.python.org/cpython/rev/ffb01a6c0960
--
Eli Bendersky added the comment:
I like the idea of having .events() in a special target passed to a XMLParser,
which already has feed() and close(). I read through Stefan's proposal and
there are a couple of issues I wanted to raise:
1. Why have the event builder wrap a tree builder? Can't
Julien Phalip added the comment:
Thanks for the review and new patch, David! Your approach makes sense and the
patch looks good to me.
However, regarding backwards-compatibility, is that really a concern?
Currently the deserialization process systematically 1) Adds the 'httponly' and
1 - 100 of 108 matches
Mail list logo