[Tutor] Timsort on short lists

2019-07-02 Thread Jordan Baltes
I've been researching python's sorting algorithm, Timsort, and know that it's a hybrid between insertion sort (best case time complexity O(n)) and merge sort (O(n log(n))), and has an overall time complexity of O(n log(n)). What I'm trying to figure out is, when the list is very short, let's say 2

[Tutor] Python Script

2016-11-09 Thread Jordan Trudell
Hello, I need help running a script, as I am getting an error. Is it possible if I could get help with it? Please reply if so. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] New to Python

2014-05-04 Thread Jordan Smallwood
I never got a response. Should I check my spam? Sent from my iPhone On Apr 28, 2014, at 1:57 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 26/04/2014 23:53, jordan smallwood wrote: Hello, I am new to Python. I mean completely new and we're working on this problem set in class

[Tutor] Help With Code

2014-05-04 Thread jordan smallwood
Hey there, I have this code below (in to cm conversion) and I want to have the user try again if they enter in a non integer. What am I missing: ConversionConstant = 2.54 def CalculateCentimeters(inches):     return ConversionConstant * inches def CalculateInches(centimeters):     return

[Tutor] New to Python

2014-04-28 Thread jordan smallwood
Hello, I am new to Python. I mean completely new and we're working on this problem set in class where they give us specs and we have to build something based off these specs. I have no idea what they're asking. Could someone help get me started on the path to figuring this out? Below is the

[Tutor] Help With an Assignment

2014-04-25 Thread jordan smallwood
Hello, I am new to Python. I mean completely new and we're working on this problem set where they give us specs and we have to build something based off these specs. I have no idea what they're asking. Could someone help get me started on the path to figuring this out? Below is the question:

Re: [Tutor] object size in python is in what units?

2013-07-23 Thread Jordan
SNIP Speaking of brain dead, I was taking a break from Python by looking at a video on finite state machines and the very first example was tennis scoring. I think the $#@! insane tennis scoring was harder to understand than the subject. That got me laughing pretty good, since I too was

Re: [Tutor] new to threading, Queues

2013-04-18 Thread Jordan
On 04/18/2013 02:16 AM, Chuck Mayers wrote: Hi! I was having a bit of nostalgia today, and thought I'd try to write a simple, old school BBS. I found the 'paramiko' library, and I've got something I can SSH into that would have impressed my 1990's self. I found some example code of the

Re: [Tutor] Impossible Else as Exception

2013-04-10 Thread Jordan
Thank you all for the feedback and suggestions. I have never used an assertion, before so I will read up on the concept. But this last email about the optimizations makes me want to go with an AssertionError exception, since assert is skipped if the compiler is told to optimize. Alan you are

[Tutor] Impossible Else as Exception

2013-04-09 Thread Jordan
I want to know what exception should be raised if there is a bug in my code that allows an else statement to be triggered, because the else condition in my code should be impossible, unless there is an error in my code. What exception should I raise so that if my code is wrong it will raise

Re: [Tutor] better tools

2012-08-26 Thread Jordan
On 08/22/2012 06:51 PM, Don Jennings wrote: [slightly OT] After watching Bret Victor's talk[1], I want **much** better tools for programming (and all of the other stuff I do on the computer). John Resig, creator of jQuery, claims[2] that Victor's presentation inspired the new platform for

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 12:15 AM, Prasad, Ramit wrote: SNIP I think your basic problem is too much conversion because you do not understand the types. A string is represented by a series of bytes which are binary numbers. Do you understand the concept behind ASCII? Each letter has a numeric

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 08:14 AM, Mark Lawrence wrote: On 19/07/2012 06:41, wolfrage8...@gmail.com wrote: On Thu, Jul 19, 2012 at 12:16 AM, Dave Angel d...@davea.name wrote: SNIP Really? Are you using a forked version of Python that doesn't need indentation after a while loop, or are you speaking

Re: [Tutor] Fwd: string to binary and back... Python 3

2012-07-19 Thread Jordan
Thunderbird edited the email on me, even though I had put it into plain text mode. Next time perhaps I will just attach the file if that is acceptable rather than getting attacked for what my mail editor did. Regards Walter -- Forwarded message -- From: Jordan wolfrage8

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 12:46 PM, Dave Angel wrote: On 07/19/2012 01:41 AM, wolfrage8...@gmail.com wrote: On Thu, Jul 19, 2012 at 12:16 AM, Dave Angel d...@davea.name wrote: SNIP That was just the first line that was not indented. If I thought you had a one-line while loop, I certainly would have

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
it in a way that makes sense. On Wed, 18 Jul 2012, Jordan wrote: OK so I have been trying for a couple days now and I am throwing in the towel, Python 3 wins this one. I want to convert a string to binary and back again like in this question: Stack Overflow: Convert Binary to ASCII and vice versa

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
A question I have for the group before I respond is a option that I saw that I had earlier was to ord() each element of a string and then bin() that number. But since bin() produces a string I could not figure out the correct way to attach two bin() outputs back together again due to the leading

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 08:53 PM, Prasad, Ramit wrote: I think your basic problem is too much conversion because you do not understand the types. A string is represented by a series of bytes which are binary numbers. Do you understand the concept behind ASCII? Each letter has a numeric representation

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 09:23 PM, Prasad, Ramit wrote: A question I have for the group before I respond is a option that I saw that I had earlier was to ord() each element of a string and then bin() that number. But since bin() produces a string I could not figure out the correct way to attach two

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 09:53 PM, Dave Angel wrote: On 07/19/2012 03:19 PM, Jordan wrote: SNIP OK. I am using one time pads to XOR data, but the one time pads (keys) are very large numbers, converting them to binary increases their size exponentially, which allows me to get more XORing done out

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 10:04 PM, eryksun wrote: On Thu, Jul 19, 2012 at 3:08 PM, Jordan wolfrage8...@gmail.com wrote: SNIP I'm not an expert with cryptography, but here's a simple XOR example: from itertools import cycle text = b'Mary had a little lamb.' key = b'1234' cypher = bytes(x^y for x,y

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
Sorry, I am not sure why Thunderbird is stripping the spaces, may have something to do with a plug-in that I have installed, I will have to look into it. On 07/19/2012 10:41 PM, Prasad, Ramit wrote: Sure, this makes perfect sense to me :) (adding indent) for char in data: bin_data +=

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 10:48 PM, Prasad, Ramit wrote: SNIP OK. I am using one time pads to XOR data, but the one time pads (keys) are very large numbers, converting them to binary increases their size exponentially, which allows me to get more XORing done out of a single You want to explain this

[Tutor] string to binary and back... Python 3

2012-07-18 Thread Jordan
OK so I have been trying for a couple days now and I am throwing in the towel, Python 3 wins this one. I want to convert a string to binary and back again like in this question: Stack Overflow: Convert Binary to ASCII and vice versa (Python)

Re: [Tutor] newbie Questions

2012-07-16 Thread Jordan
I would just like to add that I am a web developer and I left PHP for Python. I left PHP because it was not as powerful server side (Cron Jobs and Such) and I wanted to possibly create desktop applications, more recently Android Apps via SL4A and IPhone Apps via pyjamas. PHP is a limited language

[Tutor] Octal confusion, please explain why. Python 3.2

2012-06-02 Thread Jordan
Hello, first off I am using Python 3.2 on Linux Mint 12 64-bit. I am confused as to why I can not successfully compare a variable that was created as an octal to a variable that is converted to an octal in a if statement yet print yields that they are the same octal value. I think it is because

Re: [Tutor] Joining all strings in stringList into one string

2012-06-02 Thread Jordan
On 05/30/2012 06:21 PM, Akeria Timothy wrote: Hello all, I am working on learning Python(on my own) and ran into an exercise that I figured out but I wanted to know if there was a different way to write the code? I know he wanted a different answer for the body because we haven't gotten to

Re: [Tutor] Octal confusion, please explain why. Python 3.2

2012-06-02 Thread Jordan
Thank you for the detailed answer, now I understand and I understand that each number format is an integer just with a different base and cosmetic appearance. On 06/02/2012 01:51 PM, Steven D'Aprano wrote: Jordan wrote: Hello, first off I am using Python 3.2 on Linux Mint 12 64-bit. I am

Re: [Tutor] Joining all strings in stringList into one string

2012-06-02 Thread Jordan
#String_Concatenation On 06/02/2012 04:29 PM, Steven D'Aprano wrote: Jordan wrote: #Another version might look like this: def join_strings2(string_list): final_string = '' for string in string_list: final_string += string print(final_string) return final_string Please

Re: [Tutor] Fwd: Is this possible and should it be done?

2012-05-21 Thread Jordan
On 05/21/2012 07:24 PM, Alan Gauld wrote: On 21/05/12 15:23, wolfrage8...@gmail.com wrote: if any of these formats offer file locking with in them, ;et me say that better. Can I open a, as example, tar file and lock a file with in it, with out locking the entire tar archive? No and you

Re: [Tutor] What's the keyword for the Python creed?

2011-09-15 Thread Jordan
I think you mean the Zen of Python: http://www.python.org/dev/peps/pep-0020/ The command is import this -- Jordan On 09/15/2011 11:19 AM, Richard D. Moores wrote: You know, at the interactive prompt you enter some Monty Python word that I can't remember, and you get a small list of pithy

Re: [Tutor] how to sort the file out

2011-09-06 Thread Jordan
of the file if I make field 2 of file 2 equal 01? -- Jordan On 09/06/2011 09:46 PM, lina wrote: HI, I have two files, one is reference file, another is waiting for adjust one, File 1: 1 C1 2 O1 3 C2 4 C3 5 H3 6 C7 7 O2 8 H22 9 C6 10 H61 11 C5 12 H5 13 C4 14 C8 15 C9 16 C10 17

[Tutor] Moveable and Animated Sprites

2011-08-14 Thread Jordan
(self): MoveableSprite.update(self) AnimatedSheetSprite.update(self) -- Jordan Farrell ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] About the Mailing List

2011-07-28 Thread Jordan
assume the mailing list are posted some wheres on-line. But I can only find the sign up page. Thanks in advance for the link. -- Jordan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman

[Tutor] number distribution

2010-04-22 Thread Bill Jordan
Hey everbody, If we have 100 apples, for example, and we need to distrubte the 100 apples randomly in 10 boxes, how can we do this in python? Cheers ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] dollarize.py

2008-06-22 Thread Jordan Greenberg
Martin Walsh wrote: def addcommas(f): This amounts to reversing everything left of the decimal, grouping by 3s, joining with commas, reversing and reassembling. # assumes type(f) == float left, right = ('%0.2f' % f).split('.') rleft = [left[::-1][i:i+3] for i in

Re: [Tutor] IDE

2008-06-10 Thread jordan halsey
Any one here using cutter... http://www.fundza.com Free Java based ide with many built in functions and bindings. This is an especially useful tool if you are doing 3d or any kind of shader writing. Jordan Reece Halsey maya | mental ray | renderman | nuke | houdini | ae www.jordanhalsey.com

Re: [Tutor] Why not to use include?

2008-06-09 Thread Jordan Kanter
it is not as straight forward as preprocessing html, but it amounts to the same. Let me know if that helps, Jordan On Mon, Jun 9, 2008 at 7:21 AM, W W [EMAIL PROTECTED] wrote: Python can *too* import from a txt file (even if it contains HTML): f = open(myfile.html, r) x = f.read() print x f.close

Re: [Tutor] Why not to use include?

2008-06-09 Thread Jordan Kanter
sorry about the spelling. that second sentence should be the work out to be similar to php in the browser. On Mon, Jun 9, 2008 at 9:57 AM, Jordan Kanter [EMAIL PROTECTED] wrote: Another thing you can do is use django templates. they work to be similarly to php in the browser, and have something

Re: [Tutor] Python Programming Tools

2008-04-14 Thread Jordan Greenberg
. If you're willing to spend some $$$, then PyDev Extensions (also for Eclipse) are good, or ActiveState's Komodo IDE. They seem to be the gold standard. -Jordan Greenberg ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo

Re: [Tutor] shelves behaving badly

2007-08-02 Thread Luke Jordan
/reruns are made. thanks for the tip on checking things with os. On 8/2/07, Kent Johnson [EMAIL PROTECTED] wrote: Luke Jordan wrote: i've implemented a database as a shelve of record class instances. some of the fields in each record are dictionaries. i needed to parse info from 3 different

[Tutor] shelves behaving badly

2007-07-27 Thread Luke Jordan
i've implemented a database as a shelve of record class instances. some of the fields in each record are dictionaries. i needed to parse info from 3 different reports into the dictionary fields in each record instance. i wrote the code to do this and tinkered it to fit the different reports (i.e.

[Tutor] database question

2007-06-29 Thread Luke Jordan
I've created a database as a shelve, where each value in the shelve file is a record class instance that has attributes representing fields. Let's say I enter 300 records in the shelve, then I decide to add a field to future records, or remove a field from future records. How can I update the

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-09 Thread Jordan Greenberg
x. Jordan -- I prefer encrypted mail. My key is available at: http://myweb.wit.edu/greenbergj/publickey.txt ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Yet another list comprehension question

2007-03-02 Thread Jordan Greenberg
Smith, Jeff wrote: I find a common thing to do is l = list() for i in some-iterator: if somefum(i) != list: l.append(somefun(i)) How about using the same condition you do in the if? Like: l=[somefun(i) for i in some-iterator if not type(somefun(i)) is list] HTH Jordan

Re: [Tutor] Getting the directory the program is in

2006-12-11 Thread Jordan Greenberg
Toon Pieton wrote: Hey friedly users! I was wondering: how can I get the directory the program is in? For example C:\Python Programs\Calculator\. Thanks in advance for reading, Toon Pieton Slightly hackish and nasty, but seems to do the trick. Someone'll probably suggest a better way,

Re: [Tutor] Getting the directory the program is in

2006-12-11 Thread Jordan Greenberg
[EMAIL PROTECTED]:~$ cd / [EMAIL PROTECTED]:/$ python test.py /home/jordan/test.py [EMAIL PROTECTED]:/$ So, if you _ALWAYS_ need an absolute path, just using sys.argv[0] might not work. Jordan Greenberg ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Jordan Greenberg
Chris Hengge wrote: Anyone point me to something more efficient then for item in list1: if item not in list2: list2.append() This just seems to take a bit a time when there are thousands or dozens of thousands of records just to filter out the dozen or so copies..

[Tutor] Test

2006-11-28 Thread Jordan Greenberg
will come from there from now on. Sorry again for the test, Jordan Greenberg ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Jordan Greenberg
, but theres no object left to pass it. HTH. -Jordan Greenberg ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Overloading the assignment operator in a class

2006-09-20 Thread Jordan Greenberg
. In Python, what you'd think of as 'variables' are just names for objects. (If you know C++, think pointers, sort of. myDie isn't the Die Object, its just a reference as to where the object is. Assigning to a pointer doesn't change the object, but what the pointer is pointing to.) Hope this helps, Jordan

Re: [Tutor] Overloading the assignment operator in a class

2006-09-20 Thread Jordan Greenberg
]: test=5 In [7]: test Out[7]: 5 (I could've written a test to show that __coerce__ is only called when no __add__ is defined, but I'm lazy and its time to leave work!) -Jordan Greenberg ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] foreach loops

2006-09-11 Thread Jordan Greenberg
; ifoo.length; i++) { System.out.println(foo[i]); } } The equivalent code in python is much cleaner, after foo has been initialized to whatever: for each in foo: print each Hope this helps, Jordan Greenberg

Re: [Tutor] Rock, Paper, Scissors

2006-08-08 Thread Jordan Greenberg
care of the basics for ya. Later you could try and keep frequency counts over a bunch of trials, see if the human has a preference, and then weight your response appropriately to try and beat them ;) -Jordan Greenberg ___ Tutor maillist - Tutor

Re: [Tutor] quick OO pointer

2006-08-07 Thread Jordan Greenberg
Hope this helps! -Jordan Greenberg ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python for basic web-testing

2006-08-06 Thread Jordan Greenberg
Hans Dushanthakumar wrote: Hi, How do I use python for basic web-tasks like inputting data or clicking buttons on web-pages. For eg, how do I enter my username and password and click on the OK button on the yahoo mail page? I had a look at the webbrowser module documentation

Re: [Tutor] (*args, **kwargs)

2006-08-04 Thread Jordan Greenberg
): :print kwargs : In [16]: foo(name=Jordan, email=[EMAIL PROTECTED]) {'name': 'Jordan', 'email': '[EMAIL PROTECTED]'} Your functions can then use the list/dictionary as normal. You can also use these in conjunction with normal positional parameters: In [27]: def foo(a, b, c, *args

Re: [Tutor] When am I ever going to use this?

2006-08-01 Thread Jordan Greenberg
have lists? Then Queues and Stacks are trivial to implement once you've got lists. If you're interested in learning more about data structures and their uses, this looks like a good reference: http://www.brpreiss.com/books/opus7/ -Jordan Greenberg

Re: [Tutor] define vars by iteration

2005-10-24 Thread Luke Jordan
Thanks for this insight into classes. It often takes me a few days to absorb and respond because my job limits the time I can give to programming. But thanks again for taking the time torespond in a meaningful way. Iguess I could say that you changed my world when it comes to programming (sorry,

Re: [Tutor] define vars by iteration

2005-10-20 Thread Luke Jordan
garbage cansIt's just that I can't pin down how to automate it, say through a loadAllMaps() func. Thanks again for your helpful advice! Luke On 10/19/05, Danny Yoo [EMAIL PROTECTED] wrote: On Wed, 19 Oct 2005, Luke Jordan wrote: I've got a bunch of pickled class instances with self.namehttp

[Tutor] define vars by iteration

2005-10-19 Thread Luke Jordan
I've got a bunch of pickled class instances with self.name attributes, and I would like toassignthe instances themselves to variables named whatever is stored in self.nameusing a function. Can't assign to literal, right? Is there a way to do this? Thanks, Luke

[Tutor] Assign to vars by iteration

2005-10-17 Thread Luke Jordan
I've got a bunch of pickled class instances, and I'm trying to load them as variables using a function. The class has a self.name attribute, and I've got a list of self.name for all the instances pickled separately. When I would like to attach the names of each instance to the corresponding class

[Tutor] Please excuse the previous message sent in error

2005-10-17 Thread Luke Jordan
Sincerely, Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] dictionaries in classes

2005-10-14 Thread Luke Jordan
Hi, Another stumped beginner here. I'm trying to have functions to create, edit and store dictionaries within a class. WhatI can't figure out is how to retain the edits after making them. I think it has something to do with namespace. Ideally I'd like to pickle class instances and be able to

Re: [Tutor] Sum of List Elements

2005-09-24 Thread Luke Jordan
Thanks for the help everyone, for answering a simple question and pointing me toward more resources.On 9/24/05, bob [EMAIL PROTECTED] wrote:At 08:11 AM 9/24/2005, Luke Jordan wrote:Hi All, I have spent an embarrassingly large amount of time trying to solve whaton its face seems like a simple

[Tutor] Filtering Spreadsheet Data

2005-05-23 Thread Luke Jordan
Hi All, I have several frighteningly cumbersome reports to review at my new job. I would like to write a python program to help me with my analysis. The goal of the program is to filter out information that doesn't meet certain requirements and print relevant results back to a legible report

[Tutor] Dispatching functions with args

2005-04-13 Thread Luke Jordan
Hi! I am using a suggestion from this list to handle calling different functions conditionallly based on user input. What I'm trying to do is have functions that are 'configurable' in the sense that a choice from the user affects the way it performs. This works: def aFunc(): print

Re: [Tutor] Associate functinos with Dictionary/Class Usage

2005-04-08 Thread Luke Jordan
Yes, Danny - that makes sense. I was getting hung up how to handle the parens in this part dict['some'](thing) all clear now. :-) On Apr 7, 2005 4:40 PM, Danny Yoo [EMAIL PROTECTED] wrote: On Thu, 7 Apr 2005, Luke Jordan wrote: I am looking for a little clarification of how exactly

[Tutor] Associate functinos with Dictionary/Class Usage

2005-04-07 Thread Luke Jordan
Hi! My questions arose from reading the Help with Classes email that's been on this list for the past couple of days. I'm also writing a text game, but mine is puzzle not adventure. Anyway, someone mentioned that you can key words to a dictionary to have user input run functions. I am looking

[Tutor] Functions Calling Functions

2005-02-25 Thread Luke Jordan
Hi - I'm working on a command-line game. Is there anything wrong with having each 'chapter' of the game be a function that links to other chapters by calling them? I only ask because when a recent traceback returned about 40 lines worth of error message, I realized that the functions are all

[Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Luke Jordan
Hi all, I've tried a lot of experimenting and searching through various tutorials, and I haven't been able to come up with a solution to this, ostensibly simple, problem. I'm writing a simple game (run in command line) in which narrative text is printed in response to a user's decisions. The

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Luke Jordan
Execllent. Many Thanks, Luke On Thu, 24 Feb 2005 13:15:41 -0500, Bill Mill [EMAIL PROTECTED] wrote: On Thu, 24 Feb 2005 13:14:13 -0500, Bill Mill [EMAIL PROTECTED] wrote: On Thu, 24 Feb 2005 10:02:44 -0800, Luke Jordan [EMAIL PROTECTED] wrote: Hi all, I've tried