Neil Cerutti writes:
> On 2011-07-29, Dennis Lee Bieber wrote:
>> Fine... So normpath it first...
>>
> os.path.normpath(r'C:/windows').split(os.sep)
>> ['C:', 'windows']
That apparently doesn't distinguish between r'C:\windows' and
r'C:windows'. On Windows the first is an absolute pat
Dennis Lee Bieber wrote:
On Sat, 30 Jul 2011 21:36:41 +1000, Steven D'Aprano
declaimed the following in
gmane.comp.python.general:
Probably because nobody thought about it, but if it had been proposed to
change xrange into an iterator, I'm pretty confident that the suggestion
would have been
OKB (not okblacke) wrote:
You don't need to include extraneous
whitespice to get it to line up
^^
+1 on Python 4 providing whitespice. Should liven things up nicely. :-)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
* Michael Torrie [2011-07-31 03:44]:
> On Jul 29, 2011 6:33 PM, "Michael Poeltl"
> wrote:
> >
> > what about this?
> > >>> ' '.join('/home//h1122/bin///ghi/'.split('/')).split()
> > ['home', 'h1122', 'bin', 'ghi']
> > >>>
>
> Doesn't work on filenames with spaces in them.
you are right; me, I ne
Terry Reedy wrote:
> On 7/30/2011 12:39 PM, bruno.desthuilli...@gmail.com wrote:
>> On 28 juil, 17:39, Ethan Furman wrote:
>>>
>>> --> bool(0) is bool(0)
>>> True
>
>> This test is not reliable
>
> It is in the sense that it will always work -- because False/True are
> doubletone constants and
On 7/30/2011 12:39 PM, bruno.desthuilli...@gmail.com wrote:
On 28 juil, 17:39, Ethan Furman wrote:
--> bool(0) is bool(0)
True
This test is not reliable
It is in the sense that it will always work -- because False/True are
doubletone constants and so documented.
But expr is expr == Tr
On 7/29/11 8:50 PM, Steven D'Aprano wrote:
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
On 2011.07.30 09:43 PM, Rustom Mody wrote:
> I use pyyaml for such. http://yaml.org/
> The builtin json support http://docs.python.org/library/json.html is a bit
> weaker but has the advantage of no extra install
I don't need a format to share or store the data. I'm perfectly content
to pickle the
I use pyyaml for such. http://yaml.org/
The builtin json support http://docs.python.org/library/json.html is a bit
weaker but has the advantage of no extra install
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 29, 2011 6:33 PM, "Michael Poeltl"
wrote:
>
> what about this?
> >>> ' '.join('/home//h1122/bin///ghi/'.split('/')).split()
> ['home', 'h1122', 'bin', 'ghi']
> >>>
Doesn't work on filenames with spaces in them.
--
http://mail.python.org/mailman/listinfo/python-list
Chris Angelico wrote:
> On Sat, Jul 30, 2011 at 4:45 AM, OKB (not okblacke)
> Suppose you want to have a lengthy piece of text embedded in your
> source code, which you will then pass to a GUI widget for display.
> You want the widget to handle word wrap, so you don't want internal
> line breaks g
bruno.desthuilli...@gmail.com wrote:
> On 25 juil, 17:36, "Steven W. Orr" wrote:
>> I have been doing a lot of reading. I'm starting to get it. I think it's
>> really cool as well as dangerous,
>
> Dangerous ??? Why so ? Is there anything "dangerous" in a constructor
> or an initialiser ??? A me
Brian Blais wrote:
On Jul 29, 2011, at 9:22 PM, Steven D'Aprano wrote:
Billy Mays wrote:
Is xrange not a generator? I know it doesn't return a tuple or list, so
what exactly is it?
It's an iterable object.
There are advantages in having xrange (or range in python3) return
an iterable obje
On Sun, Jul 31, 2011 at 1:06 AM, Dennis Lee Bieber
wrote:
> Ah, but what did they change range() into -- I seem to recall
> reading the Python 3.x turned the regular range() into something else...
> (from Python <3.x returning a full list)
>
xrange got renamed to range, as I understand it.
Thomas Jollans wrote:
On 30/07/11 20:39, Ethan Furman wrote:
How it works: since the sys.argv object does yet exist, I create an
object and assign it to sys.argv; then, when Python assigns the actual
argv to sys.argv, my object is tossed, and the __del__ method is called;
the __del__ method is t
Laszlo Nagy wrote:
> 100 functions/second
> installed to global namespace doesn't sound well.
What on earth are you doing needing to use exec to create hundreds of
functions??
Have you considered not using exec at all, and using a good old-fashioned
factory function and closures?
def facto
On 30/07/11 20:39, Ethan Furman wrote:
> How it works: since the sys.argv object does yet exist, I create an
> object and assign it to sys.argv; then, when Python assigns the actual
> argv to sys.argv, my object is tossed, and the __del__ method is called;
> the __del__ method is then able to acces
UnboundLocalError: local variable 'bar' referenced before assignment
This works, though (at least it does on 2.7):
--> exec "def foo():\n\tglobal bar\n\tbar+=1\n\treturn 1\n"
--> bar = 9
--> foo()
1
--> bar
10
Laszlo, why do you think you can't use exec?
I'm sorry, first I was not aware of
As part of my muxer/encoder backend module, I need to store data in its
main class. While each instance won't typically store a lot of data, but
I really want it broken up into distinct categories so that a program
using the module won't need to figure out what piece of data refers to
what (e.g. is
Chris Angelico wrote:
On Sat, Jul 30, 2011 at 8:48 PM, Laszlo Nagy wrote:
the exec statement can be used to execute a def statement. However, I see no
way to change the globals, so I cannot use the exec statement.
A quick test in Python 2.4.5:
exec "def foo():\n\tbar+=1\n\treturn 1\n"
bar=2
On Sat, Jul 30, 2011 at 8:48 PM, Laszlo Nagy wrote:
> the exec statement can be used to execute a def statement. However, I see no
> way to change the globals, so I cannot use the exec statement.
You can't use:
exec "blah blah" in globals()
?
I've not used exec, nor its Python 3 equivalent exe
Hi,
I have a program that generates source code for a function. I need to
compile that function so that it can be executed (relatively) fast
later. In most cases, I'll be generating about 10 functions per second,
and evaluate them frequently. But sometimes I'll have to generate 100
functio
Chris Angelico wrote:
On Sat, Jul 30, 2011 at 7:39 PM, Ethan Furman wrote:
Well, you /could/ have followed the link and read the explanation there...
;)
I tend to avoid clicking random links in posts :)
Ah -- I understand.
How it works: since the sys.argv object does yet exist...
That's
On Sat, Jul 30, 2011 at 7:39 PM, Ethan Furman wrote:
> Well, you /could/ have followed the link and read the explanation there...
> ;)
I tend to avoid clicking random links in posts :)
> How it works: since the sys.argv object does yet exist...
That's the bit I didn't understand. I assume that'
Chris Angelico wrote:
I'm afraid I don't understand this. Why create an object and do the
work in the destructor? When will the destructor be called? Will you
subsequently be overwriting sys.argv with the actual arguments?
This code snippet makes excellent sense if and only if it's executed
befo
On Sat, Jul 30, 2011 at 6:23 PM, Ethan Furman wrote:
> 8<-- sitecustomize.py -
> class SetTitle(object):
> def __del__(self):
> command = ' '.join(sys.argv)
>
> sys.argv = SetTitle()
I'm afraid I don't understand this. Why create an object and do the
work
I came across question http://stackoverflow.com/questions/6485678/ which
has to do with setting the console title from sitecustomize.py. With
some help from the folks on python-win32 (for the title portion ;) I
came up with this:
8<-- sitecustomize.py -
import
On 25 juil, 17:36, "Steven W. Orr" wrote:
> I have been doing a lot of reading. I'm starting to get it. I think it's
> really cool as well as dangerous,
Dangerous ??? Why so ? Is there anything "dangerous" in a constructor
or an initialiser ??? A metaclass is just a class, and a class is just
an
On Sat, Jul 30, 2011 at 5:52 PM, bruno.desthuilli...@gmail.com
wrote:
> On 28 juil, 00:34, rantingrick wrote:
>
>> In Python4000 i'm making it a syntax error to
>> include ANY blank lines in a func/meth body.
>
> Hopefully this is not going to happen.
It will happen when Rick stops ranting and s
On 28 juil, 00:34, rantingrick wrote:
> In Python4000 i'm making it a syntax error to
> include ANY blank lines in a func/meth body.
Hopefully this is not going to happen.
(snip remaining stupidities).
--
http://mail.python.org/mailman/listinfo/python-list
Ken Watford wrote:
On Sat, Jul 30, 2011 at 7:13 AM, ray wrote:
I found that structured data could be presented in Python using a module in
wxPython.
Where am I? I do not know the relationships between the Pythons. I
feel that I am missing something. I started with Python as it has so
much f
On 28 juil, 17:39, Ethan Furman wrote:
>
> --> bool(0) is bool(0)
> True
>
This test is not reliable - a same id can be reused for terms (I have
already seen such things happening). If you want a reliable test, use:
#> a = bool(0)
#> b = bool(0)
#> a is b
True
Note that this still fails to prov
Andrew Berg wrote:
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.
I came up with abstract names (see below) that I don't really like
(because they're so
On 2011.07.30 10:33 AM, Grant Edwards wrote:
> RR must think so, considering how much effort he seems to put into it.
He hasn't replied to his last two troll threads, though. It does seem
odd to write a wall of text and then not respond to replies. To be fair,
though, most replies either mock him o
Hi Terry,
> Ethan's proposal was accepted on python-ideas. In Python 3.3, the classes for
> the singletons None, Ellipsis, and NotImplemented will be callables that
> return the singleton.
Thanks for sharing this news. Its motivating to see this type of
feedback loop because it encourages other
On 2011-07-30, Michael Poeltl wrote:
> join 'Python-Dev'-mailinglist and tell them!
>
> from now on I will just ignore threads you initiated
>
> does trolling really make that much fun?
RR must think so, considering how much effort he seems to put into it.
It
On 7/30/2011 7:13 AM, ray wrote:
I am new to Python and am learning for engineering and scientific
use. For some reason, which I don’t remember, I went to Scipy.org
downloaded the module. I am sure it had explained things but that was
a couple weeks ago and it’s all a blur. So now I am working
On 7/29/2011 8:50 PM, Steven D'Aprano wrote:
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 not always, a flag) then it is usually better off as two
functions.
I do not really underst
On Sat, Jul 30, 2011 at 7:13 AM, ray wrote:
> I found that structured data could be presented in Python using a module in
> wxPython.
>
> Where am I? I do not know the relationships between the Pythons. I
> feel that I am missing something. I started with Python as it has so
> much functionalit
On Jul 30, 2011, at 7:36 AM, Steven D'Aprano wrote:
> xrange objects might be lazily generated, but
> they're also sequence types: you can get their length, and you can index
> them. (However you can't slice them.) Iterators are not sequence types:
> they aren't indexable and you can't get their l
Ethan's proposal was accepted on python-ideas. In Python 3.3, the
classes for the singletons None, Ellipsis, and NotImplemented will be
callables that return the singleton.
It turns out that the reason an exception is now raised is that there
currently is no .__new__ method, so an exception is
Brian Blais wrote:
> On Jul 29, 2011, at 9:22 PM, Steven D'Aprano wrote:
>
>> 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 obj
On Jul 29, 2011, at 9:22 PM, Steven D'Aprano wrote:
> 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
I am new to Python and am learning for engineering and scientific
use. For some reason, which I don’t remember, I went to Scipy.org
downloaded the module. I am sure it had explained things but that was
a couple weeks ago and it’s all a blur. So now I am working in
Pythonxy. One of my activities
Chris Angelico wrote:
> 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):
>
45 matches
Mail list logo