[EMAIL PROTECTED] wrote:
> Hi Guys,
>
> I have designed a web application. In its one window I put a form. User
> can click submit button of this form to run a pathon script to get data
> from database. Then User get a new window which display the result. Now
> I want to put the form and display d
Lad wrote:
> Hello
> How can I find out in Python whether the operand is integer or a
> character and change from char to int ?
> Regards,
> L.
>
You may want to try the "type" command.
And there is no character type in cPython (unless you're using ctypes
that is)
There is not much point though
Phoe6 wrote:
> Operating System: Windows
> Python version: 2.4
>
> I have bookmarks.html and wumpus.c under my c:
>
> When I tried to check the presence of the bookmarks.html, I fail.
>
os.path.isfile('c:\bookmarks.html')
> False
os.path.isfile('c:\wumpus.c')
> True
>
os.path.exi
Shane Hathaway wrote:
> Thoughts?
>>> import re; name_expr = re.compile('[a-zA-Z]+')
>>> name_expr
<_sre.SRE_Pattern object at 0x00F9D338>
>>>
the import statement can be called anywhere in the code, why would you
add strange syntactic sugar that doesn't actually bring anything?
--
http://ma
Mike Meyer wrote:
> And you've once again missed the point. The reason you don't
> manipulate the attributes directly is because it violates
> encapsulation, and tightens the coupling between your class and the
> classes it uses. It means you see the implementation details of the
> classes you are
[EMAIL PROTECTED] wrote:
> Could someone explain the use of __add__ (and similar double underscore
> attributes) and what their use is.
>
> Bob
>
Methods with double leading and trailing underscores are basically
"magic methods" with specific meanings for the Python interpreter.
You're not supp
Tolga wrote:
> I am not unfamiliar to programming but a newbie in Python. Could you
> recommend me (a) great book(s) to start with? Free online books or
> solid books are welcome.
>
> Thanx in advance.
>
I'd call Dive Into Python a reference, it's an extremely clear yet
pythonic book, and it's a
Matthias Kaeppler wrote:
> Why would I want to use an attribute in Python, where I would use
> getters and setters in Java? I know that encapsulation is actually just
> a hack in Python (common, "hiding" an implementation detail by prefixing
> it with the classname so you can't access it by its
Fredrik Lundh wrote:
> assuming that "true" means "the message you would get if you hadn't
> used a try/except", the traceback module is what you want:
>
> you can also inspect the exception status via the sys.exc_info() call.
> e.g.
>
There is also the third way of catching an exception exp
Luis M. Gonzalez wrote:
> You are not the first lisper who fell inlove with Python...
> Check this out:
> http://www.paulgraham.com/articles.html
>
Paul Graham is not in love with Python though, he's still very much in
love with Lisp.
He merely admits being unfaithful to Lisp from time to time (
Tom Anderson wrote:
> In what sense are the names-bound-to-references-to-objects not variables?
>
In the sense that a variable has various meta-informations (at least a
type) while a Python name has no information. A Python name would be
equivalent to a C void pointer, it can mean *any*thing an
Mike Meyer wrote:
> But this isn't necessarilly true: is perfectly legal.
>
> http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> "SeNTry" wrote:
>
>> My first post here as I just begin to learn programming in general and
>> python in particular. I have all the noobie confused questions, but as I
>> work thru the tutorials I'm sure I'll find most my answers.
>>
>> This one is eluding me tho... I am wo
Koray Bostancı wrote:
> Hi all,
>
> When i type python in terminal it runs the python2.3 interpreter, but i
> want to use 2.4 and Python2.4 package is already installed.
>
> How can i change the default python in my system? I searched google for
> a little but couldn't find.
>
> Using Debian GNU
Steven D'Aprano wrote:
> name = "spam spam spam spam"
>
> the value of the variable "name" is a pointer, and not a string. Riiight.
>
Yes, it's a reference to an object of type string holding the value
> def increment(n):
> """Add one to the argument changing it in place."""
> # In Pas
Shouldn't have hit the "send" button so fast...
Addendum: the script element doesn't have any language attribute, the
attribute you're supposed to use is "type" and it takes the MIME type of
your script as a value.
s/language="javascript"/type="text/javascript"/
--
http://mail.python.org/mailm
PatPoul wrote:
> I want to do the same thing as
>
>
> but with a python script :
>
>
> ==
> if xxx.py :
> def mytest():
> alert("test")
> window.document.write('test')
> ==
> and test.html :
>
>
>
>
> mytest()
>
>
Aahz wrote:
> In article <[EMAIL PROTECTED]>,
> Steve Holden <[EMAIL PROTECTED]> wrote:
>> (Part of) Python's credo (which you can read in context by typing
>>
>> import this
>>
>> at an interactive command prompt) is "There should be one (and
>> preferably only one) way to do it".
>
> Actua
Tuvas wrote:
> Let's say I make a program something like follows:
>
> x=[]
> x.append([1,2,3])
> x.append([4,5,6])
> print x
> print x[0]
> print x[0][1]
> x[0][1]=5
>
> Okay, everything works here as expected except the last line. Why won't
> this work? Thanks for the help!
>
Works for me, do y
Adrian Holovaty wrote:
> bruno at modulix wrote:
>> RoR is not an IDE, it's a web framework. The closest things in Python
>> are TurboGears (good Ajax/js support via Mochikit), Subway (never
>> tested), and Django (no Ajax support AFAIK).
>
> Note that "no Ajax support" is misleading. Of course yo
JabaPyth wrote:
> Hello,
> I'm trying to use the urllib module, but when i try urllib.urlopen, it
> gives me a socket error:
>
> >>import urllib
> >>print urllib.urlopen('http://www.google.com/').read()
> Traceback (most recent call last):
> File "", line 1, in ?
> File "C:
[EMAIL PROTECTED] wrote:
> I want to calculate f(0) + f(1) + ...+ f(100) over some function f
> which I can change. So I would like to create a function taking f as
> argument giving back the sum. How do you do that in Python?
>
Python functions (and classes, and modules) are first-class objects,
[EMAIL PROTECTED] wrote:
> So basically Python Eggs precompiles and compresses
> binaries for you so you just have to load it to run
> your app?
>
Nah, Eggs is a packaging system, what you don't have to do is
compile/configure, because the packaging does that for you. It also
handles things lik
Mike Meyer wrote:
> After spending time I should have been sleeping working on it, the try
> python site is much more functional. It now allows statements,
> including multi-line statements and expressions. You can't create code
> objects yet, so it's still more a programmable calculator than
> any
Ilias Lazaridis wrote:
> b) to retrieve feedback subjecting the Process Definition itself
> (content of diagramms, clarity, terminology etc.)
>
This is a lie, and you know it.
You are merely some kind of strange troll. You've built something that
you consider the only "object model" worth using
Mike Meyer wrote:
> That doesn't sounds like "hates" to me. More like "doesn't like the
> baggage."
>
> >> # Current behavior
>>> def foo(*args, **kwargs):
pass
>>> print foo
>>> # Extended behavior
>>> # returns a reference to the function
>>> def foo(*args, **kwarg
Damien Wyart wrote:
> Thanks for these important and useful additions, they are very welcome !
>
> In writing my answer I had immutables in mind, but mutables are a bit
> more dangerous, here...
>
Not *that* much though.
The first construct can't be used, but he can use
>>> [copy.copy(Foo) fo
[EMAIL PROTECTED] wrote:
> For some reason, ocassionally when I see xrange, I think "But wasn't
> that deprecated since range is now a . . oh wait that's xreadlines".
> xrange is a cool thing the few times where you really need it.
>
> john
>
>> Not sure what i is really for, but j seems to be
Pierre Barbier de Reuille wrote:
> Well, I would even add : don't use super !
> Just call the superclass method :
>
> MyClass.__init__(self)
>
>
>
> Simon Percivall a écrit :
>> Don't use self.__class__, use the name of the class.
>>
Bad idea if you're using new-style classes with a complex inh
Peter Hansen wrote:
> Riko, any chance you could post the final code and a bit more detail on
> exactly how much Psyco contributed to the speedup? The former would be
> educational for all of us, while I'm personally very curious about the
> latter because my limited attempts to use Psyco in th
Ilias Lazaridis wrote:
> I estimate that there is a "unfreeze" operation, too - which would lead
> to flexibity.
>
There is none, you have to make a copy of the object via the "dup"
(duplicate) method to get an unfrozen copy (note: clone yields an exact
copy, which means that it's still frozen)
KraftDiner wrote:
> I've spent hours trying to find a bug that was a simple spelling
> mistake.
>
> in an init method I declare a variable self.someLongName
>
> later in a different method of the class I use
> self.sumLongName
> Now I really meant self.someLongName.
> In fact I don't want a vari
Heiko Wundram wrote:
> Xavier Morel wrote:
>> I think that xrange is also soon-to-be deprecated (xrange eats a little
>> less memory and is slightly faster to _create_, but much slower to
>> _iterate over_ than range)
>
> It might be slower to iterate using xrange, b
Alex Martelli wrote:
> Xavier Morel <[EMAIL PROTECTED]> wrote:
>...
>> Wouldn't it be possible to change the `def` statement to return a
>> reference to the function, and allow omitting the function name thereby
>> bypassing the default binding (curr
Pierre Barbier de Reuille wrote:
> Xavier Morel a écrit :
>> Pierre Barbier de Reuille wrote:
>>
>>> Well, I would even add : don't use super !
>>> Just call the superclass method :
>>>
>>> MyClass.__init__(self)
>>>
>>>
&g
James Tanis wrote:
> Quite honestly I've never heard of java being faster than.. well..
> anything. Faster than Python? I really doubt it. Their are several
> libraries for game programming specifically as well as opengl, sdl, as
> well as several different audio systems/daemons.. I'd suggest brow
Some time ago, I finally decided to check what Stackless was (exactly)
and which were the theorical concepts behind it (continuations and all).
I managed to find some documentations and papers, but most if not all of
them are related to pre-2.0 Stackless. The issue is, I just can't seem
to reac
Christian Tismer wrote:
> Xavier Morel wrote:
>
>> Would anyone have more informations about that? It doesn't seem to be an
>> issue on my side (since I tried to access the Stackless site from two
>> different connections and 3 computers) but I can't rule it
Antoon Pardon wrote:
> I don't think unit tests are that helpful in this case.
> Unit tests help you in finding out there is a bug, they
> don't help that much in tracking down a bug.
>
> I for some reason a person is reading over the difference
> between sumLongName and someLongName and doesn't n
Alessandro wrote:
> Problema con le RE
> Ho questa stringa "3 HOURS, 22 MINUTES, and 28 SECONDS" e la devo
> 'dividere' nelle sue tre parti "3 HOURS", "22 MINUTES", "28 SECONDS".
> La cosa mi viene molto con le RE...(inutile la premessa che sono molto
> alle prime armi con RE e Python)
> Qesi
Mel Wilson wrote:
> py wrote:
>> Say I have...
>> x = "132.00"
>>
>> but I'd like to display it to be "132" ...dropping the trailing
>> zeros...
>
> print '%g' % (float(x),)
>
> might work.
>
> Mel.
>
The input is a string, %g expects a float, TypeError exception.
--
http://mail.python.o
Forget about the previous mail, i just saw you were converting the
string to float beforehand, in which case he would more than likely run
into the good ol' float imprecision issue sooner than later.
Not to mention that %g formats to scientific notation (e.g. exponential
format with the exponen
[EMAIL PROTECTED] wrote:
> The first line of that example has to be:
>
> s = |set([1, 3, 5])|
>
> But I don't know/remember why set() can't accept many values like
> max/min:
>
> max([1,2,5])
> max((1,2,5))
> max(1,2,3)
>
> Bye,
> bearophile
>
How about just providing a freeze method on `obje
Tim Chase wrote:
> The closest hack I could come up with was
>
> import random
> s = "abcdefg"
> a = []
> a.extend(s)
> random.shuffle(a)
> s = "".join(a)
>
> This lacks the beauty of most python code, and clearly feels like
> there's somethign I'm missing. I
Alex Martelli wrote:
> Steve Holden <[EMAIL PROTECTED]> wrote:
>...
>>> 3. If two objects are equal with "==", does that
>>> mean their values are the same?
>> Almost universally, yes, although if you know enough about how the
>> interpreter works "under the hood" you can define the response
John M. Gabriele wrote:
> I'm having a hard time finding the documentation to the super() function.
> I checked the language reference ( http://docs.python.org/ref/ref.html )
> but didn't find it. Can someone please point me to the relevant docs on
> super?
>
> help( super ) doesn't give much info
Paul Rubin wrote:
> There's something to be said for that. Should ['a'..'z'] be a list or
> a string?
To me, the most obvious result would be either a range object as a
result, or always a list/generator of objects (to stay perfectly
consistent). If a range of numbers translate into a list of nu
Tim Peters wrote:
> Non-English translations have real challenges, and because this series
> is more popular than the Python Reference Manual these days, there's a
> lot of fascinating info to be found. For example, I think the
> Japanese translator deserves a Major Award for their heroic attempt
Steven D'Aprano wrote:
> On Mon, 16 Jan 2006 12:51:58 +0100, Xavier Morel wrote:
>
>> For those who'd need the (0..n-1) behavior, Ruby features something that
>> I find quite elegant (if not perfectly obvious at first), (first..last)
>> provides a range from
Steven D'Aprano wrote:
> On Mon, 16 Jan 2006 12:51:58 +0100, Xavier Morel wrote:
>
>> For those who'd need the (0..n-1) behavior, Ruby features something that
>> I find quite elegant (if not perfectly obvious at first), (first..last)
>> provides a range from
mjteigen wrote:
> I'm very new at Python, but have been trying it in conjunction with
> CGI. I've encountered a problem that I'm pretty sure is a trivial one,
> but I don't know enough Python to work it out. Here's an example.
> Imagine that I have a file named "5.jpg" in the same directory as this
Paul Rubin wrote:
> I don't think this is a valid objection. Python is already full of
> syntactic sugar like indentation-based block structure, infix
> operators, statements with keyword-dependent syntax, etc. It's that
> very sugar that attracts programmers to Python away from comparatively
> s
Steve Holden wrote:
> Debashis Dey wrote:
>> Hello,
>>
>> I have a python CGI program. I would like to show a graph within a HTML
>> plage. I would like to dynamically generate the graph using the python
>> CGI script on the web server side and send it to the browser.
>>
>> My question is how
Steve Holden wrote:
> Luiz Geron wrote:
>> I don't have experience on this, but I think that you can make the
>> script return the image "contents" directly to the img tag, without
>> passing it to a img file, so you can use something like this:
>>
>>
>>
>> wich saves some processing and I/O.
>>
>
NateM wrote:
> Thank you! If I am reading in dates as strings from a text file, like
> "5/11/1998", how do I convert that to a format I can pass into mktime?
> Thanks again.
>
Check time.strptime()
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I'm a newbie experimenting with Python. I want to incrementally develop
> a module called 'circle'. The problem is now that the file name is used
> for two purposes. To keep track of the version number and as the name
> for the module. So when I develop the first version
[EMAIL PROTECTED] wrote:
> Now suppose I have make a new version with __version__ = 1.1. What
> shall I call this file and (I don't want to overwrite the old file if I
> need to go back to it) how do I import it from the shell. Your advice
> sounds nice, but I would appreciate if you could give me
Steven Watanabe wrote:
> I know that the standard idioms for clearing a list are:
>
> (1) mylist[:] = []
> (2) del mylist[:]
>
> I guess I'm not in the "slicing frame of mind", as someone put it, but
> can someone explain what the difference is between these and:
>
> (3) mylist = []
>
>
[EMAIL PROTECTED] wrote:
> Hi,
>
> I'm trying to write a method that needs to know both the class name and
> the instance details
>
> Any suggestions?
>
What's the point of using a classmethod and an explicit cls argument
when you can get the class object from the instance itself?
>>> class
Simon Faulkner wrote:
> I've just written my first (simple) WxPython program - yy!
>
> What would folks suggest is the easiest way to package it to run on
> other windows PCs?
>
> I would love a single .exe file that would run without ANY OTHER FILES
> even if it was 50 Mb!
>
> TIA
>
>
>
[EMAIL PROTECTED] wrote:
> Yes that's better. Didn't know about the __class__ attribute. I
> thought there must be a way to access this but couldn't find it in the
> docs.
>
> Thanks,
>
> Andy
>
dir(), help() and the interactive interpreter (IDLE or CLI) are your
best friends.
Any time you w
Grant Edwards wrote:
> Definitely. Nobody does single .exe file windows programs
> anymore. A single-file installer is almost as easy.
>
uTorrent, Process Explorer or Media Player Classic are single .exe
windows programs.
Granted, most of them are under-150kb-works-of-arts, but MPC isn't (well
Scott David Daniels wrote:
> pyluke wrote:
>> I'm parsing LaTeX document and want to find lines with equations blocked
>> by "\[" and "\]", but not other instances of "\[" like "a & b & c \\[5pt]"
>> so, in short, I was to match "\[" but not "\\]" I've tried:
>> check_eq = re.compile('(?!\%\
anon wrote:
> Would somebody please drop me a hint, please?
>
Yeah, the definition of "JAR" is Java ARchive, why the hell would a
Python script be able to read a JAR in the first place (truth is it is,
a JAR file is nothing but a renamed ZIP, therefore the zipfile module
allows you to read it's
Byte wrote:
> x = input(raw_input("Please enter your name: "))
> if x==myself: print 'OK'
>
> It kinda works - I can get to the please enter your name bit but then
> it simply reprints your input as output. Someone please HELP!
>
-->
C:\>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.13
Byte wrote:
> p.s. Xavier Morel, you seem to be using Windows, not Linux
>
I don't see how this may even remotely be relevant, Python is cross
platform and (mostly) works the same regardless of the OS
> I got
> the idea of stacking input on a raw_input from the official P
Byte wrote:
> http://docs.python.org/tut/node6.html#SECTION00610
>
-->
>>> x = int(raw_input("Please enter an integer: "))
<--
Unless my eyes fail me, it's written "int", not "input", the goal of
this line is to convert the return value of raw_input (a string) into an
integer.
Byte wrote:
> Assumption. Im also new to programing, so could do something stupid
> like think a Windows path is a command/input/etc. (really, ive done
> things like that before.)
>
Don't assume anything when you have no reason to, and especially don't
assume that a cross-platform programming lan
Byte wrote:
>> parse the expression, extract the operands and the operation, apply the
> operation to the operands
>
> How? Give me some example code, but please keep it simple.
>
>> are you trying to code a calculator?
>
> Not intending to, just trying to learn Python. Suppose what i'm trying
>
Jorgen Grahn wrote:
> You are rude to an obvious newbie here ... please keep in mind that
today's
> stupid newbies are tomorrow's Python professionals.
>
I didn't mean to be rude and apologize if that's the way it came out.
> Maybe he /is/ running Jython and failed to explain that properly?
>
Byte wrote:
> I asked to keep it simple! Anyway, ill try Dive into Python, thanks
>
It is simple, merely explicit and with some details.
--
http://mail.python.org/mailman/listinfo/python-list
Dave wrote:
> Anyone familiar with PHP? I'm trying to make a translation. In PHP you
> can get the current object's name by going like this:
>
> get_class(item) == 'ClassName'
>
> I've tried type(item), but since I can't be sure if I'll be in __main__
> or as a child object, I can't guarantee wha
malv wrote:
> Of course, multiprocessing has been used for many years but this always
> involved a much higher level of sophistication on the part of the
> designers. This point seems to be largely hidden from the public,
> ignorant and semi-ignorant, by the chip manufacturers.
> Will new languages
malv wrote:
> Maybe this is too simplistic, but given two programs, one in Python the
> other in Java or C#. Would this mean that running the latter on a dual
> core processor would significantly increase execution speed, whereas
> the Python program would be running in one processor only without a
Ernesto wrote:
> I'm not sure if I should use RE's or some other mechanism. Thanks
>
I think a line-based state machine parser could be a better idea. Much
simpler to build and debug if not faster to execute.
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> Generally I use urllib.read() to get
> the whole html page as a string, then process it from there. I just
> look for the substrings I'm interested in, making no attempt to
> actually parse the html into a DOM or anything like that.
>
BeautifulSoup works *really* well when you
Ernesto wrote:
> Xavier Morel wrote:
>> Ernesto wrote:
>>> I'm not sure if I should use RE's or some other mechanism. Thanks
>>>
>> I think a line-based state machine parser could be a better idea. Much
>> simpler to build and debug if not f
Terry Reedy wrote:
> "John Pote" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I would wish to secure this data gathering against crashes of the OS,
>
> I have read about people running *nix servers a year or more without
> stopping.
>
He'd probably want to check the various
Dylan Moreland wrote:
> I'm trying to implement a bunch of class methods in an ORM object in
> order to provide functionality similar to Rails' ActiveRecord. This
> means that if I have an SQL table mapped to the class "Person" with
> columns name, city, and email, I can have class methods such as:
Oh, and I wondered too: is your goal to build an ORM, or do you just
need an ORM?
Cause if it's the latter then Python does already have some fairly good
ORMs such as SQLAlchemy or PyDO2, you don't *need* to create yours.
--
http://mail.python.org/mailman/listinfo/python-list
Ben Wilson wrote:
> I read somewhere else that Python was getting a ternary operator (e.g.
> x = (true/false) ? y : z). I read the PEP about it and that the PEP had
> been approved this past Fall. Has this been released into the wild yet?
>
> IIRC, the operator is like:
>
> x = y if C : else z
>
Mark Harrison wrote:
> I thought I saw a package that would create a DOM from html, with
> allowances that it would do a "best effort" job to parse
> non-perfectly formed html.
>
> Now I can't seem to find this... does anybody have a recommendation
> as to a good package to look at?
>
> Many TIA!
Diez B. Roggisch wrote:
> py wrote:
>
>> I have two lists which I want to use to create a dictionary. List x
>> would be the keys, and list y is the values.
>>
>> x = [1,2,3,4,5]
>> y = ['a','b','c','d','e']
>>
>> Any suggestions? looking for an efficent simple way to do this...maybe
>> i am jus
Alex Martelli wrote:
> Carl Banks <[EMAIL PROTECTED]> wrote:
>...
>>> class better_list (list):
>>> tail = property(None, list.append)
>> This is an impressive, spiffy little class.
>
> Yes, nice use of property.
>
> Alex
I don't know, I usually see people considering that proper
Tempo wrote:
> Larry I do see your point. There does seem to be a lot more support for
> PHP and MySQL together than there is Python and ASP. But I want to
> first try to accomplish my goal by using Python first before I give up
> and revert back to PHP. So if I was going to parse HTML forms and pl
Rene Pijlman wrote:
> David Isaac:
>> I would like to be able to define a loop statement
>> (nevermind why) so that I can write something like
>>
>> loop 10:
>>do_something
>>
>> instead of
>>
>> for i in range(10):
>>do_something
>>
>> Possible? If so, how?
>
> Yes. By implementing a com
Rene Pijlman wrote:
> David Isaac:
>> I would like to be able to define a loop statement
>> (nevermind why) so that I can write something like
>>
>> loop 10:
>>do_something
>>
>> instead of
>>
>> for i in range(10):
>>do_something
>>
>> Possible? If so, how?
>
> Yes. By implementing a com
nuttydevil wrote:
> Hey everyone! I'm hoping someone will be able to help me, cause I
> haven't had success searching on the web so far... I have large chunks
> of text ( all in a long string) that are currently all in separate
> notebook files. I want to use python to read these strings of text,
>
Fredrik Lundh wrote:
> did you read the string chapter in the tutorial ?
>
> http://docs.python.org/tut/node5.html#SECTION00512
>
> around the middle of that chapter, there's a section on slicing:
>
> "substrings can be specified with the slice notation: two indices
> sep
Akihiro KAYAMA wrote:
> Sorry for my terrible English. I am living in Japan, and we have a
> large number of characters called Kanji. UTF-16(U+...U+10) is
> enough for practical use in this country also, but for academic
> purpose, I need a large codespace over 20-bits. I wish I could use
>
Ross Ridge wrote:
> Steve Holden wrote:
>> "Wider than UTF-16" doesn't make sense.
>
> It makes perfect sense.
>
> Ross
> Ridge
>
Not if you're still within Unicode / Universal Character Set code space.
While UCS-4 technically goes
Ross Ridge wrote:
> Xavier Morel wrote:
>> Not if you're still within Unicode / Universal Character Set code space.
>
> Akihiro Kayama in his original post made it clear that he wanted to use
> a character set larger than entire Unicode code space.
>
>
[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())
{
I'll just play the devil's advocate here
Francois wrote:
> 1) In Ruby there is a risk of "Variable/Method Ambiguity" when calling
> a method with no parameters without using () :
>
Yes, but that's in my opinion a programmer error, not necessarily a
language error.
> 2) Ruby does not have true f
Bil Kleb wrote:
> Xavier Morel wrote:
>>> 2) Ruby does not have true first-class functions living in the same
>>> namespace as other variables while Python does :
>>>
>>> In Ruby you need extra syntax that ruins the "first-class-ness" :
>>&
Torsten Bronger wrote:
> Yes, however, this is also true for Python in my opinion.
>
Ruby's ability to generate DSLs is an order of magnitude better than
Python's at least.
I only know of the Lisp dialects that get better at DSLs.
Check Rails' validation methods (in the models), or if you don't
John Salerno wrote:
> So I'm wondering, how do you all handle moving around in your code in
> cases like this? Is there some sort of consistency to these things that
> you can write rules for your text editor to know when to outdent? It
> doesn't seem like you can do this reliably, though.
Under
trixie wrote:
> Using WinXP and Python24 on generic desktop.
> Being used to linux and command line operations I cannot make Windows accept
> the 'python myprog.py' command.
> Any help appreciated.
> Bob
>
>
I think you could've given us the error message that this command yields.
Issue is pro
KraftDiner wrote:
> I had a structure that looked like this
> ((0,1), (2, 3), (4, 5), (6,7)
>
> I changed my code slightly and now I do this:
> odd = (1,3,5,7)
> even = (0,2,4,6)
> all = zip(even, odd)
>
> however the zip produces:
> [(0, 1), (2, 3), (4, 5), (6, 7)]
>
> Which is a list of tuples
[EMAIL PROTECTED] wrote:
> I am a python newbie. I have writen some 500 lines of code. There are 4
> classes and in all 5 files.
>
> Now, I am trying to run the program. I am getting wrong values for the
> simulation results.
> Is there any debugging facilities in python which would let me go step
1 - 100 of 101 matches
Mail list logo