473,387 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python Love :)

mwt
I've only been goofing around with Python for about a month now, but
already I am in love.
I never get that feeling -- so common with Java -- that I'm swimming
upstream, struggling to force the language to do what I want.
Python makes it feel effortless and easy.

Mar 11 '06 #1
13 1269
Spread the love - tell your Java freinds :-)

Mar 12 '06 #2

Paddy wrote:
Spread the love - tell your Java freinds :-)


well said paddy ! :-))

Mar 12 '06 #3
al pacino wrote:
Paddy wrote:
Spread the love - tell your Java freinds :-)


well said paddy ! :-))


and ixnay on the ubyray or else I'll tell you where to stick your
endblock delimiter :P
Mar 13 '06 #4
BWill wrote:
and ixnay on the ubyray or else I'll tell you where to stick your
endblock delimiter :P


OK, I can't help it... which is more readable:

a_string.reverse (ruby)
a_string[::-1] (python)

Mar 13 '06 #5
rtilley <rt*****@vt.edu> writes:
a_string.reverse (ruby)
a_string[::-1] (python)


reversed(a_string) (python)
Mar 13 '06 #6
Paul Rubin wrote:
reversed(a_string) (python)


Which version of Python offers this function? It doesn't seem to be
available in the 2.3 version I have installed...

Mar 13 '06 #7
"gregarican" <gr*********@gmail.com> writes:
reversed(a_string) (python)


Which version of Python offers this function? It doesn't seem to be
available in the 2.3 version I have installed...


I think it's new in 2.4.
Mar 13 '06 #8
Paul Rubin wrote:
"gregarican" <gr*********@gmail.com> writes:
> reversed(a_string) (python)


Which version of Python offers this function? It doesn't seem to be
available in the 2.3 version I have installed...


I think it's new in 2.4.


Needs a little help, though:
print reversed("abba") <reversed object at 0x4029454c>
class Str(str): .... def __reversed__(self):
.... return self[::-1]
.... reversed(Str("abba"))

'abba'

Now if only I had picked a better example :-)

Peter
Mar 13 '06 #9
Peter Otten <__*******@web.de> writes:
print reversed("abba")

<reversed object at 0x4029454c>


Darn, yes, that's the second time in the past couple weeks I've made
that exact same error in a clpy post. So what's the most concise way
of turning it back into a string? ''.join(list(reversed(a_string))) ?
Bleccch.
Mar 13 '06 #10
Paul Rubin wrote:
So what's the most concise way
of turning it back into a string? ''.join(list(reversed(a_string))) ?


You don't need the list(), join() can take an iterator:

''.join(reversed(a_string))

Kent
Mar 13 '06 #11
Paul Rubin wrote:
Darn, yes, that's the second time in the past couple weeks I've made
that exact same error in a clpy post. So what's the most concise way
of turning it back into a string? ''.join(list(reversed(a_string))) ?
Bleccch.


Use Ruby:

print "A String".reverse

Just kidding :-)~

Mar 13 '06 #12
BWill wrote:
and ixnay on the ubyray or else I'll tell you where to stick your
endblock delimiter :P


Umm,
Did you mean to write the above?
What has it to do with Ruby?

Mar 13 '06 #13
"gregarican" <gr*********@gmail.com> writes:
reversed(a_string) (python)

Which version of Python offers this function? It doesn't seem to be
available in the 2.3 version I have installed...

I think it's new in 2.4.

Mar 13 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
9
by: kbass | last post by:
I am starting to learn Python but I want to know how the job market looks for programming using Python. I really don't see many jobs (probably one or two) that require Python experience at all....
47
by: Michael Scarlett | last post by:
There is an amazing article by paul graham about python, and an even better discussion about it on slashdot. The reason I point this out, is the more I read both articles, the more I realised how...
52
by: Neuruss | last post by:
It seems there are quite a few projects aimed to improve Python's speed and, therefore, eliminate its main limitation for mainstream acceptance. I just wonder what do you all think? Will Python...
63
by: Davor | last post by:
Is it possible to write purely procedural code in Python, or the OO constructs in both language and supporting libraries have got so embedded that it's impossible to avoid them? Also, is anyone...
68
by: Lad | last post by:
Is anyone capable of providing Python advantages over PHP if there are any? Cheers, L.
18
by: Kamilche | last post by:
I have been programming in Python for years, and I'm STILL learning new features about the language. I'm looking for the best way to handle events with my own UI developed in PyGame, and I've...
10
by: A.M | last post by:
Hi, I am having difficulty with shell scripting in Python. I use the following command to run a DOS command and put the return value in a Python variable:
9
by: warpcat | last post by:
I've been scripting in Maya, via mel for years now. Recently learning to Python, love it. Thing that's driving me nuts it the IDE. I'm using PythonWin right now and trying to find something...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.