On Fri, 03 Oct 2008 14:41:13 -0700, harrelson wrote:
> import xml.dom.minidom
> print chr(3).encode('utf-8')
> dom = xml.dom.minidom.parseString( "%s" %
> chr(3).encode('utf-8') )
>
> chr(3) is the ascii character for "end of line". I would think that
> trying to encode this to utf-8 would fail
On Fri, 03 Oct 2008 17:38:13 -0400, Pat wrote:
> Pylint does a decent job at checking for errors only within a single
> module.
>
> Here's one of my problems. I have two modules.
>
> In module one, I have a function:
>
> def foo( host, userid, password ):
> pass
>
> In module two, I call
On Friday 03 October 2008, harrelson wrote:
> import xml.dom.minidom
> print chr(3).encode('utf-8')
> dom = xml.dom.minidom.parseString( "%s" %
> chr(3).encode('utf-8') )
>
> chr(3) is the ascii character for "end of line". [...] My
> question is why doesn't encode() blow up?
You just answered yo
On Oct 3, 9:46 pm, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> dmitrey a écrit :
>
> > hi all,
> > I have a code
> > z = MyClass(some_args)
> > can I somehow get info in MyClass __init__ function that user uses "z"
> > as name of the variable?
>
> > I.e. to have __init__ function that creates
> Oh. I read somewhere that UTF-8 variable names we're supported. I
> thought I even saw a colleague using Kanji.
In source code (string literals, comments), surely. Not in variable
names, not in 2.x.
To rephrase Bruno's comment: Python supports UTF-8 as a source encoding.
That doesn't mean that
On Oct 4, 7:41 am, harrelson <[EMAIL PROTECTED]> wrote:
> I have a large amount of data in a postgresql database with the
> encoding of SQL_ASCII. Most recent data is UTF-8 but data from
> several years ago could be of some unknown other data type. Being
> honest with myself, I am not even sure t
dmitrey <[EMAIL PROTECTED]> writes:
> On Oct 3, 9:46 pm, Bruno Desthuilliers
> <[EMAIL PROTECTED]> wrote:
> > x = MyClass()
> > y = x
> > del x
> >
> > objects = [MyClass() for i in range(100)]
> >
> > If you can come with a meaningfull answer to "what's *the* name of
> > any of the MyClass instan
HI,
I need an example for the usage of the apply()-function. Can you help me?
Thanks.
o-o
Thomas
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Oct 4, 2008 at 2:25 AM, TK <[EMAIL PROTECTED]> wrote:
> HI,
>
> I need an example for the usage of the apply()-function. Can you help me?
Don't use the apply() function, it's deprecated and unnecessary thanks
to Python's enhanced calling syntax, which is described in depth on
http://www.py
pos_args = ["spam", 1, [3]]
kwd_args = {"b":7, "c":9}
result = some_function(*pos_args, **kwd_args)
Which is equivalent to:
result = some_function("spam", 1, [3], b=7, c=9)
Which was equivalent to:
result = apply(some_function, pos_args, kwd_args)
Thanks a lot.
o-o
Thomas
--
http://mail.pyth
Hello everybody,
To test the python 2.5 garbage collector, I wrote a trivial script
allocating dummy objects of various sizes, then forgetting them in a loop.
The garbage collector seems working well, limiting the memory used.
But I've noticed a near linear slowdown of the execution : after a fe
Martin Geisler <[EMAIL PROTECTED]> wrote:
> I just tried running my code using "python2.6 -3" and got a bunch of
>
>SyntaxWarning: tuple parameter unpacking has been removed in 3.x
>
> warnings. I've read PEP-3113:
>
>http://www.python.org/dev/peps/pep-3113/
>
> but I'm still baffle
Nick Craig-Wood wrote:
> Martin Geisler <[EMAIL PROTECTED]> wrote:
>
>> I just tried running my code using "python2.6 -3" and got a bunch of
>>
>>SyntaxWarning: tuple parameter unpacking has been removed in 3.x
>>
>> warnings. I've read PEP-3113:
>>
>>http://www.python.org/dev/peps/p
hello,
for a general debug routine,
written in some module.
I want to write the information to a file,
with name derived from the main python file.
Is it possible to get the name of the python script started first ?
thanks,
Stef Mientki
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
Another way is to de-activate UAC.
@-salutations
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Pat:
I know about 3 different lints for Python, there's PyFlake too. But I
don't know if it does what you want.
> I've never used a language that didn't catch that type of error.
What dynamic languages have you used in the past?
> I'm quite surprised that Python is being used by a number of m
On Oct 3, 5:38 pm, Pat <[EMAIL PROTECTED]> wrote:
> I've been searching for a good multi-module lint checker for Python and
> I haven't found one yet.
>
> Pylint does a decent job at checking for errors only within a single module.
>
> Here's one of my problems. I have two modules.
>
> In module
Stef Mientki wrote:
hello,
for a general debug routine,
written in some module.
I want to write the information to a file,
with name derived from the main python file.
Is it possible to get the name of the python script started first ?
thanks,
Stef Mientki
--
http://mail.python.org/mailman/lis
Gary M. Josack wrote:
Stef Mientki wrote:
hello,
for a general debug routine,
written in some module.
I want to write the information to a file,
with name derived from the main python file.
Is it possible to get the name of the python script started first ?
thanks,
Stef Mientki
--
http://mail
guillaume> But I've noticed a near linear slowdown of the execution :
guillaume> after a few minutes - and several millions of allocated and
guillaume> freed objects, each iteration take more and more time to
guillaume> execute.
I ran your script on my Mac and let it go for over a
http://projecteuler.net/index.php?section=problems&id=18
def recur(tree, pos):
if not tree:
return []
else:
return [[tree[0][pos]] + recur(tree[1:], pos)] + \
[[tree[0][pos]] + recur(tree[1:], pos+1)]
i have a list with [[1],[2,3],[4,5,6],[7,8,9,10]]
it
I need to be able to offer a client "click to download" functionality
on their website. Generating the data to provide to them is not an
issue but I want them to be able to click a button and have the
response be sent to a csv file which they are prompted to download.
Can someone point me in the r
guillaume weymeskirch wrote:
Hello everybody,
To test the python 2.5 garbage collector, I wrote a trivial script
allocating dummy objects of various sizes, then forgetting them in a loop.
The garbage collector seems working well, limiting the memory used.
But I've noticed a near linear slowdow
Peter Otten <[EMAIL PROTECTED]> writes:
> Nick Craig-Wood wrote:
>
>> So just remove the parentheses and you'll be fine.
>
> No, you change the function signature in the process.
>
> f = lambda (a, b): a*b
>
> is equivalent to
>
> def f((a, b)): # double parens
>return a*b
>
> and called as f(
process wrote:
http://projecteuler.net/index.php?section=problems&id=18
def recur(tree, pos):
if not tree:
return []
else:
return [[tree[0][pos]] + recur(tree[1:], pos)] + \
[[tree[0][pos]] + recur(tree[1:], pos+1)]
The backslash is not needed here or an
Martin Geisler wrote:
A somewhat related question: do I pay a performance penalty when I let a
function define an inner function like this:
def foo():
def bar()
...
bar()
Some. The *code* for the body of bar is compiled as part of compiling
the body of foo, but each call o
Hi all,
I know it's a kind of bizarre question but here I go: I want to
execute an script using popen4. This script executes a command in turn
using popen4 too. The first one throws a 256 exit code.
Any suggestions?
Thanks
J.
--
http://mail.python.org/mailman/listinfo/python-list
julian wrote:
Hi all,
I know it's a kind of bizarre question but here I go: I want to
execute an script using popen4. This script executes a command in turn
using popen4 too. The first one throws a 256 exit code.
Any suggestions?
Popen4 is gone in 3.0 and I presume deprecated in 2.6, replaced i
Larry Bates a écrit :
You can do the following:
a = [1,2,3,4,5]
del a[0]
and
a = {1:'1', 2: '2', 3: '3', 4:'4', 5:'5'}
del a[1]
why doesn't it work the same for sets (particularly since sets are based
on a dictionary)?
a = set([1,2,3,4,5])
del a[1]
>
Yes I know that sets have a remove met
Bobby Roberts wrote in news:cdc29298-d005-4804-b407-81ecaf6bb1b4@
2g2000hsn.googlegroups.com in comp.lang.python:
> I need to be able to offer a client "click to download" functionality
> on their website. Generating the data to provide to them is not an
> issue but I want them to be able to clic
William Heath wrote:
> Hi All,
> I thought I sent an email to the list regarding a need I have to self sign
> a
> py2exe windows executable. Does anyone know how to do that?
>
> -Tim
>
You can use capicom to sign an executable (or even a .pyd):
import win32com.client
s=win32com.client.Dispatch('
On Sat, 04 Oct 2008 12:18:13 -0700
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On 4 Oct 2008 06:59:20 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
> > not whitespace. BTW `chr(3)` isn't "end of line" but "end of text" (ETX).
> >
> Hmm
On Oct 3, 5:38 pm, Pat <[EMAIL PROTECTED]> wrote:
> I've been searching for a good multi-module lint checker for Python and
> I haven't found one yet.
>
> Pylint does a decent job at checking for errors only within a single module.
>
> Here's one of my problems. I have two modules.
>
> In module o
Hi!
Very interesting.
Roger, thank you very much super enormous!!!
@-salutations
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> On Sat, 04 Oct 2008 13:14:40 +0200, Peter Otten <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> In 3.0 it has to be rewritten as
>>
>> def f(ab):
>> a, b = ab
>> return a*b
>>
>> i. e. it needs a statement and an exp
On Oct 3, 1:26 am, Bruno Desthuilliers wrote:
> robean a crit :
>
> > I have been learning Python for the last 3 months or so and I have a
> > working (but somewhat patchy) sense of the the language. I've been
> > using a couple of the more popular Python books as well as online
> > resources.
>
>
Hi all,
I have a very basic question. I was wondering if I can have a function in a
separate file and in my main file sort of import that function and if so are
all the variables local and if I need any variables in the function I should
give it as an input?
I need to call a function in many diff
On Sat, 04 Oct 2008 22:57:23 +0200, Martin Geisler wrote:
> Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
>
>> On Sat, 04 Oct 2008 13:14:40 +0200, Peter Otten <[EMAIL PROTECTED]>
>> declaimed the following in comp.lang.python:
>>
>>> In 3.0 it has to be rewritten as
>>>
>>> def f(ab):
>>> a,
On Sat, 04 Oct 2008 17:07:14 +0200, Martin Geisler wrote:
> A somewhat related question: do I pay a performance penalty when I let a
> function define an inner function like this:
>
> def foo():
>
> def bar()
> ...
>
> bar()
>
> compared to just defining it once outside:
>
>
On Sat, 04 Oct 2008 10:57:25 -0400, Terry Reedy wrote:
> guillaume weymeskirch wrote:
>> Hello everybody,
>>
>>
>> To test the python 2.5 garbage collector, I wrote a trivial script
>> allocating dummy objects of various sizes, then forgetting them in a
>> loop. The garbage collector seems worki
On Sat, 04 Oct 2008 18:36:28 +0200, Bruno Desthuilliers wrote:
>> Yes I know that sets have a remove method (like lists), but since
>> dictionaries don't have a remove method, shouldn't sets behave like
>> more like dictionaries and less like lists? IMHO del for sets is quite
>> intuitive.
>
> F
Marc 'BlackJack' Rintsch wrote:
On Fri, 03 Oct 2008 19:10:27 +1200, greg wrote:
(BTW, try doing that with the x.len() notation!)
def size(obj):
return obj.len()
or
size = operator.methodcaller('len')
No, what I meant was that if the normal way of getting
the len of something were t
Bruno Desthuilliers wrote:
Nope. But IIRC, one-class-per-file helps saving on compile/link time. A
problem we don't have with dynamic languages !-)
That's mostly true. Although I've noticed that if I have
a very large .py file, it can take a noticeable number
of moments to regenerate the .pyc
Hrvoje Niksic wrote:
Common Lisp behaves similar to Python in this
regard:
* (loop for i from 0 to 2 collect (lambda () i))
I wouldn't call the CL loop macro the equivalent of
a for-loop. It's more like a while-loop.
The Lisp equivalent of a Python for-loop would be
to use one of the mapping
hai,
i am srinu from india. i am sending a blog url for yours use.
click on the blog and get more information to choose yours job.
the blog url is:
http://earnmonthlyincome.blogspot.com/
goodluck
--
http://mail.python.org/mailman/listinfo/python-list
Dear all,
could somebody please just put an end to the unicode mysery I'm in,
men... The situation is that I have a Tkinter program that let's the
user enter data in some Entries and this data needs to be transformed
to the encoding compatible with an .rtf-file. In fact I only need to
do some of t
On Oct 3, 4:38 pm, Pat <[EMAIL PROTECTED]> wrote:
> I've been searching for a good multi-module lint checker for Python and
> I haven't found one yet.
>
> Pylint does a decent job at checking for errors only within a single module.
>
> Here's one of my problems. I have two modules.
>
> In module o
Maryam Saeedi wrote:
Hi all,
I have a very basic question. I was wondering if I can have a function
in a separate file
Yes, the separate file become a module.
and in my main file sort of import that function and
Yes. either of
import somemod # and use somemod.func
from somemod import f
[HCB]
The book "Code Complete" recommends that you put only one class in a
source file, which seems a bit extreme for me.
IMO this is a misunderstanding (by the author). In Python, a file is
not equivalent to a class, it is equivalent to a module. A module
might contain a single class or
On 10月4日, 上午5时38分, "Valery Khamenya" <[EMAIL PROTECTED]> wrote:
> Hi all
>
> things like urllib.quote(u"пиво Müller ") fail with error message:
> : u'\u043f'
>
> Similarly with urllib2.
>
> Anyone got a hint?? I need it to form the URI containing non-ascii chars.
> thanks in advance,
> best regards
Terrence Brannon <[EMAIL PROTECTED]> wrote:
>
>Now, I improved this function this way:
>
>def calc_profit(std_clicks, vip_clicks, ad_rate=200,
>upline_status=None):
>clicks = {}
>clicks['std'] = std_clicks
>clicks['vip'] = vip_clicks
You can also write it this way.
clicks = {
> s_str=repr(s.encode('UTF-8'))
It would be easier to encode this in cp1252 here, as this is apparently
the encoding that you want to use in the RTF file, too. You could then
loop over the string, replacing all bytes >= 128 with \\'%.2x
As yet another alternative, you could create a Unico
I want to use sftp from paramiko to copy a file from a windows machine to a
Linux in the network, I use this code :
host = "LinuxComputerName" (or its Ip)
port = 22
transport = paramiko.Transport((host, port))
password = "LinuxComputerPassword"
username = "LinuxComputerUserName"
transport.connec
53 matches
Mail list logo