Bruno Desthuilliers wrote:
> Bjoern Schliessmann a écrit :
>> You can't just declare in Python, you always define objects (and
>> bind a name to them).
>
> def toto():
>global p
>p = 42
>
> Here I declared 'x' as global without defining it.
Ah well, someone had to notice it ...
BTW, wh
On Nov 2, 2:45 pm, [EMAIL PROTECTED] wrote:
> Hello, I have been sorting a list of dicts using the following
> function:
>
> result_rs = sorted(unsort_rs, key=itemgetter(orderby))
>
> and this works fine. Now I am looking to perform a subsort as well.
> For example, I have this:
>
> test = [{'name'
On Nov 2, 2:32 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> On Nov 2, 2007 3:04 PM, Beema shafreen <[EMAIL PROTECTED]> wrote:
>
>
>
> > hi everybody,
> > i have a file:
>
> > A_16_P21360207#304
> > A_14_P136880#783
> > A_16_P21360209#795
> > A_16_P21360210#173
> > A_16_P03641959#1177
> > A_16_P0
Jim Hendricks wrote:
> This sounds like an issue of terminology. I understand that I
> don't declare variables like I would in C or Java, but that they
> are implicitly declared via the first assignment.
I think yes, it's an issue of terminology. As mentioned I used the
terms I know from C/C++,
Carl Banks wrote:
>
> AOP is a programming paradigm in the same way indie is a genre of
> film.
I like your explanation! Heck, if it were more directly Python-related,
I'd nominate this line for QOTW.
--
http://mail.python.org/mailman/listinfo/python-list
>>> def test_func():
... pass
...
>>> import new
>>> test_func2 = new.function(test_func.func_code, {}, "test_func2")
>>> test_func2
>>> test_func
>>> import timeit
>>> tf = timeit.Timer("test_func()", "from __main__ import test_func")
>>> tf.repeat()
[0.2183461704377247, 0.18068215314489791,
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I would want to sort by name first, then sub sort by location. Any
> ideas? Thanks!
In Python 2.3 and later, sorting is stable -- so you can sort successively
in reverse order. In other words, sort the list by location, then sort th
Is the main Python tutorial posted on single searchable page
somewhere? As opposed to browsing the index and clicking NEXT etc.
Thank you,
rd
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 2, 3:36 pm, "Andrew Koenig" <[EMAIL PROTECTED]> wrote:
> <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
>
> > I would want to sort by name first, then sub sort by location. Any
> > ideas? Thanks!
>
> In Python 2.3 and later, sorting is stable -- so you can sort successively
On Nov 2, 3:36 pm, "Andrew Koenig" <[EMAIL PROTECTED]> wrote:
> <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
>
> > I would want to sort by name first, then sub sort by location. Any
> > ideas? Thanks!
>
> In Python 2.3 and later, sorting is stable -- so you can sort successively
Russ P. wrote:
> I've been programming in python for a few years using XEmacs on
> Solaris and Linux. I've been thinking about trying IDLE for a long
> time, but either it wasn't available on my system or I procrastinated.
> I finally have it available, and I gave it a try.
>
> I immediately encou
I've been programming in python for a few years using XEmacs on
Solaris and Linux. I've been thinking about trying IDLE for a long
time, but either it wasn't available on my system or I procrastinated.
I finally have it available, and I gave it a try.
I immediately encountered a basic problem for
On Nov 2, 9:45 pm, [EMAIL PROTECTED] wrote:
> Hello, I have been sorting a list of dicts using the following
> function:
>
> result_rs = sorted(unsort_rs, key=itemgetter(orderby))
>
> and this works fine. Now I am looking to perform a subsort as well.
> For example, I have this:
>
> test = [{'name'
On Nov 2, 3:08 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> >>> def test_func():
>
> ... pass
> ...>>> import new
> >>> test_func2 = new.function(test_func.func_code, {}, "test_func2")
> >>> test_func2
>
> >>> test_func
>
> >>> import timeit
> >>> tf = timeit.Timer("test_func()", "from __mai
On Fri, 02 Nov 2007 17:08:06 -0500, Chris Mellon wrote:
def test_func():
> ... pass
> ...
import new
test_func2 = new.function(test_func.func_code, {}, "test_func2")
[snip results of timeit]
> Why almost twice the calling overhead for a dynamic function?
When I time the funct
Wondering what experiences people have had using various packages for
extracting data from and manipulating mp3 files. Specifically, i need to get a
song duration, which as i understand it, you extract from the framesets, as
well as the typical id3 stuff like artist, album, song, year, etc. Idea
En Fri, 02 Nov 2007 16:53:12 -0300, matthias
<[EMAIL PROTECTED]> escribió:
> On Nov 2, 12:12 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote:
>> On 11/2/07, matthias <[EMAIL PROTECTED]> wrote:
>>
>> > I know that "-O" turns off assertions in general. However, how do I
>> > pass thus parameter to
On Nov 2, 7:59 am, "Bart." <[EMAIL PROTECTED]> wrote:
> Friday 02 of November 2007 12:21:06 BlueBird napisa (a):
>
>
>
> > On Nov 2, 8:03 am, "Bart." <[EMAIL PROTECTED]> wrote:
> > > Friday 02 of November 2007 01:06:58 Diez B. Roggisch napisa (a):
> > > > > So how to pass this object into embeded p
En Fri, 02 Nov 2007 13:44:37 -0300, Giampaolo Rodola' <[EMAIL PROTECTED]>
escribió:
> On 2 Nov, 05:30, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
>> En Thu, 01 Nov 2007 22:51:14 -0300, Giampaolo Rodola' <[EMAIL PROTECTED]>
>> escribió:
>>
>> > readlink( path)
>>
>> > ...It's not clear to me
on 11/03/2007 06:44 AM Russ P. wrote :
> I've been programming in python for a few years using XEmacs on
> Solaris and Linux. I've been thinking about trying IDLE for a long
> time, but either it wasn't available on my system or I procrastinated.
> I finally have it available, and I gave it a try.
En Fri, 02 Nov 2007 19:43:23 -0300, BartlebyScrivener
<[EMAIL PROTECTED]> escribió:
> Is the main Python tutorial posted on single searchable page
> somewhere? As opposed to browsing the index and clicking NEXT etc.
The next release will use a different doc format (and different layout
too),
I need something like this:
1: superfoo( non-keyword-args, keyword-args, methodname, *kargs,
*kwargs):
2: """non-keyword-args and keyword-args are arguments that
3: apply to superfoo, while *kargs and **kwargs are
arguments
4: that apply to methodname. See below"""
5:
I have started working on a new project using ZSI and perhaps one can
argue this is a bug in ZSI, but I found it odd. The ZSI dispatcher
needs to catch all exceptions and pass that over to the client; in
doing so, it passes along the name of the exception that occurred so
that the client can know m
I apologize in advance for coming at this from this angle but...
In PHP you have the __FILE__ constant which gives you the value of the
absolute path of the file you're in (as opposed to the main script
file.) With the function dirname, this makes it easy to get the
parent dir of a particular fil
En Fri, 02 Nov 2007 21:07:19 -0300, Matimus <[EMAIL PROTECTED]> escribió:
> On Nov 2, 3:08 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
>> >>> def test_func():
>>
>> ... pass
>> ...>>> import new
>> >>> test_func2 = new.function(test_func.func_code, {}, "test_func2")
>> >>> test_func2
>>
>> >
I find these viewpoints interesting in their divergence. At the risk
of being simplistic:
Kay: AOP == AspectJ or thereabouts. A failure in itself and
uninteresting to pythonistas
Michele: AOP not very interesting though does good work himself in
decorators, metaclasses and other such AOPish stuf
The __file__ attribute is present when you run a script from a file.
If you run from the interactive interpreter, it will raise a
NameError. Likewise, I believe that in earlier versions of Python
(2.1? Pre 2.2?) it was only set within imported modules. I've used the
'os.path.realpath(os.pat
On Nov 2, 2:14 pm, matthias <[EMAIL PROTECTED]> wrote:
> Here is my question: How do I maintain debug / release builds that
> allow me to switch
> debug stmts, like assert, on / off ?
If you want to distribute a single-file optimized version, perhaps
embedding the Python code as a here-file in a
En Fri, 02 Nov 2007 08:58:32 -0300, gert <[EMAIL PROTECTED]> escribió:
> Could not one of you just say "@staticmethod" for once damnit :)
Do we have to read your mind now? You miss-typed the method names the
first time. You could equally have forgotten to type the 'self' parameter.
Don't you
Wondering what experiences people have had using various packages for
extracting data from and manipulating mp3 files. Specifically, i need
to get a song duration, which as i understand it, you extract from the
framesets, as well as the typical id3 stuff like artist, album, song,
year, etc. Ideally
On Nov 3, 12:17 am, "Rustom Mody" <[EMAIL PROTECTED]> wrote:
> My own feeling: Python is more AOP ready than java. So lighter-weight
> techniques like Michele's decorator should go further. But
> methodology not yet formulated.
To clarify: my view is that lightweight techniques are enough and
tha
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Nov 2, 5:47 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>>
>> Pyparsing is no recursive descent parser. It doesn't go back in the
>> input
>> stream. The ``OneOrMore(Word(alphas))`` part "eats" the 'end
On Fri, 02 Nov 2007 19:36:05 -0700, Scott Dial wrote:
> I have started working on a new project using ZSI and perhaps one can
> argue this is a bug in ZSI, but I found it odd. The ZSI dispatcher needs
> to catch all exceptions and pass that over to the client; in doing so,
> it passes along the na
En Fri, 02 Nov 2007 13:38:07 -0300, Jim Hendricks
<[EMAIL PROTECTED]> escribió:
> New to Python, and just had something strange happen.
>
> I've been running my new code in IDLE running in windows. My IDLE
> version shows as 1.2.1, Python version displaying in IDLE is 2.5.1.
>
> I have been edi
hi, evrybody
I have file
A_16_P21360207304
A_14_P136880783
A_16_P21360209795
A_16_P21360210173
A_16_P036419591177
A_16_P036419601944
A_16_P03641962999
A_16_P41563648-31
A_16_P036419633391
A_16_P415636493626
A_16_P03641964180
A_16_P415636551216
A_1
hi
i am looking for some info about mapping btw values in an array and
corresponding columns of a matrix
i have an numpy array=[11.0,33.0,22.0,55.0,44.0]
and a numpy matrix object=
matrix(([1.3,2.5,3.2,6.7,3.1],
[9.7,5.6,4.8,2.5,2.2],
"Bruno Desthuilliers" wrote:
>functions are *not* methods of their module.
Now I am confused - if I write:
result = foo.bar(param)
Then if foo is a class, we probably all agree that bar is
a method of foo.
But the same syntax would work if I had imported some
module as foo.
So what's the dif
[EMAIL PROTECTED] wrote:
> hi
> i am looking for some info about mapping btw values in an array and
> corresponding columns of a matrix
>
> i have an numpy array=[11.0,33.0,22.0,55.0,44.0]
> and a numpy matrix object=
>matrix(([1.3,2.5,3.2,6.7,3.1],
>
I am confused by the following program:
def f():
print x
x=12345
f()
result is:
>>>
12345
however:
def f():
print x
x=0
x=12345
f()
result is:
Traceback (most recent call last):
File "...\test.py", line 5, in ?
f()
File "...\test.py", line 2, in f
print x
UnboundLocalEr
Beema shafreen wrote:
8< --- file
>my script:
>
>#!/usr/bin/env python
>
>
>fh = open('complete_span','r')
>line = fh.readline().split('#')
>old_probe = line[0].strip()
>old_value = line[1].strip()
>print old_probe, old_value
>count = 1
Better to start the c
On Sat, 03 Nov 2007 07:18:17 +, Sullivan WxPyQtKinter wrote:
> def f():
> print x
> x=0
>
> x=12345
> f()
>
> result is:
> Traceback (most recent call last):
> File "...\test.py", line 5, in ?
> f()
> File "...\test.py", line 2, in f
> print x
> UnboundLocalError: local v
On Sat, 03 Nov 2007 07:18:17 +, Sullivan WxPyQtKinter wrote:
> I am confused by the following program:
>
> def f():
> print x
> x=12345
> f()
>
> result is:
> 12345
If python can't discover x in your current scope and you do not bind to
it there, it will automatically access that
On Sat, 03 Nov 2007 08:36:24 +0200, Hendrik van Rooyen wrote:
> "Bruno Desthuilliers" wrote:
>
>>functions are *not* methods of their module.
>
> Now I am confused - if I write:
>
> result = foo.bar(param)
>
> Then if foo is a class, we probably all agree that bar is a method of
> foo.
There
101 - 143 of 143 matches
Mail list logo