> Do I need to do something especial to get repr to work strictly
> with unicode?
Yes, you need to switch to Python 3 :-)
> Or should __repr__ *always* return bytes rather than unicode?
In Python 2.x: yes.
> What about __str__ ?
Likewise.
> If both of these are supposed to return bytes,
> the
> Does any one knows why the grammar is so coded? Any intuition?
The 2.7 Grammar clarifies that:
# The reason that keywords are test nodes instead of NAME is that using
# NAME results in an ambiguity. ast.c makes sure it's a NAME.
argument: test [comp_for] | test '=' test
The ambiguity is this:
On 4/18/2010 7:23 PM, Xavier Ho wrote:
G'day Pythoneers,
I ran into a strange problem today: why does Python not allow default
paranmeters for packed arguments in a function def?
>> def test(a = 1, b = (2, 3)):
... print a, b
...
>> test()
1 (2, 3)
>> def t(a, *b = (3, 4)):
File "
Thank you for this very clear (and quick) explanation! :-)
Cheers,
Franck
On 19 avr, 08:58, "Martin v. Loewis" wrote:
> # The reason that keywords are test nodes instead of NAME is that using
> # NAME results in an ambiguity. ast.c makes sure it's a NAME.
> argument: test [comp_for] | test '='
> > argument: ... | test '=' test
> Where are you finding that?
This comes from Python-2.6/Grammar/Grammar in the source distribution.
> This tells you that keyword arguments cannot have keywords that aren't
> identifiers:
>
> >>> sum(1=2)
>
> File "", line 1
> SyntaxError: keyword can't be
I tried csr_matrix.dot(A,N) where A and N are two sparse matrices.
is it correct for multiplication of two sparse matrices ?
I still do not now how to perform matrix inversion for a sparse
matrix. Can anyone please help.
Thanks!!
On Apr 19, 12:03 am, pp wrote:
> I am currently dealing with spa
hi,
i am using ubuntu 9.10. it comes with preinstalled python2.6 having no debug
symbols.How can i add debug symbols to it. Secondly i cant afford to install a
fresh python version using OPT=-g way. Please tell me how can i add symbols to
existing python2.6.
The error that i get in gdb when i a
>Hi,
>I am working in gnuradio compiler. I need some help in debugging python and c
>together.
>By this i mean that i have written some blocks in c that are connected
>together using python. So i need to debug
>( breakpoints ect ) python such that when a specific c block is called at the
>back e
Dave Angel wrote:
> 2) In original C, and I think in C++, the lifetime of i lasted long
> after the loop ended.
> for (int i=0; i< limit; ++i)
> {
>z += i;
> }
> i is still valid after this curly brace
>
> In C99, and at least in later C++, the scope of i ends w
Hi all,
I am passing a ctypes struct byref to a dll. When I get the struct
back, it looks like the char array in the struct was truncated at the
first null char. It should be 192 bytes long, but I know the 3rd
through 6th byte are null chars and the array was truncated right
before byte 3.
Is the
After at least 3 false starts on my programming introduction's chapter 3, and
some good and bad feedback from this group[1], I finally think the present
chapter 3 approach is Good (enough).
So no, I haven't given up in this book project, even though 4 months to produce
these chapter 3's first
Alexander wrote:
On 17.04.2010 18:32, Steven D'Aprano wrote:
On Sat, 17 Apr 2010 13:09:43 +0400, Alexander wrote:
Hi, list.
I've some nontrivial class implementation MyClass and its instance my:
my = MyClass(args)
MyClass uses in internals some variable which is not defined in My
Hi friends,
I want to program Python to copy some video files (.flv) from the IE folder
"temporary internet files", but
os.listdir('C:\\Documents and Settings\\Administrator\\Local
Settings\\Temporary Internet Files')
seemed unable to find any video file (although they really exist and can
Hi All,
I am working on porting python on vxworks and hence was updating the PC
\pyconfig.h file for configurng python. As I am reading the file and
updating manually I come across lot many preprocessor directives which
I dont understand e.g. HAVE_NICE etc. May be this is standard
nomenclature and
Le Sun, 18 Apr 2010 22:37:30 -0700, John Nagle a écrit :
>
> The cert file is the same PEM file I use with M2Crypto, and it's derived
> from Firefox's cert file.
>
> Why am I getting a "private key" related error? I'm not submitting a
> keyfile, just a cert file.
I'm not an expert but this is w
Hi,
You need to install the python debugging packages for your ubuntu version. I
guess its "python-dbg"
Regards,
Shaunak
2010/4/19 sanam singh
> hi,
> i am using ubuntu 9.10. it comes with preinstalled python2.6 having no
> debug symbols.How can i add debug symbols to it. Secondly i cant affo
On 30 March 2010 18:40, gentlestone wrote:
> Hi, how can I write the popular C/JAVA syntax in Python?
>
> Java example:
> return (a==b) ? 'Yes' : 'No'
>
> My first idea is:
> return ('No','Yes')[bool(a==b)]
>
> Is there a more elegant/common python expression for this?
>
I'm a little late t
Hi,
just a quick one,
Is it possible to achieve a default value in a list comprehension
where the if-clause is false?
Ie, something similar to:
[ a for a in b if something(a) else 'default' ]
the idea being that, rather than skip a value if the if-clause is
false, to place a default value at t
On Apr 19, 2:20 pm, AlienBaby wrote:
> Hi,
>
> just a quick one,
>
> Is it possible to achieve a default value in a list comprehension
> where the if-clause is false?
>
> Ie, something similar to:
>
> [ a for a in b if something(a) else 'default' ]
>
> the idea being that, rather than skip a value
On 19/04/2010 10:49, CHEN Guang wrote:
Hi friends,
I want to program Python to copy some video files (.flv) from the IE folder
"temporary internet files", but
os.listdir('C:\\Documents and Settings\\Administrator\\Local
Settings\\Temporary Internet Files')
seemed unable to find any video file
On Apr 19, 1:23 pm, eb303 wrote:
> On Apr 19, 2:20 pm, AlienBaby wrote:
>
>
>
>
>
> > Hi,
>
> > just a quick one,
>
> > Is it possible to achieve a default value in a list comprehension
> > where the if-clause is false?
>
> > Ie, something similar to:
>
> > [ a for a in b if something(a) else 'de
i have this code
def example(a):
return lambda b: a+b+1
fun = example(10)
k_1 = fun(7)
...
and pylint tells me
[...]
C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 5: Invalid name "k_1" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
[...]
afaict, [A-Z_][A-Z0-9_]
handler = urllib2.urlopen(req) is taking way too much time to retrieve
the URL. The same code using sockets in PHP doesn't delay this long.
I had 'Authorization':'Basic ' + base64.b64encode("username:password")
in my header though.
[ I didnt use HTTPPasswordMgr & HTTPPasswordMgrWithDefaultRealm
bec
Hi,
Thanks for your reply. well the problem is that for gfb you need a python
interpreter with debugging symbols, but unfortunately as i am using ubuntu9.10
it has python2.6 without debugging symbols. now there are two ways out of
it.first is that if we could add debug symbols to pre installed
Dynamic Languages Symposium 2010
October 18, 2010
Co-located with SPLASH (OOPSLA) 2010
In cooperation with ACM SIGPLAN
John Ascuaga's Nugget, Reno/Tahoe, Nevada, USA
http://www.dynamic-languages-symposium.org/dls-10/
* Call for papers *
The 6th Dynamic Languages Symposium (DLS) at the
top level "variables" in real code are often constants and pylint tries to help
you get rid of global variables.
---
frmsrcurl:
http://compgroups.net/comp.lang.python/-pylint-why-pylint-wants-only-capitals-identifiers
--
http://mail.python.org/mailman/listinfo/python-list
Gilles Ganault a écrit :
On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers
wrote:
The PHP execution model (mostly based on CGI FWIW) tends to be a bit
unpractical for non-trivial applications since you have to rebuild the
whole world for each and any incoming request, while with a long-r
eb303 a écrit :
On Apr 19, 2:20 pm, AlienBaby wrote:
Hi,
just a quick one,
Is it possible to achieve a default value in a list comprehension
where the if-clause is false?
Ie, something similar to:
[ a for a in b if something(a) else 'default' ]
the idea being that, rather than skip a value
Change PATH and LD_LIBRARY_PATH variable to use /usr/local instead of /usr
2010/4/19 sanam singh
> Hi,
> Thanks for your reply. well the problem is that for gfb you need a python
> interpreter with debugging symbols, but unfortunately as i am using
> ubuntu9.10 it has python2.6 without debuggin
Hello,
I live in Paris, my roommate and I would gladly host a poor soul
blocked at the airport due to the ash cloud.
See me for details,
Cheers,
PS: disambiguation: talking about real physical cloud here... :)
--
http://mail.python.org/mailman/listinfo/python-list
Giacomo Boffi wrote:
i have this code
def example(a):
return lambda b: a+b+1
fun = example(10)
k_1 = fun(7)
...
and pylint tells me
[...]
C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 5: Invalid name "k_1" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
[...]
First, before I get farther,
Is there a way for the logging module to natively handle lists and
dict objects when logging?
e.g. take this {'key1':'val1','key2':'val2'} and have it logged like this:
INFO: key1: val1
INFO: key2: val2
If I pass the dict or list directly to the logger, it is logged
"chris cannady" wrote in message
news:b103e85a-05d5-4195-a18f-bd143e9f5...@b33g2000yqc.googlegroups.com...
Hi all,
I am passing a ctypes struct byref to a dll. When I get the struct
back, it looks like the char array in the struct was truncated at the
first null char. It should be 192 bytes l
On 18.04.2010 13:23, Steven D'Aprano wrote:
> On Sat, 17 Apr 2010 19:55:44 +0400, Alexander wrote:
>
>
>> Ok, I'll try to explain on the following example. Let's consider class
>> MyClass that holds one string and concatenate it with other not defined
>> in this class:
>>
> [...]
>
>>
Oltmans writes:
> Greetings Python superstars,
>
> I've a directory structure like following
>
> tests /
> __init__.py
> testfile.py
>
> testfile.py contains following code
>
> import unittest
>
> class Calculator(unittest.TestCase):
> def test_add(self):
> print 'just add
Jean-Michel Pichavant writes:
> Giacomo Boffi wrote:
>> i have this code
>>
>> def example(a):
>> return lambda b: a+b+1
>>
>> fun = example(10)
>> k_1 = fun(7)
>> ...
>>
>> and pylint tells me
>>
>> [...]
>> C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
>> C: 5: In
Giacomo Boffi writes:
>> However, given you example, you should not insert code execution at
>> you module level, unless it's required only at the module import. I
>> dont know what is your module
>
> module? this was not well specified in my OP, but i'd rather speak of
> a "script" instead of a
hello,
I want to use Python to give users the possibility to analyze data and
create their custom reports.
So I want a very simple language definition for the user, like :
- the script must be case-insensitive
- "user-words" are automatically translated into function names
- users strings, should
I have been fighting the same bug for weeks now with zero success: I
am trying to get images to come up on my buttons, but they are way too
small. Regardless of whether I used my old Python 2.5.1 or now 2.6.5,
the following code:
'''Minesweeper.'''
from Tkinter import *
#from
Antoine Pitrou wrote:
Perhaps you are using the wrong parameters and looking for ca_certs
instead:
That's right. Thanks.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Giacomo Boffi wrote:
Jean-Michel Pichavant writes:
Giacomo Boffi wrote:
i have this code
def example(a):
return lambda b: a+b+1
fun = example(10)
k_1 = fun(7)
...
and pylint tells me
[...]
C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C: 5: Invalid n
I'm converting some code from M2Crypto to the new "ssl" module, and
I've found what looks like a security hole. The "ssl" module will
validate the certificate chain, but it doesn't check that the certificate
is valid for the domain.
Here's the basic code:
sk = socket.socket(socket
Tkinter scrollbar widget's "background" and "relief" options seem not
work.
The below is the codes I tried and the python/tk information:
===
ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit
(Intel)] on
w
On 04:51 pm, na...@animats.com wrote:
I'm converting some code from M2Crypto to the new "ssl" module, and
I've found what looks like a security hole. The "ssl" module will
validate the certificate chain, but it doesn't check that the
certificate
is valid for the domain.
Here's the basic
In "Martin v. Loewis" writes:
>> Do I need to do something especial to get repr to work strictly
>> with unicode?
>Yes, you need to switch to Python 3 :-)
>> Or should __repr__ *always* return bytes rather than unicode?
>In Python 2.x: yes.
>> What about __str__ ?
>Likewise.
>> If both of
I installed scipy (and all the required libraries) and the following error
appears when i tried run a simple example which uses the optimize package of
scipy. I tried also numpy alone and it works ( at least for printing
numpy.array([10,20,10]))
error:
Traceback (most recent call last):
File
exar...@twistedmatrix.com wrote:
On 04:51 pm, na...@animats.com wrote:
I'm converting some code from M2Crypto to the new "ssl" module, and
I've found what looks like a security hole. The "ssl" module will
validate the certificate chain, but it doesn't check that the certificate
is valid for
On Apr 19, 7:15 pm, gerardob wrote:
> I installed scipy (and all the required libraries) and the following error
> appears when i tried run a simple example which uses the optimize package of
> scipy. I tried also numpy alone and it works ( at least for printing
> numpy.array([10,20,10]))
>
> erro
On Mon, Apr 19, 2010 at 1:49 PM, John Nagle wrote:
> exar...@twistedmatrix.com wrote:
>>
>> On 04:51 pm, na...@animats.com wrote:
>>>
>>> I'm converting some code from M2Crypto to the new "ssl" module, and
>>> I've found what looks like a security hole. The "ssl" module will
>>> validate the ce
On 4/19/10 1:03 AM, pp wrote:
I am currently dealing with sparse matrices and have doubts on whether
we can use
1.) dot (for matrix multiplication) and inv (inverse) operations of
numpy on sparse matrices of CSR format.
I initially constructed my sparse matrix using COO format and then
converted
On 4/19/10 12:15 PM, gerardob wrote:
I installed scipy (and all the required libraries) and the following error
appears when i tried run a simple example which uses the optimize package of
scipy. I tried also numpy alone and it works ( at least for printing
numpy.array([10,20,10]))
error:
Trac
On 05:49 pm, na...@animats.com wrote:
exar...@twistedmatrix.com wrote:
On 04:51 pm, na...@animats.com wrote:
I'm converting some code from M2Crypto to the new "ssl" module,
and
I've found what looks like a security hole. The "ssl" module will
validate the certificate chain, but it doesn't
omnia neo wrote:
> Hi All,
>
> I am working on porting python on vxworks and hence was updating the PC
> \pyconfig.h file for configurng python. As I am reading the file and
> updating manually I come across lot many preprocessor directives which
> I dont understand e.g. HAVE_NICE etc. May be this
I am trying to create a list of consisting of multiple instances of the
same class, The Problems i am having is that i seem to be accessing the
same memory.. How should i solve this Python problem ?
Here is some sample code demonstraing my problem (same memory) :
from copy import copy as cp
cl
On Tue, Apr 20, 2010 at 7:21 AM, Robert Somerville <
rsomervi...@sjgeophysics.com> wrote:
> class ctest():
> x = int
> y = [1,2,3]
>
Variables defined directly under the class are known as "static variables"
in many other languages. Here in Python it's called a class variable, but
they're sti
On Mon, Apr 19, 2010 at 2:29 PM, Xavier Ho wrote:
> On Tue, Apr 20, 2010 at 7:21 AM, Robert Somerville
> wrote:
>>
>> class ctest():
>> x = int
>> y = [1,2,3]
>
> Variables defined directly under the class are known as "static variables"
> in many other languages. Here in Python it's called a
Hi,
I released Oktest 0.2.1.
homepage: http://packages.python.org/Oktest/
download: http://pypi.python.org/pypi/Oktest/
repository: http://bitbucket.org/kwatch/oktest/
Oktest is a new-style testing library for Python.
from oktest import ok
ok (x) > 0 # same as assert_(
On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert wrote:
> Additionally, `self.x = int` might not do what you thought it does. It
> does *not* create a new instance variable of type 'int'. Instead, it
> literally assigns to a new instance variable x the *function*† that
> converts values into integer
On Mon, Apr 19, 2010 at 3:41 PM, Xavier Ho wrote:
> On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert wrote:
>> Additionally, `self.x = int` might not do what you thought it does. It
>> does *not* create a new instance variable of type 'int'. Instead, it
>> literally assigns to a new instance variabl
From: Vlastimil Brom
Date: 2010/4/16
Subject: unexpected output from difflib.SequenceMatcher
...
Instead of just reporting the insertion and deletion of these single
characters ... the output of the
SequenceMatcher decides to delete a large part of the string in
between the differences and to ins
On Apr 17, 11:52 am, Jonathan Hartley wrote:
> On Apr 16, 5:59 pm, Lie Ryan wrote:
>
>
>
> > On 04/16/10 19:28, Jonathan Hartley wrote:
>
> > > I'm playing with ideas of what API to expose. My favourite one is to
> > > simply embed ANSI codes in the stream to be printed. Then this will
> > > work
i know it's not very hard to get that solution.
just by implementing simple function like below.
def partition(target, predicate):
"""
split a list into two partitions with a predicate
provided.
any better ideas? :)
"""
true = []
On Mon, Apr 19, 2010 at 6:00 PM, knifenomad wrote:
> i know it's not very hard to get that solution.
> just by implementing simple function like below.
>
> def partition(target, predicate):
> """
> split a list into two partitions with a predicate
> provided.
>
On 4월20일, 오전10시16분, Chris Rebert wrote:
> On Mon, Apr 19, 2010 at 6:00 PM, knifenomad wrote:
> > i know it's not very hard to get that solution.
> > just by implementing simple function like below.
>
> > def partition(target, predicate):
> > """
> > split a list into tw
gb345 wrote:
In "Martin v. Loewis" writes:
Do I need to do something especial to get repr to work strictly
with unicode?
Yes, you need to switch to Python 3 :-)
Or should __repr__ *always* return bytes rather than unicode?
In Python 2.x: yes.
Hello!
Is it assured the following statement is always True?
If it is always True, in which version, python2.x or python3.x?
>>> a = dict()
...
>>> assert(a.values == [a[k] for k in a.keys()])
--> ?
Menghan Zheng
--
http://mail.python.org/mailman/listinfo/python-list
exar...@twistedmatrix.com wrote:
On 05:49 pm, na...@animats.com wrote:
exar...@twistedmatrix.com wrote:
On 04:51 pm, na...@animats.com wrote:
I'm converting some code from M2Crypto to the new "ssl" module, and
I've found what looks like a security hole. The "ssl" module will
validate the c
On 20Apr2010 11:03, Menghan Zheng wrote:
| Is it assured the following statement is always True?
| If it is always True, in which version, python2.x or python3.x?
|
| >>> a = dict()
| ...
| >>> assert(a.values == [a[k] for k in a.keys()])
| --> ?
It is always true. At this URL:
http://docs.py
On Apr 20, 1:03 pm, Menghan Zheng wrote:
> Is it assured the following statement is always True?
> If it is always True, in which version, python2.x or python3.x?
I believe its an implementation detail and should not be relied on. If
you need consistent ordering, use an OrderedDict[1] or sort() t
On Tue, Apr 20, 2010 at 3:40 AM, segunai wrote:
> On 4월20일, 오전10시16분, Chris Rebert wrote:
>> On Mon, Apr 19, 2010 at 6:00 PM, knifenomad wrote:
>> > i know it's not very hard to get that solution.
>> > just by implementing simple function like below.
>>
>> > def partition(target, predicate)
Cameron Simpson wrote:
> If items(), keys(), values(), iteritems(), iterkeys(), and
> itervalues() are called with no intervening modifications to the
> dictionary, the lists will directly correspond. This allows the
> creation of (value, key) pairs using zip(): pairs = zip(d.values(),
>
John Nagle wrote:
Is there a usable street address parser available? There are some
bad ones out there, but nothing good that I've found other than commercial
products with large databases. I don't need 100% accuracy, but I'd like
to be able to extract street name and street number for at lea
On 19Apr2010 21:31, alex23 wrote:
| Cameron Simpson wrote:
| > If items(), keys(), values(), iteritems(), iterkeys(), and
| > itervalues() are called with no intervening modifications to the
| > dictionary, the lists will directly correspond. This allows the
| > creation of (value, key) p
On Apr 20, 1:23 am, Cameron Simpson wrote:
> On 19Apr2010 21:31, alex23 wrote:
> | Cameron Simpson wrote:
> | > If items(), keys(), values(), iteritems(), iterkeys(), and
> | > itervalues() are called with no intervening modifications to the
> | > dictionary, the lists will directly corres
John Nagle wrote:
>
> Unfortunately, now it won't run with the released
>version of "pyparsing" (1.5.2, from April 2009), because it uses
>"originalTextFor", a feature introduced since then. I worked around that,
>but discovered that the new version is case-sensitive. Changed
>"Keyword" to "Ca
75 matches
Mail list logo