On 5 oct, 17:52, de...@web.de (Diez B. Roggisch) wrote:
> Btw, you are a bit on the overprotective side. The convention for
> marking attributes (methods or objects alike) "private"
s/private/implementation/
I find that thinking in terms of "interface / implementation" instead
of "public / privat
On Oct 5, 4:17 pm, Ethan Furman wrote:
> On one the many mini-reports we use, we have a bunch of counts that are
> frequently zero; because the other counts can also be low, it becomes
> easy to miss the non-zero counts. For example:
>
> Code Description
>
> Conv Errors :
On 5 Okt., 10:17, Julian wrote:
> Hi,
>
> when creating a virtualenv withmkvirtualenv, I receive an error:
>
> http://pastebin.com/1N8yRZUv
>
> I've updated the relating packages (virtualenv, virtualenvwrapper,
> distutils, distribute, pip) and couldn't solve my problem via google.
jannis leidel
In message , Antoon
Pardon wrote:
> A lot of times someone comes with code like the following:
>
> if len(lst) != 0:
> ...
>
>
> and than gets the advise to write it as follows:
>
> if lst:
> ...
>
> Do you mean that this second piece of code is incorrectly written ...
Yes.
--
Hi,
I am having trouble with an expression.
I have the following line of code:
self.failUnless(c.as == 65215)
What happens when you compile this is that you get a syntax error.
This is because as has been made a keyword. failUnless is from the
module unittest.
Now my problem is this. the ".as"
On Wed, Oct 6, 2010 at 1:32 AM, Nethirlon . wrote:
> Hi,
>
> I am having trouble with an expression.
>
> I have the following line of code:
>
> self.failUnless(c.as == 65215)
>
> What happens when you compile this is that you get a syntax error.
> This is because as has been made a keyword. failUn
On 5 Oct, 06:52, Lawrence D'Oliveiro wrote:
> In message
> , James
>
> Harris wrote:
> > On 29 Sep, 18:20, Seebs wrote:
>
> >> On 2010-09-29, Tracubik wrote:
>
> >>> button = gtk.Button(("False,", "True,")[fill==True])
>
> >> Oh, what a nasty idiom.
>
> > I'm surprised you don't like this constr
Thank you Chris,
I'll try and find the attribute in the code. That was my conclusion
aswell... The original author must have defined it somewhere...
Thanks.
On Wed, Oct 6, 2010 at 10:59 AM, Chris Rebert wrote:
> On Wed, Oct 6, 2010 at 1:32 AM, Nethirlon . wrote:
>> Hi,
>>
>> I am having troubl
On 06/10/2010 05:28, Dennis Lee Bieber wrote:
On Tue, 05 Oct 2010 23:54:00 -0400,
declaimed the following in gmane.comp.python.general:
plz can u convert this cpp file into python i need that badly as soon as
possible... I am new to python. I just wanna learn it
Step one... DON'T
On Wed, Oct 06, 2010 at 09:31:48PM +1300, Lawrence D'Oliveiro wrote:
> In message , Antoon
> Pardon wrote:
>
> > A lot of times someone comes with code like the following:
> >
> > if len(lst) != 0:
> > ...
> >
> >
> > and than gets the advise to write it as follows:
> >
> > if lst:
>
Sebastiaan de Haan wrote:
> Thank you Chris,
>
> I'll try and find the attribute in the code. That was my conclusion
> aswell... The original author must have defined it somewhere...
Don't forget to check whether the object's class (or any of its bases) has a
__getattr__() or __getattribute__()
On Wednesday 06 October 2010, 06:28:51 Dennis Lee Bieber wrote:
> On Tue, 05 Oct 2010 23:54:00 -0400,
>
> declaimed the following in gmane.comp.python.general:
> > plz can u convert this cpp file into python i need that badly as soon
> > as possible... I am new to python. I just wanna learn it
On Tue, Oct 05, 2010 at 01:52:39PM -0700, Chris Rebert wrote:
> On Tue, Oct 5, 2010 at 1:31 PM, Wolfgang Rohdewald
> wrote:
> > On Dienstag 05 Oktober 2010, MRAB wrote:
> >> > About notation, even if loved right-hand-half-open
> >> > intervals, I would wonder about [a,b] noting it. I guess
> >> >
On Wed, 2010-10-06, Ethan Furman wrote:
> MRAB wrote:
>> On 06/10/2010 00:17, Ethan Furman wrote:
>> > [snip]
>> > Any comments appreciated, especially ideas on how to better handle
>> > class- and staticmethods
>> >
>> I think that's a bit of overkill. The problem lies in the printing
>> part,
On 6 okt, 11:53, Peter Otten <__pete...@web.de> wrote:
> Sebastiaan de Haan wrote:
> > Thank you Chris,
>
> > I'll try and find the attribute in the code. That was my conclusion
> > aswell... The original author must have defined it somewhere...
>
> Don't forget to check whether the object's class
On Tue, 05 Oct 2010 16:17:57 +0200
"Jonas H." wrote:
>
> Right now I have this minimal struct:
>
> static PyTypeObject StartResponse_Type = {
> PyObject_HEAD_INIT(&PyType_Type)
> 0, /* ob_size */
> "start_response", /* tp_name */
> sizeof(St
In article <4ca6bd15$0$2$c3e8...@news.astraweb.com>,
Steven D'Aprano wrote:
>On Fri, 01 Oct 2010 14:56:52 +0200, Antoon Pardon wrote:
>
>> Think about the following possibility.
>>
>> Someone provides you with a library of functions that act on sequences.
>> They rely on the fact that '+' con
On Tue, 2010-10-05 at 09:49 +1100, Cameron Simpson wrote:
> On 04Oct2010 09:02, Adam Tauno Williams wrote:
> | I'm using a call to the resource module's getrusage method. On openSUSE
> | this works, on CentOS [python26-2.6.5-3.el5] it 'works' but just returns
> | zeros for the memory utilization
On 10/06/2010 02:01 PM, Antoine Pitrou wrote:
It shouldn't. Are you sure you're calling PyType_Ready in the module
initialization routine?
Yeah. The problem was that the type struct was declared 'static' in
another module so the changes `PyType_Ready` made to the struct weren't
applied correc
Nethirlon . wrote:
> On 6 okt, 11:53, Peter Otten <__pete...@web.de> wrote:
>> Sebastiaan de Haan wrote:
>> > Thank you Chris,
>>
>> > I'll try and find the attribute in the code. That was my conclusion
>> > aswell... The original author must have defined it somewhere...
>>
>> Don't forget to chec
On 6 okt, 15:25, Peter Otten <__pete...@web.de> wrote:
> Nethirlon . wrote:
> > On 6 okt, 11:53, Peter Otten <__pete...@web.de> wrote:
> >> Sebastiaan de Haan wrote:
> >> > Thank you Chris,
>
> >> > I'll try and find the attribute in the code. That was my conclusion
> >> > aswell... The original au
When you put the 'wb' extension you have to pass a Encode the string Python
does not accept a string on a wb file, Python3
On Oct 6, 2010 1:01am, Chris Rebert wrote:
> On Oct 5, 2010 8:03pm, MRAB pyt...@mrabarnett.plus.com> wrote:
>> On 05/10/2010 23:50, hid...@gmail.com wrote:
>> I did
On Wednesday 06 October 2010, it occurred to Dave Angel to exclaim:
> On 2:59 PM, Thomas Jollans wrote:
> >
> > % cat a.py
> > foo = 'Meh.'
> > import b
> >
> > % cat b.py
> > from a import foo
> >
> > print(foo)
> >
> > % python a.py
> > Meh.
> > %
>
> But there are now two modules containing
"James Harris" wrote in message
news:e8b46ea8-8d1e-4db9-91ba-501fd1a44...@g18g2000yqk.googlegroups.com...
On 29 Sep, 18:20, Seebs wrote:
On 2010-09-29, Tracubik wrote:
> Hi all,
> I'm studying PyGTK tutorial and i've found this strange form:
> button = gtk.Button(("False,", "True,")[fill==T
Hi!
For those that are interested in making there web applications work in a SAML2
federated environment I have two things to offer:
1) PySAML2 - a not complete but working implementation of SAML2 in Python.
Started with implementing the SP part and are now slowly doing the IdP
part to
How i get the code what MRAB says theres any manual or example?, because i
was trying in Python2.x to do it and give me the same mistake, when i try
to use repr that give me more backslash
On Oct 6, 2010 10:25am, hid...@gmail.com wrote:
When you put the 'wb' extension you have to pass a Encod
shelve has open({filename}). Is there anyway to open a shelve
'database' using a file handle?
Specifically I'd like to create a shelve database via a file handle
acquired from a call to SpooledTemporaryFile.
--
http://mail.python.org/mailman/listinfo/python-list
in general, what are things i would want to 'watch for/guard against'
in a file upload situation?
i have my file upload working (in the self-made framework @ work
without any concession for multipart form uploads), but was told to
make sure it's cleansed and cannot do any harm inside the system.
Dave Angel wrote:
>If you want to be able to go back to the original, then first bind
>another symbol to it.
Or restore from sys.__stdout__, as long as you're sure that nothing
else has rebound sys.stdout first (or don't mind clobbering it).
--
\S
under construction
--
http://mail.pytho
Carl Banks wrote:
On Oct 5, 4:17 pm, Ethan Furman wrote:
class DashInt(int):
__metaclass__ = Perpetuate
def __str__(x):
if x == 0:
return '-'
return int.__str__(x)
Well, it's definitely overkill for printing a dash instead of a zero,
but a lot of peopl
On 2010-10-06, geekbuntu wrote:
> in general, what are things i would want to 'watch for/guard against'
> in a file upload situation?
This question has virtually nothing to do with Python, which means you
may not get very good answers.
> my checklist so far is basically to check the extension -
On 06/10/2010 15:25, hid...@gmail.com wrote:
When you put the 'wb' extension you have to pass a Encode the string
Python does not accept a string on a wb file, Python3
[snip]
You are using Python 3 and type(str) returns ""?
Binary data in Python 3 should be an instance of the 'bytes' class, no
On Sep 29, 9:01 pm, RG wrote:
> That the problem is "elsewhere in the program" ought to be small
> comfort. But very well, try this instead:
>
> [...@mighty:~]$ cat foo.c
> #include
>
> int maximum(int a, int b) { return a > b ? a : b; }
>
> int main() {
> long x = 8589934592;
> printf("Max
On Sat, 25 Sep 2010 21:05:13 -0700 (PDT), Xah Lee wrote:
>here's a interesting toy list processing problem.
>
>I have a list of lists, where each sublist is labelled by
>a number. I need to collect together the contents of all sublists
>sharing
>the same label. So if I have the list
>
>((0 a b) (
I have a daemon that uses the built-in SysLogHandler logging handler
class to log messages to the host's syslog. Unfortunately, I am having
trouble getting it to work with Metalog[1]. At first, I thought the
problem was Metalog's fault because everything works as expected with
syslog-ng. Upon furt
The short version of this question is: where can I find the algorithm
used by the tuple class's __hash__ method?
Now, for the long version of this question, I'm working with some
complext Python objects that I want to be able to compare for
equality easily.
These objects are non-mutable once th
On Wed, Oct 6, 2010 at 12:16 PM, Hans-Peter Jansen wrote:
> On Wednesday 06 October 2010, 06:28:51 Dennis Lee Bieber wrote:
>> On Tue, 05 Oct 2010 23:54:00 -0400,
>>
>> declaimed the following in gmane.comp.python.general:
>> > plz can u convert this cpp file into python i need that badly as soon
On 10/06/10 12:14, Seebs wrote:
not sure what else i could do to guard against anything bad
happening. maybe the file name itself could cause greif?
Obvious things:
* File name causes files to get created outside some particular
upload directory ("../foo")
* File name has spaces
* Crazy st
Hi!
I'm running newspipe-1.1.9, an RSS reader
(http://newspipe.sourceforge.net/), on NetBSD-5.99.11/amd64 using
Python-2.6.6.
Sometimes, it core dumps with particular feeds in the configuration (I
guess depending on the feed, because when I comment out the offending
feed in the opml file, it runs
writes:
> plz can u convert this cpp file into python i need that badly as soon as
> possible... I am new to python. I just wanna learn it
For such an aspiring student of the art of computer programming, I have
the strange feeling of lack-of-effort-showing here. Do I have to lose my
faith i
Ppl thanyou, for all your help finally i did it! thanks, another thing
to i have to send a propouse code, i can fixed the litle problem of the
wsig.input in Python 3 i will tested in the next months but i want to share
the code with the comunnity, how i can do that?
On Oct 6, 2010 1:45p
kj wrote:
> The short version of this question is: where can I find the algorithm
> used by the tuple class's __hash__ method?
>
http://svn.python.org/view/python/trunk/Objects/tupleobject.c?revision=81029&view=markup
static long
tuplehash(PyTupleObject *v)
{
register long x, y;
regist
Ppl thanyou, for all your help finally i did it! thanks, another thing
to who i can send a propose code, i fixed the little problem of the
wsig.input in Python 3 i will tested in the next months but i want to share
the code with the community, how i can do that?
On Oct 6, 2010 3:13pm, h
Seebs writes:
> On 2010-10-06, geekbuntu wrote:
>> in general, what are things i would want to 'watch for/guard against'
>> in a file upload situation?
>
> This question has virtually nothing to do with Python, which means you
> may not get very good answers.
In contrast to "comp.super.web.expe
Hi,
I have a function f that calls itself recursively. It has a list as second
argument, with default argument equal to None (and not [], as indicated at:
http://www.ferg.org/projects/python_gotchas.html#contents_item_6 )
This is the outline of my function:
def f ( argument, some_list = None ):
On Wed, Oct 6, 2010 at 11:58 AM, kj wrote:
>
>
> The short version of this question is: where can I find the algorithm
> used by the tuple class's __hash__ method?
>From Objects/tuple.c, line 315 in Python3.2:
static long
tuplehash(PyTupleObject *v)
{
register long x, y;
register Py_ssiz
kj writes:
> The short version of this question is: where can I find the algorithm
> used by the tuple class's __hash__ method?
Surprisingly, in the source:
http://google.com/codesearch/p?hl=de#-2BKs-LW4I0/trunk/python/src/Objects/tupleobject.c&q=python%20tuplehash&sa=N&cd=1&ct=rc
> Now, for t
On 10/6/10 1:58 PM, kj wrote:
The short version of this question is: where can I find the algorithm
used by the tuple class's __hash__ method?
The function tuplehash() in Objects/tupleobject.c, predictably enough.
Now, for the long version of this question, I'm working with some
complext Pyt
On Wed, 06 Oct 2010 09:02:21 -0700, geekbuntu wrote:
> in general, what are things i would want to 'watch for/guard against' in
> a file upload situation?
>
> i have my file upload working (in the self-made framework @ work without
> any concession for multipart form uploads), but was told to mak
In article
TP wrote:
>I have a function f that calls itself recursively. It has a list as second
>argument, with default argument equal to None (and not [], as indicated at:
>http://www.ferg.org/projects/python_gotchas.html#contents_item_6 )
>
>This is the outline of my function:
>
>def f ( arg
In article
<1a172248-8aab-42f0-a8a2-3f00168f9...@u13g2000vbo.googlegroups.com>,
Keith H Duggar wrote:
> On Sep 29, 9:01 pm, RG wrote:
> > That the problem is "elsewhere in the program" ought to be small
> > comfort. But very well, try this instead:
> >
> > [...@mighty:~]$ cat foo.c
> > #inclu
Chris Torek wrote:
>>import copy from copy
>
> [from copy import copy, rather]
Yes, sorry.
> Note that if f() is *supposed* to be able to modify its second
> parameter under some conditions, you would want to make the copy
> not at the top of f() but rather further in, and in this case,
> that
On 2010-10-06, Diez B. Roggisch wrote:
> writes:
>> plz can u convert this cpp file into python i need that badly as soon as
>> possible... I am new to python. I just wanna learn it
> For such an aspiring student of the art of computer programming, I have
> the strange feeling of lack-of-eff
On 2010-10-06, Diez B. Roggisch wrote:
> Seebs writes:
>> On 2010-10-06, geekbuntu wrote:
>>> in general, what are things i would want to 'watch for/guard against'
>>> in a file upload situation?
>> This question has virtually nothing to do with Python, which means you
>> may not get very good
On Tue, 05 Oct 2010 23:54:00 -0400, fkrafi wrote:
> plz can u convert this cpp file into python i need that badly as soon as
> possible... I am new to python. I just wanna learn it
Good grief. It's bad enough to expect us to do your coding for you,
without making even the *tiniest* effort to
TP writes:
> Hi,
>
> I have a function f that calls itself recursively. It has a list as second
> argument, with default argument equal to None (and not [], as indicated at:
> http://www.ferg.org/projects/python_gotchas.html#contents_item_6 )
>
> This is the outline of my function:
>
> def f ( a
On Wed, 06 Oct 2010 09:02:21 -0700, geekbuntu wrote:
> in general, what are things i would want to 'watch for/guard against' in
> a file upload situation?
>
> i have my file upload working (in the self-made framework @ work without
> any concession for multipart form uploads), but was told to mak
On Wed, 06 Oct 2010 23:00:10 +0200, TP wrote:
> I think I prefer doing an explicit copy.copy, because it allows to
> remind the reader that it is very important to take care of that.
I think a comment is better for that. It's better to explicitly say
something is important than to assume the re
Seebs writes:
> On 2010-10-06, Diez B. Roggisch wrote:
>> Seebs writes:
>>> On 2010-10-06, geekbuntu wrote:
in general, what are things i would want to 'watch for/guard against'
in a file upload situation?
>
>>> This question has virtually nothing to do with Python, which means you
>
I want the mantissa and decimal exponent of a float, in base 10:
mantissa and exponent of 1.2345e7
=> (1.2345, 7)
(0.12345, 8) would also be acceptable.
The math module has a frexp() function, but it produces a base-2 exponent:
>>> math.frexp(1.2345e7)
(0.73581933975219727, 24)
Have I missed
Martin Gregorie writes:
> On Wed, 06 Oct 2010 09:02:21 -0700, geekbuntu wrote:
>
>> in general, what are things i would want to 'watch for/guard against' in
>> a file upload situation?
>>
>> i have my file upload working (in the self-made framework @ work without
>> any concession for multipart
Seebs writes:
> On 2010-10-06, Diez B. Roggisch wrote:
>> writes:
>>> plz can u convert this cpp file into python i need that badly as soon as
>>> possible... I am new to python. I just wanna learn it
>
>> For such an aspiring student of the art of computer programming, I have
>> the strang
In message , BartC wrote:
> I use this syntax where there are two possibilities chosen according to
> condition 'a':
>
> (a | b | c)
Algol 68!
> x = ("One","Two","Three") [i-1]
>
> While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and generates
> an error for the rest ...
x = {1 :
In message , Antoon
Pardon wrote:
> Or what if the keys were floats or tuples and I wanted an
> inclusive upper boundary?
If you’re expecting computer floats to behave as mathematically exact
quantities, you’re asking for trouble.
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-10-06, Diez B. Roggisch wrote:
> With an impressive amount of technological experience under his belt. So
> I'm a bit aghast to see him struggle with this rather simple
> problem. Thus my question...
It does seem a bit odd.
I mean, if I had a short time line to get something converted to
Seebs writes:
> On 2010-10-06, Diez B. Roggisch wrote:
>> With an impressive amount of technological experience under his belt. So
>> I'm a bit aghast to see him struggle with this rather simple
>> problem. Thus my question...
>
> It does seem a bit odd.
>
> I mean, if I had a short time line to
On 2010-10-06, Diez B. Roggisch wrote:
> From the look of it... he's just trying to get a freebie on a homework
> assignment. It certainly is no commercial/useful piece of code
> whatsoever... just CS-101 "read data from stdin and do stuff".
Ooh, I should go help, then.
I *love* to help people o
On 2010-10-06, Steven D'Aprano wrote:
> On Tue, 05 Oct 2010 23:54:00 -0400, fkrafi wrote:
>
>> plz can u convert this cpp file into python i need that badly as soon as
>> possible... I am new to python. I just wanna learn it
>
> Good grief. It's bad enough to expect us to do your coding for yo
"Lawrence D'Oliveiro" wrote in message
news:i8j0dg$lh...@lust.ihug.co.nz...
In message , BartC wrote:
x = ("One","Two","Three") [i-1]
While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and
generates
an error for the rest ...
x = {1 : "One", 2 : "Two", 3 : "Three"}.get(i, "No
BartC wrote:
>
>
> "Lawrence D'Oliveiro" wrote in message
> news:i8j0dg$lh...@lust.ihug.co.nz...
>> In message , BartC wrote:
>
>>> x = ("One","Two","Three") [i-1]
>>>
>>> While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and
>>> generates
>>> an error for the rest ...
>>
>> x = {1
On Thu, 07 Oct 2010 01:36:33 +0100, BartC wrote:
> However, as I mentioned, one problem here is having to evaluate all the
> items in the list before selecting one:
>
> def fna():
> print "FNA CALLED"
> return "One"
> def fnb():
> print "FNB CALLED"
> return "Two
Keith H Duggar writes:
> On Sep 29, 9:01 pm, RG wrote:
>> That the problem is "elsewhere in the program" ought to be small
>> comfort. But very well, try this instead:
>>
>> [...@mighty:~]$ cat foo.c
>> #include
>>
>> int maximum(int a, int b) { return a > b ? a : b; }
>>
>> int main() {
>>
On 2010-10-06, wrote:
> plz can u convert this cpp file into python i need that badly as soon as
> possible... I am new to python. I just wanna learn it
Having come to realize that this is a homework problem, I would of course
be glad to.
The original program:
#include
int
On 10/6/2010 8:02 PM, Seebs wrote:
On 2010-10-06,wrote:
plz can u convert this cpp file into python i need that badly as soon as
possible... I am new to python. I just wanna learn it
Having come to realize that this is a homework problem, I would of course
be glad to.
The original pro
On 2010-10-07, John Nagle wrote:
> First, "scanf" was deprecated over five years ago.
It was? I mean, people have been telling me not to use it since the 80s,
but I wasn't aware that it had been deprecated, except in the sense of being
derided and dismissed as of no value.
-s
--
Copyright
Diez B. Roggisch wrote:
> Back to your example: your solution is perfectly fine, although a bit
> costly and more error-prone if you happen to forget to create a copy.
> A safer alternative for these cases is using tuples, because they are
> immutable.
Thanks Diez for your explanation.
The proble
Steven D'Aprano wrote:
>> I think I prefer doing an explicit copy.copy, because it allows to
>> remind the reader that it is very important to take care of that.
>
> I think a comment is better for that. It's better to explicitly say
> something is important than to assume the reader will guess.
In message
<2ce3860b-ae21-48ae-9abc-cb169a6f1...@e20g2000vbn.googlegroups.com>,
geekbuntu wrote:
> in general, what are things i would want to 'watch for/guard against'
> in a file upload situation?
If you stored the file contents as a blob in a database field, you wouldn’t
have to worry about
In message <87bp79qdhk@rudin.co.uk>, Paul Rudin wrote:
> Certainly you can model a set as a dictionary, but that's likely to be
> less efficient than using a set, and quite possibly you'll need to roll
> your own operations on your sets, whereas they're provided for the built
> in implementati
In message
<21c99273-ed58-4f93-b98a-d9292de5d...@k10g2000yqa.googlegroups.com>, dusans
wrote:
> - all the others having ODBC drivers...
ODBC seems to be something you use when you can’t use a proper database
driver.
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-10-07, TP wrote:
> Diez B. Roggisch wrote:
>> A safer alternative for these cases is using tuples, because they are
>> immutable.
> The problem with tuples is that it is not easy to modify them:
This is probably the best post-and-response I've seen in the last couple
of months.
-s
--
C
Steven D'Aprano wrote:
> I want the mantissa and decimal exponent of a float, in base 10:
>
> mantissa and exponent of 1.2345e7
> => (1.2345, 7)
>
> (0.12345, 8) would also be acceptable.
[...]
> Have I missed a built-in or math function somewhere?
The integral, decimal exponent is just the floo
82 matches
Mail list logo