Nikola Skoric wrote:
> Is there a way of making 'utf-8' default codec for the whole program, so
> I don't have to do .encode('utf-8') every time I print out a string?
Explicit is better than implicit (so setting up a default codec is
considered bad practice). However, you could wrap an output de
Richard Townsend wrote:
> On Fri, 24 Feb 2006 18:21:59 +0100, Magnus Lycka wrote:
>>Concerning element names, it's your coice of course, but I agree
>>more and more with Guido and PEP008 that camelCase is ugly. (Not
>>that ALLCAPS is better...)
>
> I can see in PEP008 where it says Capitalized_Wor
On Mon, 27 Feb 2006 03:13:08 -0600,
Tim Chase <[EMAIL PROTECTED]> wrote:
> Same could go for days of the week:
dow=enum(("sunday", 0), ("monday", 1),
> ("start_of_work_week", 1), ... ("friday", 5),
> ("end_of_work_week", 5)...)
Not really: In some parts of the world, calendar weeks begin
[EMAIL PROTECTED] wrote:
> Please post your Python code. I don't see the problem you're
> describing.
OK, here's a copy. This works on Mac/Unix/Linux yet has no effect on
Windows:
-
import os
import os.path
for root, dirs, files
[EMAIL PROTECTED] wrote:
> Please post your Python code. I don't see the problem you're
> describing.
OK, here's a copy. This works on Mac/Unix/Linux yet has no effect on
Windows:
-
import os
import os.path
for root, dirs, files
I am trying to do the following using Python and Tkinter:
1) Display a window with 1 button
2) When user clicks the button, Python attempts to call a function
that opens a socket and listens for a connection - what I want to do
is, if the socket has been successfully opened and the system is
wai
On 27 feb 2006, at 10:13, Tim Chase wrote:
>> Uniqueness imposes an odd constraint that you can't have
>> synonyms in the set:
>>
> shades = enum({white:100, grey:50, gray:50, black:0})
>
> Blast, I hate responding to my own posts, but as soon as I
> hit Send, I noticed the syntax here was bif
If I have an enum, how can I verify that it's a legal value? Can I do:
Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')
def foo (day):
if day not in Weekdays:
raise ValueError
Also, do enums have __dict__ slots? Can I do something like:
day = 'sun'
print Weekdays.__d
Don Taylor <[EMAIL PROTECTED]> wrote:
...
> Does Python have the notion of static class attributes?
No.
> Just what was going on when I redefined my __slots__ attribute?
Nothing.
> It looks as if __slots__ is something really special, or I am managing
Yep: it acts at *class-creation time*,
Your tools are:
1. "map" lets you apply a function to every element of a list.
Strings are lists. (List comprehensions let you do the same thing, but
"map" is better to use if you are turning in homework).
2. "sum" lets you calculate the sum of all numbers in a list.
3. "val" and "str" let you
In article <[EMAIL PROTECTED]>,
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> But if you have a good usage case for an empty enum,
> please feel free to tell us.
I could see empty enums being useful in machine-generated code, perhaps
when generating wrappers around C library APIs. There might
How about DBdesigner4 or Dia as free ER diagrammers?
[EMAIL PROTECTED] wrote:
> Thanks Olivier and Jonathan.
>
> Do either of you, or anyone else, know of a good open source data
> modeling / ER-diagram / CASE tools? I'd like to be able to build
> relatively simple schemas in one open source too
Dolmans Sun wrote:
> Kent Johnson wrote:
>> >>> [a for b,a in sorted(zip(B,A))]
>
> also, [a for _,a in sorted(zip(B,A))]
>
> didn't read refs, tested above python-2.2.3.
Is there something here I can't see, or did you just
change a variable name and present that as another
solution?
--
http:
> Uniqueness imposes an odd constraint that you can't have
> synonyms in the set:
>
> >>> shades = enum({white:100, grey:50, gray:50, black:0})
Blast, I hate responding to my own posts, but as soon as I
hit Send, I noticed the syntax here was biffed. Should have
been something like
>>> sha
It is indeed the problem. Thanks.
May be, this fact could have been mentioned in the documentation. I
have suggested the change using bug tracker.
Raghu.
--
http://mail.python.org/mailman/listinfo/python-list
Steve Juranich wrote:
> I might be a little confused about a couple of things (I'm sure many will
> correct me if I'm not), but as I understand it the __slots__ attribute is a
> class-attribute, which means it cannot be modified by an instance of the
> class (think of a "static" class member, if y
Just a couple thoughts:
> An enumeration is an exclusive set of symbolic names bound
> to arbitrary unique values.
Uniqueness imposes an odd constraint that you can't have
synonyms in the set:
>>> shades = enum({white:100, grey:50, gray:50, black:0})
Not a bad thing, as it would then have i
[EMAIL PROTECTED] wrote:
> Let's say I have two dictionaries:
> dict1 is 1:23, 2:76, 4:56
> dict2 is 23:A, 76:B, 56:C
>
> How do I get a dictionary that is
> 1:A, 2:B, 4:C
>
Just copy/paste the following source code to a file and run it:
sourceCodeToExecute = """
dict1 = { 1:23,2:76,
>>Why are empty enumerations not allowed? Empty sets, empty lists,
>>empty dictionaries are all allowed. I don't see any obvious benefits
>>to not allowing empty enumerations.
>
> What is an empty enum? How and when would you use it?
It's a Zen thing :) (agh! not the zen thread!)
>>> roundS
As far as i know, gedit is the weak link, this is because of the way it
handles its whitespaces, had that trouble myself though not this
*severe*
--
http://mail.python.org/mailman/listinfo/python-list
Op 2006-02-27, [EMAIL PROTECTED] schreef <[EMAIL PROTECTED]>:
> Let's say I have two dictionaries:
> dict1 is 1:23, 2:76, 4:56
> dict2 is 23:A, 76:B, 56:C
>
> How do I get a dictionary that is
> 1:A, 2:B, 4:C
Well how about the straight forward:
dict3 = {}
for key, value in dict1.iteritems()
On 27 Feb 2006 04:55:15 -0800, "André" <[EMAIL PROTECTED]> wrote:
>
>Franz Steinhaeusler wrote:
>> On Sun, 26 Feb 2006 10:35:13 -0600, Tim Chase
>> <[EMAIL PROTECTED]> wrote:
>>
>> >Trying to get my feet wet with wxPython (moving from just
>> >command-line apps), I tried the obvious (or, at least
> Let's say I have two dictionaries:
> dict1 is 1:23, 2:76, 4:56
> dict2 is 23:A, 76:B, 56:C
>
> How do I get a dictionary that is
> 1:A, 2:B, 4:C
>>> d1={1:23,2:76,4:56}
>>> d2={23:"a", 76:"b", 56:"c"}
>>> result = dict([(d1k,d2[d1v]) for (d1k, d1v) in d1.items()])
>>> result
{1: 'a', 2
[EMAIL PROTECTED] wrote:
> Let's say I have two dictionaries:
> dict1 is 1:23, 2:76, 4:56
> dict2 is 23:A, 76:B, 56:C
>
> How do I get a dictionary that is
> 1:A, 2:B, 4:C
>
>>> dict1 = {1:23, 2:76, 4:56}
>>> dict2 = {23:'A', 76:'B', 56:'C'}
>>> dict((key, dict2[value]) for key, val
[EMAIL PROTECTED] wrote:
> Let's say I have two dictionaries:
> dict1 is 1:23, 2:76, 4:56
> dict2 is 23:A, 76:B, 56:C
>
> How do I get a dictionary that is
> 1:A, 2:B, 4:C
>
>>> dict1 = {1:23,2:76,4:56}
>>> dict2 = {23:'A',76:'B',56:'C'}
>>> dict((k, dict2[v]) for k, v in dict1.items())
{
Let's say I have two dictionaries:
dict1 is 1:23, 2:76, 4:56
dict2 is 23:A, 76:B, 56:C
How do I get a dictionary that is
1:A, 2:B, 4:C
--
http://mail.python.org/mailman/listinfo/python-list
Hi !
I want to set the temp. build directory that it is does not placed in
python source directory.
I want to set this:
\bin\
compiled version
\src\
python source
\tmp\
temp build dir
How to I do it ?
Thanx for help:
dd
--
http://mail.python.org/mailman/listinfo/python-list
Franz Steinhaeusler wrote:
> On Sun, 26 Feb 2006 10:35:13 -0600, Tim Chase
> <[EMAIL PROTECTED]> wrote:
>
> >Trying to get my feet wet with wxPython (moving from just
> >command-line apps), I tried the obvious (or, at least to me
> >was obvious):
> >
> >Start python, "import wx" and then do a "hel
Nikola Skoric napisał(a):
> Is there a way of making 'utf-8' default codec for the whole program, so
> I don't have to do .encode('utf-8') every time I print out a string?
Bad idea. You may accidentally break some libraries that depend on ASCII
being default & standard.
--
Jarek Zgoda
http://j
>Sounds like homework to me.
Sorry Steven, you may be right, next time I'll be more careful.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Paul Ertz wrote:
> Hello,
>
> We would like to hide the left column for the main/home page of our
> plone sites dynamically using a tal: expression.
Then please post on a Zope/Plone related mailing-list.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]
Hi !
I have an application that I compile to exe.
1.)
I want to compile main.ico into exe, or int zip. Can I do it ?
2.)
Can I compile the result to my specified directory, not into the dist ?
I want to structure my projects like this:
\src\
python codes, etc.
\res\
icons, etc
\bin\
the compiled
Hi there,
Is there a way of making 'utf-8' default codec for the whole program, so
I don't have to do .encode('utf-8') every time I print out a string?
--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across t
Op 2006-02-27, Steven D'Aprano schreef <[EMAIL PROTECTED]>:
> Paul Rubin wrote:
>
>> Ben Finney <[EMAIL PROTECTED]> writes:
>>
>>>Enumerations with no values are meaningless. The exception
>>>``EnumEmptyError`` is raised if the constructor is called with no
>>>value arguments.
>>
>>
>> Why are
Mr BigSmoke wrote:
> Hi All
> how do i include directories into my project when using py2exe? I have
> a module that has it's images directory and when it's searches it (into
> ../dist/library.zip/.../mymodule/) it generates an error because the
> directory wasn't imported...
> tnx
>
> Fabio
>
Yo
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> All of the machinery of the enum class created by Ben Finney is just to
> make sure that red, green and blue behave correctly, without extraneous
> string-like or number-like methods. Of course Ben could modify his code so
> that enum() returned an obje
Hi
I just couldn't google up any docs or tutorial on how to set up
everything necessary to use pycurl on windows.
When I try running the pycurl setup I get a 'CURL_DIR' not found error,
but no where can I find a detailed explanation of what is this dir,
what dlls I need to install and where etc.
Felipe Almeida Lessa <[EMAIL PROTECTED]> writes:
> > If enums aren't supposed to work in that construction then the PEP
> > shouldn't specify that they work that way.
>
> Sorry, but where do they say that?
The PEP gives an example of iterating through the members of an enum.
I'm not sure if that
Simon Percivall wrote:
> The error you're seeing is because you've rebound 'list' to something
> else. Try putting "list = type([])" somewhere above your code.
That's it! I had rebound 'list' earlier (in error), and though I
deleted the code it must have been "remembered" somehow. Restarting
Pyt
Gerard Flanagan wrote:
> Hello all
>
> Could anyone shed any light on the following Exception? The code which
> caused it is below. Uncommenting the 'super' call in 'XmlNode' gives
> the same error. If I make XmlNode a subclass of 'object' rather than
> 'list' then the code will run.
>
> Thanks in
Hi,
I would know how to minimize a program (wxpython app) into an icon on
the taskbar on windows (the one at the side near the clock, i can't
remember what is it called.)
Is it easy to be done? Is there a way to do the same thing on Linux?
Thank You.
--
http://mail.python.org/mailman/
On Mon, 27 Feb 2006 02:31:42 -0800, Allan wrote:
> I'm trying to write a numerology program where I have each letter
> identified by a numerical value like
> a=1
> b=2
> c=3
> as so forth. I then input a name. How do I treat each letter as a
> single value? That is, instead of print myname I have
On Mon, 27 Feb 2006 00:43:45 -0800, Paul Rubin wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>> What is an empty enum?
>
> An empty enum is an enum with no identifiers, just like an empty list
> is a list with no elements.
No, I don't think that is the case. A list is a container. You ca
Allan>I hope this isn't too stupid of a question.
It's a simple problem, but it's not a stupid question, this is a
possible solution:
data = "myname"
radix = str(sum(ord(c)-96 for c in data))
while len(radix) > 1:
radix = str(sum(int(c) for c in radix))
print "The radix of:\n", data, "\n\nIs:
Em Seg, 2006-02-27 às 02:42 -0800, Paul Rubin escreveu:
> Felipe Almeida Lessa <[EMAIL PROTECTED]> writes:
> > IMHO, you should be using sets, not enums. Something like:
>
> If enums aren't supposed to work in that construction then the PEP
> shouldn't specify that they work that way.
Sorry, but
Kent Johnson wrote:
> >>> [a for b,a in sorted(zip(B,A))]
also, [a for _,a in sorted(zip(B,A))]
didn't read refs, tested above python-2.2.3.
--
Sun Yi Ming
you can logout any time you like,
but you can never leave...
--
http://mail.python.org/mailman/listinfo/python-list
Felipe Almeida Lessa <[EMAIL PROTECTED]> writes:
> > print_members('shorter:', months_shorter_than_february)
> > print_members('longer:', months_longer_than_february)
>
> IMHO, you should be using sets, not enums. Something like:
If enums aren't supposed to work in that construction then
Etienne Desautels wrote:
> Everything works well but one thing. My problem is that running
> nextFrame() took, most of the time, more then 0,0414 sec. so my video
> is lagging. I monitor every call and I found that the culprit is when I
> read from the socket file handle. It's the only bottleneck i
I'm trying to write a numerology program where I have each letter
identified by a numerical value like
a=1
b=2
c=3
as so forth. I then input a name. How do I treat each letter as a
single value? That is, instead of print myname I have to do a print
m+y+n+a+m+e which returns a number. I next want to
Ron Adam wrote:
> Alex Martelli wrote:
>> Ron Adam <[EMAIL PROTECTED]> wrote:
>>...
>>> Considering the number time I sort keys after getting them, It's the
>>> behavior I would prefer. Maybe a more dependable dict.sortedkeys()
>>> method would be nice. ;-)
>>
>> sorted(d) is guaranteed to
Em Seg, 2006-02-27 às 00:43 -0800, Paul Rubin escreveu:
> def print_members(header, e): # print header, then members of enum e
> print header
> for m in e:
> print '\t', str(m)
>
> months_longer_than_february = enum('jan', 'mar', 'apr', ) # etc
> months_shorter_tha
On Sun, 26 Feb 2006 10:35:13 -0600, Tim Chase
<[EMAIL PROTECTED]> wrote:
>Trying to get my feet wet with wxPython (moving from just
>command-line apps), I tried the obvious (or, at least to me
>was obvious):
>
>Start python, "import wx" and then do a "help(wx)" to see
>what it can tell me.
I
On 24 Feb 2006 14:12:05 + (GMT), Sion Arrowsmith
<[EMAIL PROTECTED]> wrote:
>Franz Steinhaeusler <[EMAIL PROTECTED]> wrote:
>>On Thu, 23 Feb 2006 13:54:50 +, Martin Franklin
>>>why not use string methods strip, rstrip and lstrip
>>because this removes only the last spaces,
>> [given r = '
Well.. I hate to reply to my own post.. but here is an update..
When I flatten a 'mbox' mail message and suck it into a 'email' mail
message.. things look fine except that every MIME encoded section has a
'UNIX From' header added to the top of it and the From user is set
to 'nobody'..
Does an
Gerhard,
thanks, that
import os
os.environ["NLS_LANG"] = "German_Germany.UTF8"
import cx_Oracle
con = cx_Oracle.connect("me/[EMAIL PROTECTED]")
really helped. At least now the query returns something encoded
differently. I dared not to believe that there is no "direct encoding
change api" withou
myString = "bar\foo\12foobar"
print repr(myString)
My "problem" was that I wanted to know if there is a way of printing
"unraw" strings like myString so that the escape characters are written
like a backslash and a letter or number. My understanding was that
repr() did this and it does in most cas
Steven D'Aprano <[EMAIL PROTECTED]> writes:
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> What is an empty enum?
An empty enum is an enum with no identifiers, just like an empty list
is a list with no elements.
> How and when would you use it?
> The best I can come up with is that an empty enum
Hello All,
I am writing an application in C/C++ (VC++ 6.0 compiler) within which I want
to make calls using the python FTP client (ftplib).
I want to call (for example) after the necessary iniialization has been
done:
PyObject *t = PyObject_CallMethod (_FTP, "retrlines", , "LIST",
c_functio
nice! two little lines that do a boatload of work! hee hee
pth = '/Users/kpp9c/snd/01'
samples = [os.path.join(pth, f) for f in os.listdir(pth) if
f.endswith('.aif')]
thank you Kent! (and Jeremy and Magnus and Singletoned and I V ... and
john boy and mary ellen .. )
--
http://mail.pyt
Cameron Laird wrote:
> In article <[EMAIL PROTECTED]>,
> Kay Schluehr <[EMAIL PROTECTED]> wrote:
> .
> .
> .
>
>>Lucid in the mid 80s that gone down a few years later. As it turned out
>>that time Lisp was not capable to survive in
101 - 160 of 160 matches
Mail list logo