Dear all,
this is a recurring programming problem that I'm just not sure how to solve
optimally, so I thought I'd ask for your advice:
imagine you have a flag set somewhere earlier in your code, e.g.,
needs_processing = True
then in a for loop you're processing the elements of an iterable, but
Thanks Ben and Tim for these great contributions!
Shouldn't suggestions like these be added to the argparse documentation in a
recipes section?
Best,
Wolfgang
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano steve+comp.lang.python at pearwood.info writes:
# With chaining
thing = func(MyClass().spam().eggs().cheese(),
MyClass().aardvark(),
OtherClass().fe().fi().fo().fum(),
)
do_stuff_with(thing)
versus:
# Without chaining
temp1 =
Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de writes:
Steven D'Aprano steve+comp.lang.python at pearwood.info writes:
# With chaining
thing = func(MyClass().spam().eggs().cheese(),
MyClass().aardvark(),
OtherClass().fe().fi().fo().fum
Valentin Zahnd v.zahnd at gmail.com writes:
Hello
For-each does not iterate ober all entries of collection, if one
removes elements during the iteration.
Example code:
def keepByValue(self, key=None, value=[]):
for row in self.flows:
if not row[key] in value:
I want to print only key,values in Counter2 which have values then
corresponding value in Counter1.
E.g
Counter1={97:1,99:2,196:2,198:1}
Counter2={97:1 ,99:3, 196:1,198:1}
# Output
[99,3]
Try:
[[key, Counter2[key]] for key in Counter1 if Counter2[key] Counter1[key]]
for a start.
If
Mark H. Harris harrismh777 at gmail.com writes:
On Thursday, February 27, 2014 10:26:59 PM UTC-6, Chris Angelico wrote:
Create Decimal values from strings, not from the str() of a float,
which first rounds in binary and then rounds in decimal.
Thanks Chris... another excellent
Mark H. Harris harrismh777 at gmail.com writes:
If you get a chance, take a look at the dmath.py code on:
https://code.google.com/p/pythondecimallibrary/
Hi Mark,
here is an enhancement for your epx function.
Your current version comes with the disadvantage of potentially storing
Am Montag, 3. März 2014 12:34:30 UTC+1 schrieb Mark H. Harris:
hi folks,
Python Decimal Library dmath.py v0.3 Released
https://code.google.com/p/pythondecimallibrary/
This code provides the C accelerated decimal module with
scientific/transcendental functions for
On Monday, March 3, 2014 9:03:19 PM UTC+1, Mark H. Harris wrote:
On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote:
def fact(x):
fact(x)factorial{x} int x 0
return +Decimal(math.factorial(x)
to make it return a Decimal rounded to context
On Monday, March 3, 2014 10:18:37 PM UTC+1, Mark H. Harris wrote:
On Monday, March 3, 2014 2:03:19 PM UTC-6, Mark H. Harris wrote:
Wolfgang, answer is not so much, in fact, not at all.
But it is an interesting question for me; where I am
continuing to learn the limits of Decimal, and the
On 23.05.2014 05:26, Chris Angelico wrote:
On Fri, May 23, 2014 at 12:08 PM, Rustom Mody rustompm...@gmail.com wrote:
$ cat ا.py
x = 1
def foo(x): print(Hi %s!! % x)
Yeah, no thanks. I am not naming my scripts in Arabic. :)
Latin, you DID use Arabic numbers :)
Cheers,
Wolfgang
--
On 23.05.2014 11:02, Chris Angelico wrote:
On Fri, May 23, 2014 at 6:58 PM, Wolfgang Maier
wolfgang.ma...@biologie.uni-freiburg.de wrote:
Latin, you DID use Arabic numbers :)
I may have used an Arabic numeral, but I named my script very
definitely in English. Isn't it obvious? It's read one
On 25.05.2014 00:14, Robert Kern wrote:
On 2014-05-24 23:05, Luis José Novoa wrote:
Hi All,
Hope you're doing great. One quick question. I am defining an array of
sets using numpy as:
a=array([set([])]*3)
Has nothing to do with numpy, but the problem is exclusively with your
innermost
On 26.05.2014 13:27, Rustom Mody wrote:
On Monday, May 26, 2014 2:57:54 PM UTC+5:30, Radu Ioan Barbos wrote:
Greetings from Romania,sorry
for my english,i just wanted to ask you if i need any other
software/program beside the one software from the next page
https://www.python.org/downloads/
On 27.05.2014 13:39, Aman Kashyap wrote:
On 27.05.2014 14:09, Vlastimil Brom wrote:
you can just escpape the pipe with backlash like any other metacharacter:
rstart=\|ID=ter54rt543d
be sure to use the raw string notation r..., or you can double all
backslashes in the string.
Thanks for
On 28.05.2014 12:43, Sameer Rathoud wrote:
Hello everyone,
I am new to python.
I am currently using python 3.3
With python I got IDLE, but I am not very comfortable with this.
Please suggest, if we have any free ide for python development.
Seems like not too many other people on this list
wxjmfauth at gmail.com writes:
Amen.
Ite missa est.
Oh, why all the lamenting about python's unicode support, when your latin is
so superbe ! Elegant solution to all your problems :)
--
https://mail.python.org/mailman/listinfo/python-list
Tim Delaney timothy.c.delaney at gmail.com writes:
I also should have been more clear that *in the particular situation I was
talking about* iso-latin-1 as default would be the right thing to do, not in
the general case. Quite often we won't know the correct encoding until we've
executed a
Chris Angelico rosuav at gmail.com writes:
On Mon, Jun 2, 2014 at 7:02 PM, Mark Lawrence breamoreboy at
yahoo.co.uk wrote:
What is the Latin for resident unicode expert go home?
Google Translate says:
Eusebius, et revertatur in domum perito resident.
ChrisA
Oh, the joys of
On 04.06.2014 09:16, Chris Angelico wrote:
The point is
not that you might be able to get away with sticking your head in the
sand and wishing Unicode would just go away. Even if you can, it's not
something Python 3 can ever do.
Exactly. These endless discussions about different encodings
On 02.07.2014 11:05, Terry Reedy wrote:
On 7/2/2014 12:33 AM, Tim Roberts wrote:
Terry Reedy tjre...@udel.edu wrote:
You need to use
s.check_output(pyflakes c:\\programs\\python34\\lib\\turtle.py)
or
s.check_output(rpyflakes c:\programs\python34\lib\turtle.py)
Now I get Command
On 02.07.2014 19:31, Wolfgang Maier wrote:
I am not 100% sure whether that is the problem, but from what I gather
from the subprocess module docs the args string is passed to the Windows
CreateProcess function as a single string.
To me this seems to imply that it is passed as the lpCommandLine
Terry Reedy tjreedy at udel.edu writes:
On 7/2/2014 12:33 AM, Tim Roberts wrote:
Terry Reedy tjreedy at udel.edu wrote:
You need to use
s.check_output(pyflakes c:\\programs\\python34\\lib\\turtle.py)
or
s.check_output(rpyflakes c:\programs\python34\lib\turtle.py)
Now I
On 07/03/2014 06:09 AM, Terry Reedy wrote:
Yes, but what puzzled me is that running
subprocess.check_output(r'pyflakes c:\programs\python34\lib')
in the regular interpreter *does* produce output instead of the error
message. My guess is that it fills up the pipe, so that check_output
starts
On 07/03/2014 10:03 AM, Wolfgang Maier wrote:
On 07/03/2014 06:09 AM, Terry Reedy wrote:
- what is happening to the stderr output when run in IDLE ? I guess it
is caught and suppressed somewhere, but to add to your observations the
check_output call doesn't hang on IDLE, but finishes eventually
On 07/11/2014 10:32 AM, Nicholas Cannon wrote:
Hey i would like to know alot more about the standard library and all of its
functions and so on and i know it is huge and i would basically like to learn
only the useful stuff that i could use and all of those features. i have been
looking
Hi,
I'm trying to convert ISO8601-compliant strings representing dates or
dates and times into datetime.datetime objects.
I tried using the strptime method, but the problem here is that I can
only specify one format argument, which can be used to parse either a
full date/time string or just a
On 31.07.2014 15:13, Roy Smith wrote:
On Jul 31, 2014, at 8:59 AM, Skip Montanaro wrote:
On Thu, Jul 31, 2014 at 6:52 AM, Roy Smith r...@panix.com wrote:
Sadly, the stdlib datetime really doesn't make life easy for dealing
with ISO-8601. Dateutil is the classic answer, but it's slow.
A
On 08/01/2014 01:30 AM, Roy Smith wrote:
In article mailman.12480.1406833307.18130.python-l...@python.org,
Albert-Jan Roskam fo...@yahoo.com wrote:
In article mailman.12461.1406797909.18130.python-l...@python.org,
Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote:
Hi,
I'm trying
On 08/04/2014 11:53 AM, Glenn Linderman wrote:
I've never used the API from Python but random console access is
documented at
http://msdn.microsoft.com/en-us/library/windows/desktop/ms687404%28v=vs.85%29.aspx
Would using the API from Python involve doing the wrapping yourself or
do you know
On 08/04/2014 05:00 PM, Wiktor wrote:
Hi,
first, thank you all for responses. I decided to just use single line frame
around menu. Yes, those double+single line corners work fine in ConEmu, but
I don't want this Python script to be dependent on external program. Maybe
one day it will be worth
Dear all,
since a few days, when I select Help - Python Docs from the IDLE menu,
the link to the documentation that it tries to open in my browser isn't
working anymore.
The URL IDLE uses (copied from the browser address bar) is :
docs.python.org/3.4
and you have to add a terminal slash for it
On 09/17/2014 11:45 AM, Peter Otten wrote:
Wolfgang Maier wrote:
since a few days, when I select Help - Python Docs from the IDLE menu,
the link to the documentation that it tries to open in my browser isn't
working anymore.
The URL IDLE uses (copied from the browser address bar
On 09/17/2014 01:15 PM, Peter Otten wrote:
Wolfgang Maier wrote:
On 09/17/2014 11:45 AM, Peter Otten wrote:
Wolfgang Maier wrote:
since a few days, when I select Help - Python Docs from the IDLE menu,
the link to the documentation that it tries to open in my browser isn't
working anymore
On 09/23/2014 10:16 AM, blindanagram wrote:
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
I guess it is implemented this way because its main use is in the
Fraction constructor.
For example gcd(3, -7) returns -1, which means that a co-prime
On 09/23/2014 02:50 PM, Steven D'Aprano wrote:
Normally, gcd is only defined for non-negative integers. Wolfram Mathworld,
for example, doesn't mention negative values at all (as far as I can see):
http://mathworld.wolfram.com/GreatestCommonDivisor.html
although buried deep in the
Hi,
is there any reliable and inexpensive way to inspect a callable from
running Python code to learn whether it is implemented in Python or C
before calling into it ?
Thanks,
Wolfgang
--
https://mail.python.org/mailman/listinfo/python-list
On 01.10.2014 10:14, math math wrote:
Hi,
I hope there are people here with strong OOP experience.
Which classes would an object-oriented python programmer create for the design
of a e-book reader for example? I am not really interested in the code, just
the OOP classes that would come to
Hi,
I'm not a regular MacPython user, but today I had to build Mac wheels
for different versions of Python. To test the wheel files I set up a
fresh Mac OS 10.9 Mavericks and and installed Python 3.2, 3.3, 3.4 from
the python.org download page on it. Then I struggled for the rest of the
On 14.10.2014 22:30, Ned Deily wrote:
In article m1juu7$tmn$1...@ger.gmane.org,
Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote:
I'm not a regular MacPython user, but today I had to build Mac wheels
for different versions of Python. To test the wheel files I set up a
fresh Mac OS
On 10/23/2014 04:30 PM, Simon Kennedy wrote:
Just out of academic interest, is there somewhere in the Python docs where the
following is explained?
https://docs.python.org/3/library/stdtypes.html#truth-value-testing
3 == True
False
as opposed to:
On 10/23/2014 04:47 PM, Alain Ketterlin wrote:
Simon Kennedy sffjun...@gmail.com writes:
Just out of academic interest, is there somewhere in the Python docs where the
following is explained?
3 == True
False
if 3:
print(It's Twue)
It's Twue
i.e. in the if statement 3 is
On 25.10.2014 19:27, Rustom Mody wrote:
Moved from other (Seymore's) thread where this is perhaps not relevant
On Saturday, October 25, 2014 1:15:09 PM UTC+5:30, Steven D'Aprano wrote:
Rustom Mody wrote:
On Saturday, October 25, 2014 11:20:03 AM UTC+5:30, Chris Angelico wrote:
On Sat, Oct
On 10/27/2014 05:01 PM, uma...@gmail.com wrote:
I use python 3.4.0 version. In the course of developing / running a python
program, I have encountered a problem. I have reproduced below a simple program
to bring it out.
d = [[0]*3]*4
dd = [1,2,3,4,5,6,7,8,9,10,11,12]
for i in range(4):
...
On 08.11.2014 02:50, Steven D'Aprano wrote:
The following list comprehension and generator expression are almost, but
not quite, the same:
[expr for x in iterable]
list(expr for x in iterable)
The difference is in the handling of StopIteration raised inside the expr.
Generator expressions
On 08.11.2014 22:31, Wolfgang Maier wrote:
On 08.11.2014 02:50, Steven D'Aprano wrote:
The following list comprehension and generator expression are almost, but
not quite, the same:
[expr for x in iterable]
list(expr for x in iterable)
The difference is in the handling of StopIteration
You may want to read:
https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value
from the Python docs Programming FAQ section.
It explains your problem pretty well.
As others have hinted at, always provide concrete Python
I just came across an unexpected behavior in Python 3.3, which has to do
with file iterators and their interplay with other methods of file/IO class
methods, like readline() and tell(): Basically, I got used to the fact that
it is a bad idea to mix them because the iterator would use that hidden
in Python in _pyio.py:
def tell(self):
return _BufferedIOMixin.tell(self) - len(self._read_buf) +
self._read_pos
Wolfgang Maier wrote:
I just came across an unexpected behavior in Python 3.3, which has to
do with file iterators and their interplay with other methods of
file/IO
Hi,
as many others I am not exactly sure what the purpose of your code really
is.
However, if what you´re trying to do here is to take one line from f1, one
line from f2 and then write some combined data to nf, it is not surprising
that you're not getting what you expect (the main reason being
Dear all,
I am wondering what the rules are that determine whether a built-in type is
subclassable or not.
As examples, why can you base your classes on int or set,
but not on bool or range?
Also: can you use introspection to find out whether a type is valid as a
base type?
Thanks for your help!
Jean-Michel Pichavant jeanmichel at sequans.com writes:
Note that range is a function, not a class, hence the error when inheriting
from it.
I was referring to range in Python3, where it is a class. Should have pointed
that out.
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy tjreedy at udel.edu writes:
On 2/22/2013 4:35 AM, Wolfgang Maier wrote:
Dear all,
I am wondering what the rules are that determine whether a built-in type is
subclassable or not.
As examples, why can you base your classes on int or set,
but not on bool or range?
Also
The complete list of types classes that *cannot* be subclassed is:
class 'builtin_function_or_method'
class 'code'
class 'frame'
class 'function'
class 'generator'
class 'getset_descriptor'
class 'function'
class 'mappingproxy'
class 'member_descriptor'
class 'method'
class
Tim Chase python.list at tim.thechases.com writes:
On 2013-03-06 22:20, Roy Smith wrote:
I stumbled upon an interesting bit of trivia concerning lists and
list comprehensions today.
A little testing
shows that this can be rewritten as
my_objects = list(iter(my_query_set))
which
Iterators do not generally have __len__ methods.
len(iter(range(10)))
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: object of type 'range_iterator' has no len()
But iterators have a length hint method that are used for some
optimizations and
Dear all,
can anybody point out a situation where you really need itertools.filterfalse()
?
So far, I couldn't think of a case where you couldn't replace it with a
generator expression/if combination.
e.g.,
a=filterfalse(lambda x: x%2, range(1,101))
b=(i for i in range(1,101) if not i % 2)
do
Norah Jones nh.jones01 at gmail.com writes:
For example:
a=[-15,-30,-10,1,3,5]
I want to find a negative and a positive minimum.
example: negative
print(min(a)) = -30
positive
print(min(a)) = 1
try this:
min(a) = -30
min([n for n in a if i0]) = 1
of course, you have to figure
Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de writes:
Norah Jones nh.jones01 at gmail.com writes:
For example:
a=[-15,-30,-10,1,3,5]
I want to find a negative and a positive minimum.
example: negative
print(min(a)) = -30
positive
print(min(a)) = 1
try
Steven D'Aprano steve+comp.lang.python at pearwood.info writes:
On Tue, 12 Mar 2013 17:03:08 +, Norah Jones wrote:
For example:
a=[-15,-30,-10,1,3,5]
I want to find a negative and a positive minimum.
example: negative
print(min(a)) = -30
positive
print(min(a)) = 1
Oscar Benjamin oscar.j.benjamin at gmail.com writes:
Sort cannot be O(log(n)) and it cannot be faster than a standard O(n)
minimum finding algorithm. No valid sorting algorithm can have even a
best case performance that is better than O(n). This is because it
takes O(n) just to verify that
Chris Angelico rosuav at gmail.com writes:
Sort cannot be O(log(n)) and it cannot be faster than a standard O(n)
minimum finding algorithm. No valid sorting algorithm can have even a
best case performance that is better than O(n). This is because it
takes O(n) just to verify that a list
franzferdinand melo.dumoulin at hotmail.com writes:
I'm doing this Write code that removes whitespace at the beginning
and end of a string, and normalizes whitespace between words to be a
single space character
I can do it using split()
raw = the weather is sunny
Chris Angelico rosuav at gmail.com writes:
Try printing out this expression:
%.2f%value if value else ''
Without the rest of your code I can't tell you how to plug that in,
but a ternary expression is a good fit here.
ChrisA
Unfortunately, that's not working, but gives a TypeError:
Chris Angelico rosuav at gmail.com writes:
On Wed, Mar 27, 2013 at 4:06 AM, Wolfgang Maier
wolfgang.maier at biologie.uni-freiburg.de wrote:
Chris Angelico rosuav at gmail.com writes:
Try printing out this expression:
%.2f%value if value else ''
Without the rest of your code I
Dear all, with
a=list(range(1,11))
why (in Python 2.7 and 3.3) is this explicit for loop working:
for i in a[:-1]:
a.pop() and a
giving:
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, 3, 4, 5, 6, 7]
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
[1, 2, 3, 4]
[1, 2, 3]
[1, 2]
[1]
but the
Tim Chase python.list at tim.thechases.com writes:
it's because you're taking a snapshot copy of a in the middle of
the loop. In your first example, if you change it to
results = []
for i in a[:-1]:
results.append(a.pop() and a)
print results
you get the same thing as your
D. Xenakis gouzounakis at hotmail.com writes:
Hi there, i installed python 2.7 (windows 32bit version) from
http://www.enthought.com/products/epd_free.php and after that i installed
official 3.3 version
too. So now i got two python folders like this.. c:/Python27 and c:/Python33
.
My
D. Xenakis gouzounakis at hotmail.com writes:
The Python.File entry mentioned
there also has the information about the IDLE version to use.
Best,
Wolfgang
I changed this too Python.CompiledFile to my 33 version.
Should i not touch this key?
The
Bradley Wright bradley.wright.biz at gmail.com writes:
Good Day all, currently writing a script that ask the user for three things;
1.Name
2.Number
3.Description
I've gotten it to do this hurah!
print Type \q\ or \quit\ to quit
while raw_input != quit or q:
print
name =
Robrecht W. Uyttenhove ruyttenhove at gmail.com writes:
Hello,
I tried out the following
code:y=[range(0,7),range(7,14),range(14,21),range(21,28),range(28,35)]
y[[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13],
[14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27], [28,
Jason Friedman jsf80238 at gmail.com writes:
I have a file such as:
$ cat my_data
Starting a new group
a
b
c
Starting a new group
1
2
3
4
Starting a new group
X
Y
Z
Starting a new group
I am wanting a list of lists:
['a', 'b', 'c']
['1', '2', '3', '4']
['X',
Jason Friedman jsf80238 at gmail.com writes:
Thank you for the responses! Not sure yet which one I will pick.
Hi again,
I was working a bit on my own solution and on the one from Steven/Joshua,
and maybe that helps you deciding:
def separate_on(iterable, separator):
# based on groupby
Hi everybody,
what is the recommended way of stuffing *all* function arguments (not just
the ones passed by **kwargs) into a common dictionary?
The following sort of works when used as the first block in a function:
try:
kwargs.update(locals())
except NameError:
kwargs = locals().copy()
eternaltheft at gmail.com writes:
Hi guys, I'm having a lot of trouble with this.
My understanding of python is very basic and I was wondering how I can
return this table as a list of lists.
1 2 3 4 5
3 4 5 6
5 6 7
7 8
9
The
Eternaltheft eternaltheft at gmail.com writes:
Ah sorry the task is to make a function for this:
def tTable(n):
tTable(n),even n, returns the initial triangular n-1 x n-1(triangular
table i posted before) table as a
list of lists. For example, tTable(4) returns [[1, 2, 3], [3, 4], [5]].
Steven D'Aprano steve+comp.lang.python at pearwood.info writes:
1) Yield a shorter chunk
2) Extend the chunk with fill values
3) Raise an error
4) Ignore the last chunk
Cases 2 and 4 can be achieved with current itertools primitives e.g.: 2)
izip_longest(fillvalue=fillvalue,
Oscar Benjamin oscar.j.benjamin at gmail.com writes:
On 2 May 2013 13:55, Chris Angelico rosuav at gmail.com wrote:
On Thu, May 2, 2013 at 10:52 PM, Oscar Benjamin
oscar.j.benjamin at gmail.com wrote:
They are all easy to write as generator functions but to me the point
of itertools is
Dear all,
I was just experimenting for the first time with os.posix_fadvise(), which
is new in Python3.3 . I'm reading from a really huge file (several GB) and I
want to use the data only once, so I don't want OS-level page caching. I
tried os.posix_fadvise with the os.POSIX_FADV_NOREUSE and with
bhk755 at gmail.com writes:
Function mergeSort is called only once, but it is getting recursively
executed after the printing the last
statement print(Merging ,alist). But don't recursion taking place
except at these places
mergeSort(lefthalf), mergeSort(righthalf)
Sometimes the function
bhk755 at gmail.com writes:
Thanks for the reply Chris.
I am newbie to python, so please excuse me if I am asking chilly questions.
Can you please explain more about the following sentence.
When it says Splitting with a single-element list, it then
immediately prints Merging and
Antoine Pitrou wrote:
Hi,
Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de writes:
Dear all,
I was just experimenting for the first time with os.posix_fadvise(), which
is new in Python3.3 . I'm reading from a really huge file (several GB) and I
want to use the data only once, so I
andrea crotti andrea.crotti.0 at gmail.com writes:
Using a CouchDB server we have a different database object potentially for
every request.
We already set that db in the request object to make it easy to pass it
around form our django app, however it would be nice if I could set it once
andrea crotti andrea.crotti.0 at gmail.com writes:
2013/6/18 Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
andrea crotti andrea.crotti.0 at gmail.com writes:
Using a CouchDB server we have a different database object potentially for
every request.
We already set
andrea crotti andrea.crotti.0 at gmail.com writes:
2013/6/18 Terry Reedy tjreedy at udel.edu
On 6/18/2013 5:47 AM, andrea crotti wrote:
Using a CouchDB server we have a different database object potentially
for every request.
We already set that db in the request object to make it easy to
Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de writes:
andrea crotti andrea.crotti.0 at gmail.com writes:
2013/6/18 Terry Reedy tjreedy at udel.edu
Decorators are only worthwhile if used repeatedly. What you specified can
easily be written, for instance, as
def save_doc
On 12/03/2014 12:02 PM, Chris Angelico wrote:
When importing a module from a subpackage, it's sometimes convenient
to refer to it throughout the code with a one-part name rather than
two. I'm going to use 'os.path' for the examples, but my actual
use-case is a custom package where the package
On 04.12.2014 19:05, Chris Angelico wrote:
With os.path it definitely is. With the actual code in question, it's
a Python 2.7 project that mostly uses relative imports - inside
package.module1 is import module2 etc - and I was writing an
external script that calls on one of the modules.
What
On 04.12.2014 22:30, Chris Angelico wrote:
On Fri, Dec 5, 2014 at 7:56 AM, Wolfgang Maier
wolfgang.ma...@biologie.uni-freiburg.de wrote:
On 04.12.2014 19:05, Chris Angelico wrote:
With os.path it definitely is. With the actual code in question, it's
a Python 2.7 project that mostly uses
New submission from Wolfgang Maier:
Hi,
I just noticed that version output generated via the
**'version' action** of the **argparse** module
is routed to stderr. I'd expect regular output to go to stdout instead.
The current behavior also seems inconsistent to me because --help
prints to stdout
Wolfgang Maier added the comment:
Thanks Nick for filing this!
I've been working on modifications to statistics._sum and
statistics._coerce_types that together make the module's behaviour independent
of the order of input types (by making the decision based on the set of input
types
Wolfgang Maier added the comment:
Hi Oscar,
well, I haven't used sympy much, and I have no experience with the others, but
in light of your comment I quickly checked sympy and gmpy2.
You are right about them still not using the numbers ABCs, however, on your
advise I also checked how
Wolfgang Maier added the comment:
-Ursprüngliche Nachricht-
Von: Steven D'Aprano [mailto:rep...@bugs.python.org]
Gesendet: Sonntag, 2. Februar 2014 12:55
An: wolfgang.ma...@biologie.uni-freiburg.de
Betreff: [issue20479] Efficiently support weight/frequency mappings
Wolfgang Maier added the comment:
Well, I was thinking about frequencies (ints) when suggesting
for x,m in data.items():
T = _coerce_types(T, type(x))
n, d = exact_ratio(x)
partials[d] = partials_get(d, 0) + n*m
in my previous message. To support weights (float
Wolfgang Maier added the comment:
there are currently two strict requirements for any numeric type to be usable
with statistics._sum:
I meant *three* of course (remembered one only during writing).
--
___
Python tracker rep...@bugs.python.org
Wolfgang Maier added the comment:
Just to make sure that this discussion is not getting on the wrong track,
there are currently two strict requirements for any numeric type to be usable
with statistics._sum:
(1) the type has to provide either
- numerator/denominator properties
Wolfgang Maier added the comment:
Once the input numbers are converted to float statistics._sum can handle
them perfectly well. In this case I think the output should also be a float so
that it's clear that precision may have been lost. If the precision of float
is not
what the user wants
Wolfgang Maier added the comment:
Hi Nick and Oscar,
my patch including tests is ready. What else should I say than that I think it
is ok, but of course with only days remaining and still no feedback from
Steven, I'm not sure there is any chance for it going into 3.4 still.
Anyway, before
Wolfgang Maier added the comment:
Hi Steven,
sounds reasonable, still here's the patch in diff version.
Its rules for type coercion are detailed in _coerce_types's docstring.
Questions and comments are welcome.
Best,
Wolfgang
--
keywords: +patch
Added file: http://bugs.python.org
1 - 100 of 381 matches
Mail list logo