Ticket #12 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Method to convert iterable object or collection to Array

Reported by: Slava Assigned to: Jan-Klaas Kollhof
Priority: normal Milestone: 2.0
Component: jsolait-core Version: 2.0
Severity: normal Keywords: array collection
Cc:

Description

It would be nice to have a method to convert any object, including arguments to Array. It could be on Array prototype to allow something similar to Array.concat, but that would instead work with collections.

Prototype library has a similar method: $A. It converts any object to array.

Change History

03/15/06 17:11:55 changed by Jan-Klaas Kollhof

  • status changed from new to closed.
  • resolution set to fixed.

this should be fixed now with the iter module's list(iterable) method. list() will take any iterable object and convert it into an Array. iterable - objects are Arrays, objects that have an __iter__() method that returns an Iterator object or objects like arguments, that have a length property and have an array like index access to it's elements.