On 7/29/2011 11:25 PM, Andrew Berg wrote:
In case you want to see the code (not complete by a long shot, and they
need to be refactored):
Module -
http://elucidation.hg.sourceforge.net/hgweb/elucidation/elucidation/file/f8da0b15ecca/elucidation.py
CLI app -
http://disillusion-cli.hg.sourceforge.n
Andrew Berg wrote:
The first (and main) project is a module that provides a class for
holding information related to audio/video encoding/muxing and methods
that encode/mux based on that info.
Any ideas?
Multiplexing Audio Video Encoder
MuXaven
--
m harris
FSF ...free as in freedom/
I know I really shouldn't be spending too much time and effort on a
name, but for some reason, it's really bothering me that I can't come up
with good names for the projects I'm working on.
The first (and main) project is a module that provides a class for
holding information related to audio/vide
Rustom Mody writes:
> Ben Finney said:
> > But this is all getting rather generic and abstract. What specific
> > real-world examples do you have in mind?
>
> regex match vs regex search?
That's not showing a real-world example. Where is the code which is
prone to “lots of shared code but can't
Steven D'Aprano wrote:
As for True and False, bool has to be able to return them, because the whole
purpose of exposing bool is so people can call it: if bool(some_value) was
an error, that would defeat the purpose of having bool!
Bool is different, because it doubles as a function for
coercin
On 2011.07.29 08:57 PM, Ben Finney wrote:
> If they share a lot of code, either it *is* separable to common
> functions (in which case, implement it that way), or the “same thing”
> code is sufficiently complex that it's better to show it explicitly.
>
> But this is all getting rather generic and
Ben Finney said:
> But this is all getting rather generic and abstract. What specific
> real-world examples do you have in mind?
regex match vs regex search?
--
http://mail.python.org/mailman/listinfo/python-list
Andrew Berg writes:
> On 2011.07.29 07:50 PM, Steven D'Aprano wrote:
> > Especially if the implementation looks like this:
> >
> > def get_thing(argument, flag):
> > if flag:
> > return one_thing(argument)
> > else:
> > return another_thing(argument)
> >
> Well, that wou
Billy Mays wrote:
> Is xrange not a generator? I know it doesn't return a tuple or list, so
> what exactly is it?
xrange pre-dates generators by approximately forever. It returns a
special "xrange object", which generates values suitable for use in
for-loops using the old __getitem__ protocol.
On 2011.07.29 07:50 PM, Steven D'Aprano wrote:
> Especially if the implementation looks like this:
>
> def get_thing(argument, flag):
> if flag:
> return one_thing(argument)
> else:
> return another_thing(argument)
>
Well, that would be annoying, but wouldn't it be even mo
Teemu Likonen wrote:
> * 2011-07-29T10:22:04-07:00 * wrote:
>
>> * New path module will ONLY support one path sep! There is NO reason
>> to support more than one.
>
> Pathnames and the separator for pathname components should be abstracted
> away, to a pathname object.
Been there, done that,
Carl Banks wrote:
> It's not even fullproof on Unix.
>
> '/home//h1122/bin///ghi/'.split('/')
>
> ['','home','','bin','','','ghi','']
What? No. Absolutely not -- that would be a major bug. Did you actually try
it?
>>> '/home//h1122/bin///ghi/'.split('/')
['', 'home', '', 'h1122', 'bin', '', '
Andrew Berg wrote:
> os.path.exists(path, ignoreSymLnks=False)
> I actually agree with you on these, which I suppose is interesting.
Guido has a rule of thumb: "No constant arguments". Or another way to put
it: if a function takes an argument which is nearly always a constant
(usually, but n
join 'Python-Dev'-mailinglist and tell them!
from now on I will just ignore threads you initiated
does trolling really make that much fun?
* rantingrick [2011-07-29 19:25]:
>
> --
> Overview of Problems:
> -
* Alexander Kapps [2011-07-29 22:30]:
> On 29.07.2011 21:30, Carl Banks wrote:
>
>> It's not even fullproof on Unix.
>>
>> '/home//h1122/bin///ghi/'.split('/')
>>
>> ['','home','','bin','','','ghi','']
what about this?
>>> ' '.join('/
On 7/29/2011 1:22 PM, rantingrick wrote:
* Introduce a new method named "partition" which (along with string
splitting methods) will replace the six methods "basename", "dirname",
"split", "splitdrive", "splitunc", "splittext". The method will return
a tuple of the path split into four parts:
On Fri, Jul 29, 2011 at 5:01 PM, Ian Kelly wrote:
> On Mon, Jul 25, 2011 at 11:46 AM, Jack Bates wrote:
>> How can you get a descriptor to return an identical value, each time
>> it's called with the same "instance" - without leaking memory?
Oops, that should have been:
class MyDescriptor(objec
On Mon, Jul 25, 2011 at 11:46 AM, Jack Bates wrote:
> How can you get a descriptor to return an identical value, each time
> it's called with the same "instance" - without leaking memory?
class MyDescriptor(object):
def __get__(self, instance, owner):
try:
return instance.
How can you get a descriptor to return an identical value, each time
it's called with the same "instance" - without leaking memory?
#!/usr/bin/env python
class descriptor:
class __metaclass__(type):
def __get__(self, instance, owner):
...
class owner:
descriptor = descriptor
inst
On 30/07/11 00:29, Peter Irbizon wrote:
>> (Don't feel you need to answer this: Do you really think you need
> on-the-fly language switching? It's "cool", but how many users are going
> to want to use that?)
> yes, you're right. anyway it's cool feature and I hoped it's easy to do
> it in python /
> (Don't feel you need to answer this: Do you really think you need
on-the-fly language switching? It's "cool", but how many users are going
to want to use that?)
yes, you're right. anyway it's cool feature and I hoped it's easy to do it
in python / but it isn't...
> Why do you want to change it?
On Sat, Jul 30, 2011 at 6:42 AM, Peter Otten <__pete...@web.de> wrote:
> def format_pairs(pairs):
> for template, value in pairs:
> if value is None:
> break
> yield template.format(value)
>
Cool! May I suggest a trifling change:
def format_pairs(*pairs):
for t
On Sat, Jul 30, 2011 at 6:44 AM, Corey Richardson wrote:
> Excerpts from rantingrick's message of Fri Jul 29 13:22:04 -0400 2011:
>> * New path module will ONLY support one path sep!
>
> People who use windows are used to \ being their pathsep. If you show
> them a path that looks like C:/whateve
On 2011.07.29 04:21 PM, Alister Ware wrote:
> instead of all this negativity why don't you try being productive for a
> change either make a suggestion for an addition (ie something that does
> not yest exits) or better yet give us all the benefit of your supreme
> coding talent & provide some c
On Fri, 29 Jul 2011 10:22:04 -0700, rantingrick wrote:
> --
> Overview of Problems:
> --
>
> * Too many methods exported.
> * Poor choice of method names.
> * Non public classes/methods exported!
>
On Sat, Jul 30, 2011 at 4:45 AM, OKB (not okblacke)
wrote:
> Chris Angelico wrote:
>> That mandates that formatting NOT be a part of the language. I could
>> take C code and reformat it in various ways with a script, and easily
>> guarantee that the script won't affect the code by simply having it
On Sat, Jul 30, 2011 at 5:40 AM, Josh Benner wrote:
> I'm writing a function to create a string that gets longer iff an argument
> is defined. In there a more elegant way than nesting all those ifs?
Your logic appears to be: Proceed along a specified list and stop when
you find that you don't ha
Excerpts from rantingrick's message of Fri Jul 29 13:22:04 -0400 2011:
> --
> Proposed new functionality:
> --
>
> * New path module will ONLY support one path sep! There is NO
> reason to support more
Josh Benner wrote:
> I'm writing a function to create a string that gets longer iff an argument
> is defined. In there a more elegant way than nesting all those ifs?
>
> def format_rsync_src_string(args, server="RSYNC"):
> """ Format an rsync source directory string. """
> if args.server
On Fri, Jul 29, 2011 at 3:36 PM, Billy Mays wrote:
> Is xrange not a generator? I know it doesn't return a tuple or list, so
> what exactly is it? Y doesn't ever complete, but x does.
>
> x = (i for i in range(10))
> y = xrange(10)
xrange() does not return a generator. It returns an iterable x
On 29/07/11 19:52, Rustom Mody wrote:
> MRAB wrote:
> > findall returns a list of tuples (what the groups captured) if there
> is more than 1 group,
> > or a list of strings (what the group captured) if there is 1 group,
> or a list of
> > strings (what the regex matched) if there are no groups.
>
On 29/07/11 21:36, Billy Mays wrote:
> Is xrange not a generator? I know it doesn't return a tuple or list,
> so what exactly is it? Y doesn't ever complete, but x does.
>
> x = (i for i in range(10))
> y = xrange(10)
>
> print "===X==="
> while True:
> for i in x:
> print i
>
On Sat, Jul 30, 2011 at 3:22 AM, rantingrick wrote:
> ~
> 3. Non Public Names Exposed!
> ~
>
> * genericpath
> * os
> * stat
> * sys
> * warnings
>
And you intend to do what, exactly, with these?
> - splitunc --> Unix specific!
1) So?
2) ht
On 29.07.2011 21:30, Carl Banks wrote:
It's not even fullproof on Unix.
'/home//h1122/bin///ghi/'.split('/')
['','home','','bin','','','ghi','']
The whole point of the os.path functions are to take care of whatever oddities
there are in the path system. When you use string manipulation to m
On Fri, Jul 29, 2011 at 1:07 PM, Wolfgang Rohdewald
wrote:
> On Freitag 29 Juli 2011, Josh Benner wrote:
> > if args.build not None:
>
> which python version understands this?
>
> --
> Wolfgang
>
Apparently the version running in my head understands it ;-)
Sorry about that how about this (replac
* 2011-07-29T10:22:04-07:00 * wrote:
> * New path module will ONLY support one path sep! There is NO reason
> to support more than one.
Pathnames and the separator for pathname components should be abstracted
away, to a pathname object. This pathname object could have a "path" or
"directory" sl
On Freitag 29 Juli 2011, Josh Benner wrote:
> if args.build not None:
which python version understands this?
--
Wolfgang
--
http://mail.python.org/mailman/listinfo/python-list
Dnia Fri, 29 Jul 2011 14:41:22 -0500, harrismh777 napisał(a):
> The backslash sep is an asinine CPM/80 | DOS disk based carry-over which
> does not fit well with the modern forward direction. The disk based file
> system carry-over is bad enough; but, propagating multiple ways of doing
> simple
Billy Mays wrote:
Is xrange not a generator? I know it doesn't return a tuple or list, so
what exactly is it? Y doesn't ever complete, but x does.
range(n) creates a list containing all the integers 0..n-1. This
is a problem if you do range(100), because you'll end up with a >4Mb
l
Andrew Berg wrote:
* New path module will ONLY support one path sep! There is NO reason
to support more than one. When we support more than one path sep we
help to propagate multiplicity.We should only support the slash and
NOT the backslash across ALL OS's since the slash is more widely
a
I'm writing a function to create a string that gets longer iff an argument
is defined. In there a more elegant way than nesting all those ifs?
def format_rsync_src_string(args, server="RSYNC"):
""" Format an rsync source directory string. """
if args.server is None:
raise CopyNigh
Is xrange not a generator? I know it doesn't return a tuple or list, so
what exactly is it? Y doesn't ever complete, but x does.
x = (i for i in range(10))
y = xrange(10)
print "===X==="
while True:
for i in x:
print i
break
else:
break
print "===Y==="
while T
On Thursday, July 28, 2011 2:31:43 PM UTC-7, Ian wrote:
> On Thu, Jul 28, 2011 at 3:15 PM, Emile van Sebille wrote:
> > On 7/28/2011 1:18 PM gry said...
> >>
> >> [python 2.7] I have a (linux) pathname that I'd like to split
> >> completely into a list of components, e.g.:
> >> '/home/gyoung/ha
Thomas Rachel wrote:
> class AllList(list):
> """list which can be called in order to be used as a
> __all__-adding
> decorator"""
Wow, this is a great idea.
--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path,
Chris Angelico wrote:
> On Thu, Jul 28, 2011 at 4:18 PM, OKB (not okblacke)
>> I think exactly the opposite. The source file should re flect
>> the semantic organization of the code, without extraneous concessions
>> to visual display (like "lining things up" with spaces or splitting
>> lo
On 2011.07.29 12:22 PM, rantingrick wrote:
> * New path module will ONLY support one path sep! There is NO reason
> to support more than one. When we support more than one path sep we
> help to propagate multiplicity.We should only support the slash and
> NOT the backslash across ALL OS's since th
MRAB wrote:
> findall returns a list of tuples (what the groups captured) if there is
more than 1 group,
> or a list of strings (what the group captured) if there is 1 group, or a
list of
> strings (what the regex matched) if there are no groups.
Thanks.
It would be good to put this in the manual
On 07/29/2011 07:46 AM, Roy Smith wrote:
It's often said that you shouldn't try to guess what's slow, but use
profiling tools to measure what's slow. I had a great example of that
yesterday. ...
Yes.
My first experience of profiling was about 25 years ago. I was
experimenting with Borland'
--
Overview of Problems:
--
* Too many methods exported.
* Poor choice of method names.
* Non public classes/methods exported!
* Duplicated functionality.
On 2011.07.29 10:12 AM, Ciantic wrote:
class MyObject(object):
> ... pass
> ...
my = MyObject()
my.myvar = 'value' # No error!
obj = object()
obj.myvar = 'value' # Causes error!
> Traceback (most recent call last):
> File "", line 1, in
> AttributeError: 'objec
On 29/07/11 17:12, Ciantic wrote:
class MyObject(object):
> ... pass
> ...
my = MyObject()
my.myvar = 'value' # No error!
obj = object()
obj.myvar = 'value' # Causes error!
> Traceback (most recent call last):
> File "", line 1, in
> AttributeError: 'object' ob
On 29/07/2011 16:45, Thomas Jollans wrote:
On 29/07/11 16:53, rusi wrote:
Can someone throw some light on this anomalous behavior?
import re
r = re.search('a(b+)', 'ababbaaab')
r.group(1)
'b'
r.group(0)
'ab'
r.group(2)
Traceback (most recent call last):
File "", line 1, in
IndexErr
Am 29.07.2011 17:12 schrieb Ciantic:
class MyObject(object):
... pass
...
my = MyObject()
my.myvar = 'value' # No error!
obj = object()
obj.myvar = 'value' # Causes error!
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'object' object has no attribute 'myvar'
>>> class MyObject(object):
... pass
...
>>> my = MyObject()
>>> my.myvar = 'value' # No error!
>>>
>>> obj = object()
>>> obj.myvar = 'value' # Causes error!
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'object' object has no attribute 'myvar'
Why simple inherita
On 29/07/11 16:53, rusi wrote:
> Can someone throw some light on this anomalous behavior?
>
import re
r = re.search('a(b+)', 'ababbaaab')
r.group(1)
> 'b'
r.group(0)
> 'ab'
r.group(2)
> Traceback (most recent call last):
> File "", line 1, in
> IndexError: no such gr
On 29/07/11 13:02, Peter Irbizon wrote:
> Hello,
>
> how could I change STOCK_SAVE label text? I would like to have "Save
> it!" instead of "Save"
> And other question related to this is how can I change translation of
> STOCK_SAVE on the fly? I think I need to set locale for pygtk...but
> don't
Can someone throw some light on this anomalous behavior?
>>> import re
>>> r = re.search('a(b+)', 'ababbaaab')
>>> r.group(1)
'b'
>>> r.group(0)
'ab'
>>> r.group(2)
Traceback (most recent call last):
File "", line 1, in
IndexError: no such group
>>> re.findall('a(b+)', 'ababbaaab')
['
On 07/26/2011 11:19 AM, Eldon Ziegler wrote:
Is there a way to have the Python processor look only for bytecode
files, not .py files? We are seeing huge numbers of Linux audit messages
on production system on which only bytecode files are stored. The audit
subsystem is recording each open failure
Am 29.07.2011 14:51 schrieb John Roth:
Sorry. I thought what you posted was from the OP. I guess I don't
really expect someone to post a completely irrelevant trace in a
thread started by someone who has a problem.
In what way do you find the trace irrelevant? It clearly shows that it
is not
On Fri, Jul 29, 2011 at 8:51 AM, John Roth wrote:
> Sorry. I thought what you posted was from the OP. I guess I don't
> really expect someone to post a completely irrelevant trace in a
> thread started by someone who has a problem.
I'm not sure why you would think that that post was by the origin
On 07/29/2011 03:42 PM, Web Dreamer wrote:
whitespace_split = True
Thanks for the tip!
Cheers
Karim
--
http://mail.python.org/mailman/listinfo/python-list
Alan Meyer wrote:
> This is not properly portable to all OS, but you could simply split on
> the slash character, e.g.,
>
> pathname.split('/')
more portable pathname.split(os.sep)
--
http://mail.python.org/mailman/listinfo/python-list
John Roth wrote:
ACK. That is exactly what I wanted to show. (With the difference that
this is probably nt the bash, but the linux loader trying to link a .so,
but for the problem, it doesn't make any difference.)
Sorry. I thought what you posted was from the OP. I guess I don't
really expect s
On Jul 27, 8:56 am, Thomas Rachel wrote:
> Am 27.07.2011 14:18 schrieb John Roth:
>
> > Two comments. First, your trace isn't showing attempts to open .py
> > files, it's showing attempts to open the Curses library in the bash
> > directory.
>
> Of course. My goal was to show that the OP's "proble
On 2011-07-29, Dennis Lee Bieber wrote:
> On Thu, 28 Jul 2011 15:31:43 -0600, Ian Kelly
> declaimed the following in
> gmane.comp.python.general:
>
>> Using os.sep doesn't make it cross-platform. On Windows:
>>
>> >>> os.path.split(r'C:\windows')
>> ('C:\\', 'windows')
>> >>> os.path.split(r'C:/
Pedro Larroy wrote:
> Just crossposting this from stackoverflow:
>
> http://stackoverflow.com/...
>
> Any hints?
At first I was just too lazy to visit stackoverflow and skipped this
posting. Then I thought: Why didn't you include the content, so people can
actually answer this question here? T
It's often said that you shouldn't try to guess what's slow, but use
profiling tools to measure what's slow. I had a great example of that
yesterday. We have some web server code that does a big database
(MongoDB) query and some post-processing of the data in python. It
worked fine in testin
Hello,
how could I change STOCK_SAVE label text? I would like to have "Save it!"
instead of "Save"
And other question related to this is how can I change translation of
STOCK_SAVE on the fly? I think I need to set locale for pygtk...but don't
know how
--
http://mail.python.org/mailman/listinfo/py
On Thu, Jul 28, 2011 at 4:18 PM, OKB (not okblacke)
wrote:
> Thomas 'PointedEars' Lahn wrote:
>> Automatic word-wrap, where available, really is not a solution; it
>> is a bad workaround to a problem caused by the original author of
>> the source code that can be easily avoided by them taking mor
> Well, it depends on how you're constructing your interface. If you're
> creating all the widgets in Python code, you could move all your
> foo.text = "Bar"; statements to one method that updates the text for all
> widgets, and call that both from the constructor and from the
> language-switching
On 07/29/2011 08:37 AM, Thomas Rachel wrote:
Am 28.07.2011 20:01 schrieb Ian Kelly:
The advantage of Thomas's decorator here is that it lets you place the
denotation of whether a function is exported alongside its definition,
whereas simply declaring the __all__ list forces you to separate them
Hello geeks, I have this code in my app:
self.menu_items = (
( "/_Languages", None,None, 0, "" ),
( "/Languages/_english", None,self.print_lang, 0, ""
),
( "/Languages/_german", None,self.print_lang, 0, ""
),
)
self.vbox = gt
On 29/07/11 11:18, Peter Irbizon wrote:
> Hello Thomas,
>
> > The usual way of using gettext is to use the system locale to determine
> > the right language. Of course, you can have different translations and
> > install() them (I expect), but you'll have to re-load all the strings
> > displayed
On 07/29/2011 09:24 AM, Web Dreamer wrote:
Nobody a écrit ce jeudi 28 juillet 2011 18:37 dans
:
On Thu, 28 Jul 2011 17:48:34 +0200, Web Dreamer wrote:
I would like to parse this TCL command line with shlex:
'-option1 [get_rule A1 B2] -option2 $VAR -option3 TAG'
s = s.replace('[','"[')
s =
Hello Thomas,
> The usual way of using gettext is to use the system locale to determine
> the right language. Of course, you can have different translations and
> install() them (I expect), but you'll have to re-load all the strings
> displayed in your application when you switch language, which m
hello Chris,
I am using pygtk.
2011/7/29 Chris Rebert
> On Thu, Jul 28, 2011 at 6:20 PM, Peter Irbizon
> wrote:
> > hello,
> > I am using gettext fo localization
>
> > Now I would like to switch all texts in my app when I click on item in
> menu.
> > Unfortunatelly this not switch texts immed
Thomas,
A ha! Now I feel all warm and fuzzy inside. It's nice to start the day with
learning something new.
To be honest, the initial problem was that I didn't understand the meaning
of '__all__', again probably from not working in the large with python.
After posting, I went and had another go a
77 matches
Mail list logo